View Single Post

   
  #1 (permalink)  
Old 02-28-2008, 11:29 AM
Darek
 
Posts: n/a
Default CREATE TABLE with 'table' and 'field' as Key names

Hi there,

I'm moving a database from 3.23.49 to 5.0.20a and having problems with a
certain "CREATE TABLE":

CREATE TABLE shp_tbl_def (
id tinyint(3) unsigned NOT NULL auto_increment,
table_name varchar(255) NOT NULL default '',
field_name varchar(255) NOT NULL default '',
form_caption tinytext NOT NULL,
position tinyint(4) NOT NULL,
PRIMARY KEY (id),
UNIQUE KEY id (id),
KEY id_2 (id),
KEY table (table_name),
KEY field (field_name),
KEY position (position)
) TYPE=MyISAM;

If I rename "table" and "field" to "table2" and "field2" the table is
created, otherwise, with the above syntax I get

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 'table (table_name),
KEY field (field_name),
KEY position (position)
) TYPE=M' at line 10

This database is for a hosted site, so I don't know if the key names are
required, and I'm not really in a position to start renaming them.

The same error pops up when I try the insert on 3.23.49 and I got this
CREATE syntax from mysqldump, using '-c -a', '-c', '-a' and no switch at
all.

What can I do to troubleshoot this further?
Reply With Quote