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

10.11.17 regression: schema-qualified unquoted table name starting with digit fails to parse

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.11.17
    • None
    • Parser

    Description

      After upgrading to MariaDB 10.11.17, a query using a schema-qualified unquoted table name starting with a digit fails with a syntax error.

      The issue is not that the table name itself is invalid. The same table can be queried successfully when it is not schema-qualified, and it can also be queried successfully when the table name is backtick-quoted.

      Reproducer:

      CREATE DATABASE IF NOT EXISTS test2;
      USE test2;
       
      DROP TABLE IF EXISTS table1;
      DROP TABLE IF EXISTS `1table`;
       
      CREATE TABLE table1 (
        id INT NOT NULL PRIMARY KEY
      );
       
      CREATE TABLE `1table` (
        id INT NOT NULL PRIMARY KEY
      );
       
      INSERT INTO table1 VALUES (1);
      INSERT INTO `1table` VALUES (1);
       
      -- Works:
      EXPLAIN SELECT * FROM test2.table1;
       
      -- Fails in MariaDB 10.11.17:
      EXPLAIN SELECT * FROM test2.1table;
       
      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 '.1table' at line 1
       
      -- Works:
      EXPLAIN SELECT * FROM test2.`1table`;
       
      -- Also works when current database is test2:
      EXPLAIN SELECT * FROM 1table;
      

      The behavior suggests that the parser/lexer treats ".1" in "test2.1table" as the start of a numeric token instead of treating "." as the schema/table qualifier separator followed by the identifier "1table".

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Onesoft Yury Buravtsov
              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.