[MDEV-23036] Keywords are parsed as identifiers in some context Created: 2020-06-29  Updated: 2020-06-29

Status: Open
Project: MariaDB Server
Component/s: Parser
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.5

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Unresolved Votes: 0
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.


Generated at Thu Feb 08 09:19:21 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.