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

David Siedband technique at oceanicsky.com
Fri Dec 10 14:15:44 CST 2004

This is a documented issue.  MySQL InnoDB tables don't like 0 as a 
primary key.
You can manually enter it but if you alter the table it re-increments.

If you google with the title of your original e-mail this is the first 
David Siedband

On Dec 10, 2004, at 5:49 AM, Sarah Sweeney wrote:

>> 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.
> This would work, except that I have the 0 hard-coded in various places 
> and it appears as a foreign key in several other tables. (But thanks, 
> Brian!)
> More info, in case it helps: if I open the dump file and move the 
> insert statement that adds the row for AgencyID = 0 after the insert 
> statement that adds the row for AgencyID = 1, it works fine.
> Unfortunately, the database is huge, so making this simple change to 
> the dump file every time I copy the database is a major pain - it's 
> hard to find an editor that will happily open a 264MB text file :) For 
> now, I've settled with running the dump on all tables but the 
> troublesome one, but it would be a lot easier if I didn't have to do 
> that.
> -- 
> Sarah Sweeney  ::  Web Developer & Programmer
> Portfolio  ::  http://sarah.designshift.com
> Blog  ::  http://hardedge.ca
> -- 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> For unsubscribe and other options, including the Tip Harvester and 
> archives of thelist go to: http://lists.evolt.org Workers of the Web, 
> evolt !

More information about the thelist mailing list