Bug #7210 information_schema: can't access when table-name = reserved word
Description:
After I say "use information_schema;" I should be able to refer
to tables in information_schema without delimiting or qualifying, that is,
without having to say "information_schema . `table_name`" or
"information_schema . table_name". But
I can't do that for TABLES, COLUMNS, or PRIVILEGES because those
are reserved words. So this is a complaint about the parser.
These words should not be reserved.
The TABLES keyword, occurs after ANALYZE, BACKUP, CHECK, CHECKSUM,
DROP, FLUSH, LOCK, OPTIMIZE, RENAME, REPAIR, RESTORE, UNLOCK.
(Incidentally DROP TABLES is not documented.)
The PRIVILEGES keyword occurs after GRANT [ALL], SHOW, FLUSH.
The COLUMNS privilege occurs after SHOW [FULL] and in LOAD DATA ...
I don't see where there could be confusion with an identifier.
I asked (MySQL Senior Software Developer) Antony Curtis for
an opinion. He believes a change of this general nature would
be unlikely to cause major problems.
How to repeat:
mysql> use information_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Didn't find any fields in table 'SCHEMATA'
Didn't find any fields in table 'TABLES'
Didn't find any fields in table 'COLUMNS'
Didn't find any fields in table 'CHARACTER_SETS'
Didn't find any fields in table 'COLLATIONS'
Didn't find any fields in table 'COLLATION_CHARACTER_SET_APPLICABILITY'
Didn't find any fields in table 'ROUTINES'
Didn't find any fields in table 'STATISTICS'
Didn't find any fields in table 'VIEWS'
Didn't find any fields in table 'USER_PRIVILEGES'
Didn't find any fields in table 'SCHEMA_PRIVILEGES'
Didn't find any fields in table 'TABLE_PRIVILEGES'
Didn't find any fields in table 'COLUMN_PRIVILEGES'
Didn't find any fields in table 'TABLE_CONSTRAINTS'
Didn't find any fields in table 'KEY_COLUMN_USAGE'
Didn't find any fields in table 'TABLE_NAMES'
Database changed
mysql> select * from TABLES;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'TABLES' at line
1
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.