Bug #445 Can't access columns named "check" in 4.0.12
Submitted: 17 May 2003 21:06 Modified: 18 May 2003 22:43
Reporter: [ name withheld ] Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server: MyISAM storage engine Severity:S2 (Serious)
Version:4.0.12 OS:Linux (Linux)
Assigned to: CPU Architecture:Any

[17 May 2003 21:06] [ name withheld ]
Description:
After upgrade to 4.0.12 we can no longer access any table columns using the name "check".  'select check from temptable' causes a syntax error as, unfortunately so does, 'alter table temptable modify column check check_no int'.  

We will downgrade to alter our table and then re-upgrade however this undocumented change was fairly annoying and required many hours of hunting to figure out.

Mark Alston

How to repeat:
Create a table with a column called check in mysql 4.0.4 and then try to access that column with mysql 4.0.12.

Suggested fix:
No damn idea.
[18 May 2003 22:43] Alexander Keremidarski
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.mysql.com/documentation/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

CHECK is reserved word. In order to be used as column name reserved word has
to be quoted with backticks.

select `check` from temptable;

Second query is wrong. MODIFY COLUMN can't change column name. Use CHANGE COLUMN instead.

alter table temptable change column `check` check_no int;

Same applies to all reserved words.
http://www.mysql.com/doc/en/Reserved_words.html