Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-10142 PL/SQL parser
  3. MDEV-14012

sql_mode=Oracle: substr(): treat position 0 as position 1

    XMLWordPrintable

Details

    • 10.2.2-3, 10.2.2-1, 10.2.2-2, 10.2.2-4, 10.1.18

    Description

      When running with sql_mode=ORACLE, MariaDB should treat the second argument (the position) to "substr" in Oracle way: If position is 0, then it is treated as 1.

      Currently MariaDB returns an empty string in case when the position is 0:

      select substr('abc',0,3);
      +-------------------+
      | substr('abc',0,3) |
      +-------------------+
      |                   |
      +-------------------+
      

      This screenshot from an Oracle session demonstrates that 0 is translated to 1:

      SQL> select substr('abc',0,3) from dual;
       
      SUB
      ---
      abc
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              bar Alexander Barkov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.