Skip to content

Primary key in Mysql doubled

Got a nice problem: a table, which has the following primary key: id, id.

You can use or dump this table without problems ... but you cannot reinsert the dump into the same (4.1) or a newer (5.0) mysql version.

This is the table dump, created with "SHOW CREATE TABLE tablename":

----- cut -----
CREATE TABLE tablename (
id int(11) NOT NULL auto_increment,
title_en text,
...
PRIMARY KEY (id,id)
) TYPE=MyISAM DEFAULT CHARSET=latin1;
----- cut -----

Now i try to reinsert this table into another database:

----- cut -----
mysql> CREATE TABLE tablename (
-> id int(11) NOT NULL auto_increment,
-> title_en text,
...
-> PRIMARY KEY (id,id)
-> ) TYPE=MyISAM DEFAULT CHARSET=latin1;
ERROR 1060 (42S21): Duplicate column name 'id'
----- cut -----

What the ...


Should i repeat myself?