Bug #7210 information_schema: can't access when table-name = reserved word
Submitted: 13 Dec 2004 1:02 Modified: 18 Dec 2004 7:51
Reporter: Peter Gulutzan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0.3-alpha-debug OS:Linux (SUSE 9.2)
Assigned to: Sergei Glukhov CPU Architecture:Any

[13 Dec 2004 1:02] Peter Gulutzan
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
[18 Dec 2004 7:51] Sergei Glukhov
Fixed on 5.0 source tree
[21 Dec 2004 19:14] Peter Gulutzan
Thank you. I still cannot create procedures named "tables" or "privileges" or "columns" but I 
expect that is bug#7298, not bug#7210.