Bug #19772 Can't create table with column name = "upgrade"
Submitted: 12 May 2006 13:54 Modified: 12 May 2006 14:32
Reporter: alex aa Email Updates:
Status: Not a Bug Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:5.0.21 OS:FreeBSD (freebsd)
Assigned to: CPU Architecture:Any

[12 May 2006 13:54] alex aa
Description:
create table test (   pu_id int(11) NOT NULL auto_increment, upgrade char(1) DEFAULT '0',   PRIMARY KEY (pu_id));
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 'upgrade char(1) DEFAULT '0',   PRIMARY KEY (pu_id))' at line 1

create table test (   pu_id int(11) NOT NULL auto_increment, upgrad char(1) DEFAULT '0',   PRIMARY KEY (pu_id));
Query OK, 0 rows affected (0.08 sec)

Can't insert column with name "upgrade".

How to repeat:
create table test (   pu_id int(11) NOT NULL auto_increment, upgrade char(1) DEFAULT '0',   PRIMARY KEY (pu_id));
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 'upgrade char(1) DEFAULT '0',   PRIMARY KEY (pu_id))' at line 1
[12 May 2006 14:32] MySQL Verification Team
Thank you for the bug report. Upgrade and order are reserved words, please
see: http://dev.mysql.com/doc/refman/5.0/en/reserved-words.html.

According with the Manual's instructions for to create tables with reserved
words is necessary to enclose them between ``:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.22-debug

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> create table test( pu_id int(11) NOT NULL auto_increment,
    -> `upgrade` char(1) DEFAULT '0', `order` int,  PRIMARY KEY (pu_id));
Query OK, 0 rows affected (0.02 sec)

mysql>