[thelist] make mysql accept 0 (zero) as a primary key value

Brian Cummiskey Brian at hondaswap.com
Thu Dec 9 12:53:08 CST 2004


Sarah Sweeney wrote:

> Is there some option I can add to the create table definition that will 
> make this work, or a database-wide setting that will work? Any 
> suggestions on how to fix this problem will be greatly appreciated.
> 

ususally when a default option is needed, i try to use -1 as the value. 
  it tends to go over smoother and avoid the problems you are hitting 
right now.

make a back up of your data, if any.  truncate the table, which will 
remove all PK's with it.
REMOVE the definition of the PK on the id row.
insert the -1 row manually
put the primary key back on the table.
load data.

that should work.  if it doesn't, sorry for wasting yoru time.  maybe 
someone else can elaborate on the -1 usage some.


More information about the thelist mailing list