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

Keywords are parsed as identifiers in some context

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
    • Fix Version/s: 10.5
    • Component/s: Parser
    • Labels:
      None

      Description

      In some cases, the parser treats keywords as identifiers near a dot character. Moreover, the behaviour depends on the presense of a space character between the dot and the identifier.

      SELECT t1.select FROM t1;
      

      ERROR 1054 (42S22): Unknown column 't1.select' in 'field list'
      

      Wrong. Should get a syntax error.

      SELECT t1. select FROM t1;
      

      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 'select FROM t1' at line 1
      

      Correct. Notice, the space after the dot.

      SELECT t1 .select FROM t1;
      

      ERROR 1054 (42S22): Unknown column 't1.select' in 'field list'
      

      Wrong. Should get a syntax error.

      SELECT select.a FROM `select`;
      

      ERROR 1146 (42S02): Table 'test.select' doesn't exist
      

      Wrong. Should get a syntax error.

      SELECT select. a FROM `select`;
      

      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 'select. a FROM `select`' at line 1
      

      Correct. Notice, the space after the dot.

      SELECT select .a FROM `select`;
      

      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 'select .a FROM `select`' at line 1
      

      Correct. Notice the space before the dot.

        Attachments

          Activity

            People

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

              Dates

              Created:
              Updated:

                Git Integration