I don't believe that the table is corrupt, I'm more inclined to believe 
your zero theory.

create table crashme (a int(10) not null auto_increment primary key) type=isam;

insert into crashme set a=0;  # actually inserts a = 1;
update crashme set a=0 where a = 1;
insert into crashme set a=0;  # actually inserts a = 1;
alter table crashme type=myisam;
ERROR 1062 : Duplicate entry '1' for key 1

So, if you manage to set an autoincrement key to 0 in an ISAM table, alter 
table will always crash with a dupe key error.

Before I saw your e-mail reply, which probably would have been simpler, I 
solved the problem by:
Create a new table called job_new
insert into job_new select fields_in_new_table_order from job;
rename job to job_old
rename job_new to job

Perhaps alter table should be a bit more forgiving?

Regards,
Rich


At 05:06 PM 10/30/01, Steve Meyers wrote:
>You might have a corrupt table.  For 3.22 format, you'll need to use
>isamchk, I think...  It's been a long time since I've worked with ISAM
>tables.
>
>Now that I look closer at your email, though, it is probably the fact
>that your id's start with 0, not 1.  The alter table actually dumps the
>data into a new table.  It may be inserting the 0 as a 1
>(auto_increments tend to do that -- it can be annoying at times).  Then
>the 1 fails because of the duplicate key.  Seems rather silly for an
>alter table to do, though, so let me know what you find out.


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to