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

A few Reserved Words are allowed to use as Column/Table name

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Not a Bug
    • Affects Version/s: 10.5.11
    • Fix Version/s: N/A
    • Component/s: Parser
    • Labels:
      None

      Description

      One of our customer noted that from the list of Reserved words - https://mariadb.com/kb/en/reserved-words/ a few of them, they can able to use it as a table name/column name.

      Following Reserved words - can be specified as a table/column name
      GENERAL
      IGNORE_SERVER_IDS
      MASTER_HEARTBEAT_PERIOD
      OFFSET
      OPTION
      POSITION
      SLOW
      WINDOW

      I found an existing bug - MDEV-10312, noted about this and marked as "not a bug", mentioning only keywords that are required by the grammar to be reserved are reserved.

      But, the customer pointed one case, that with the Reserved word - POSITION

      • without space in the CREATE TABLE statement getting syntax error -expected behavior
      • with space able to create the table with name POSITION

      ## without space:
      MariaDB [test]> create table POSITION(i int);
      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 'POSITION(i int)' at line 1
      ## with space:
      MariaDB [test]> create table POSITION (i int);
      Query OK, 0 rows affected (0.005 sec) 
      MariaDB [test]> select @@version;
      +-----------------+
      | @@version       |
      +-----------------+
      | 10.5.11-MariaDB |
      +-----------------+
      1 row in set (0.000 sec)
      

      If I checked with other reserved word, for both cases getting syntax error, expected behavior:

      MariaDB [test]> create table FALSE (i int);
      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 'FALSE (i int)' at line 1
      MariaDB [test]> create table FALSE(i int);
      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 'FALSE(i int)' at line 1
      MariaDB [test]>
      

      Can this be fixed.

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            suresh.ramagiri@mariadb.com suresh ramagiri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration