Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
10.11, 11.4, 11.8, 12.3, 10.11.17
-
Can result in unexpected behaviour
-
The server failed to parse schema-qualified table names when the unquoted table name began with a digit.
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
- is duplicated by
-
MDEV-39678 Column name starting with digit fails without backticks in 11.4.11 (regression from 11.4.10)
-
- Closed
-
-
MDEV-39740 Can't update select sepecial field names
-
- Closed
-
- relates to
-
MDEV-17677 parse keywords followed by a dot as keywords
-
- Stalled
-