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?

  • Twitter
  • Bookmark Primary key in Mysql doubled at del.icio.us
  • Facebook
  • Google Bookmarks
  • FriendFeed
  • Digg Primary key in Mysql doubled
  • Bloglines Primary key in Mysql doubled
  • Technorati Primary key in Mysql doubled
  • Fark this: Primary key in Mysql doubled
  • Bookmark Primary key in Mysql doubled at YahooMyWeb
  • Bookmark Primary key in Mysql doubled at Furl.net
  • Bookmark Primary key in Mysql doubled at reddit.com
  • Bookmark Primary key in Mysql doubled at blinklist.com
  • Bookmark Primary key in Mysql doubled at Spurl.net
  • Bookmark Primary key in Mysql doubled at Simpy.com
  • Bookmark Primary key in Mysql doubled at blogmarks
  • Bookmark Primary key in Mysql doubled with wists
  • wong it!
  • Bookmark using any bookmark manager!
  • Stumble It!
  • Identi.ca