Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-38527

Boolean text options inconsistency, for ON/OFF and TRUE/FALSE usage only, but not for YES/NO

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.6, 12.2
    • 12.2
    • Parser
    • None
    • Can result in unexpected behaviour

    Description

      As part of the testing done in MDEV-37833, I verified boolean option consistency. In the patches being tested, a new set of option boolean options was added (FALSE/TRUE):

      - static const char *bools="NO,OFF,0,YES,ON,1";
      + static const char *bools="NO,OFF,FALSE,0,YES,ON,TRUE,1";
      

      Temp link to full patch: https://github.com/MariaDB/server/commit/824f6ebc9a22c1afd06420998eadbefeac12269c

      I noticed that text based option values are not consistently recognized. For example, 1 and YES will always work even if no [single] quotes are used:

      INSTALL SONAME 'ha_connect';
      CREATE TABLE t1 ENGINE=connect MAPPED=YES AS SELECT 1;
      SHOW CREATE TABLE t1;
      DROP TABLE t1;
      

      Will always work, as will "YES" and 'YES' (and CREATE TABLE will maintain the used format, even if no quotes are used, except for translating double quotes to single ones).

      However, the same is not valid for TRUE, FALSE, ON or OFF:

      INSTALL SONAME 'ha_connect';
      CREATE TABLE t1 ENGINE=connect MAPPED=ON AS SELECT 1;
      SHOW CREATE TABLE t1;
      DROP TABLE t1;
      

      Will fail:

      CS 12.2.0 fd15fd2765b53d0c070dd01d86fb231024b8f284 (Debug, Clang 21.1.3-20250923) Build 10/11/2025

      12.2.0-dbg>CREATE TABLE t1 ENGINE=connect MAPPED=ON AS SELECT 1;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'ON AS SELECT 1' at line 1
      

      As will TRUE (note; this is using bb-12.2-serg, which supports TRUE already):

      MDEV-37833 CS 12.2.0 fc5dd463df41ebc4c9aa53605323ef3be563d899 (Debug, Clang 21.1.3-20250923) Build 01/11/2025

      12.2.0-dbg>CREATE TABLE t1 ENGINE=connect MAPPED=TRUE AS SELECT 1;
      ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'TRUE AS SELECT 1' at line 1
      

      The same lines with 'ON' (any version) or 'TRUE' (in the feature tree) work fine.

      In summary; what was done (likely long ago) for YES/NO should be done for ON/OFF (for all versions) and for TRUE/FALSE (12.3+) also.

      Attachments

        Issue Links

          Activity

            People

              serg Sergei Golubchik
              Roel Roel Van de Paar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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