|  | 
  leo - 2005-07-12 16:52:49In case you have a simple table with multiple Primary Keys eg:
 CREATE TABLE `item_subitem` (
 `itemid` int(5) unsigned NOT NULL default '0',
 `subitemid` int(5) unsigned NOT NULL default '0',
 PRIMARY KEY  (`itemid`,`subitemid`)
 ) TYPE=MyISAM
 
 
 The script will generate the following:
 
 create table item_subitem
 (
 itemid int unsigned primary key,
 subitemid int unsigned primary key
 );
 
 And this will throw an error while trying to execute:
 
 ERROR 1068 (42000) at line 256: Multiple primary key defined
 
 Is there any maintenance of this script?
 
  Can Ince - 2005-07-12 19:39:28 - In reply to message 1 from leoOnly one primary key may be defined for the same table.So, it's not a bug.
  leo - 2005-07-12 20:19:42 - In reply to message 2 from Can InceIm afraid not. You may have a goup of fields, assigned as a primary key, in the same table.They would be foreign keys, also
  leo - 2005-07-12 20:22:11 - In reply to message 2 from Can InceBy the way.. if you run this:CREATE TABLE `item_subitem` (
 `itemid` int(5) unsigned NOT NULL default '0',
 `subitemid` int(5) unsigned NOT NULL default '0',
 PRIMARY KEY (`itemid`,`subitemid`)
 ) TYPE=MyISAM
 
 you will fin that it's a perfectly valid statement.
 
 Actually, the example above, is a table definition in an existing database. And the code below, was generated by this script.
  Can Ince - 2005-07-12 21:27:09 - In reply to message 4 from leoWell, it's still only one primary key.. However, I apologize as I misunderstood the question. Probably, a case where multiple coloumns will be added to the primary key, is forgotten.Let me -and the author of course!- check the code against it.
 |