There is entirely unexpected behavior here.
If you have gone to the trouble of defining a column in your database as
an auto_increment field
it should not simply stop working because you enter a negative number.
What we saw yesterday was the addition of a row with a negative number in
the auto_increment field, caused auto_increment to stop for any
FUTURE insert.
In other words, inserting a negative number makes the column not an
auto_increment field any more.
Somehow, in my mind this breaks the basic concept of a database schema,
that once you define something
it shouldn't change out from under you.
Here, we are in effect having to add that restriction programmatically.
The sequence went like this:
create table megatest3
( foo int not null auto_increment primary key,
blah char)
insert megatest3 (blah) values("A")
[ now we have 1,A in the table ]
insert megatest3 (foo, blah) (-1, "B")
[ now we have 1,A in table, and -1, B in table ]
insert megatest3(blah) values("C")
[ now we have 1,A, -1,B, and MAXINT, "C" ]
insert megatest3(blah) values("D")
[ now we have an sql error for double key, presumably because it is
trying to put in MAXINT]
Now imagine these sql statements spread over the span of say a week.
You might not get so lucky
as to figure out what is going on as we were.
-Tom
Jason Landry wrote:
> Well, except that the value of an auto-increment field CAN be set to a
> specific value (perhaps negative) an INSERT or UPDATE statement.
>
> > If Autoincrement can only work with positive numbers, then any
> > key that is auto_increment should automatically be made unsigned.
> >
---------------------------------------------------------------------
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