Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11.17
-
None
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
- relates to
-
MDEV-17677 Keywords are parsed as identifiers when followed by a dot
-
- Closed
-