Re: MySQL 4.0.20 auto_increment bug
Paul Coldrey <[email protected]> Wed, 04 Aug 2004 11:23:59 +0930
| Newsgroups | gmane.comp.db.mysql.bugs |
|---|---|
| Organization | Ensigma |
| Message-ID | <[email protected]> |
I may be wrong, bit it is my understanding of the SQL standard the
AUTO_INCREMENT is only required to generate unique numbers that are
monotonic for values that the server generates.... hence this may not be
a bug. However, if it generates multiple Id's at 10001, etc then that
would definitely be a bug.
Also, if my understanding is correct then there would appear to still be
a documentation error as in section "6.5.3 CREATE TABLE Syntax" in the
MySQL 4.0 manual it suggests that AUTO_INCREMENT columns should behave
as Fred expected and not as I expected.
From the documentation:
An integer column may have the additional attribute AUTO_INCREMENT.
When you insert a value of NULL (recommended) or 0 into an
AUTO_INCREMENT column, the column value is set to value+1 where value is
the largest value for the column currently in the table.
Cheers,
Paul
Fred wrote:
>For InnoDB tables, the auto_increment is not handled properly if the
>index is updated thus:
>
>create table foobar (id bigint not null auto_increment, primary key(id),
>name text) type=InnoDB;
>
>insert into foobar (name) values ("red"), ("green"), ("blue");
>-- red is 1, green is 2, blue is 3
>
>update foobar set id = id+10000;
>-- red is 10001, blue is 10002, green is 10003, the next auto_increment
>entry SHOULD BE 10004
>
>insert into foobar (name) values ("white");
>-- white's id is 4 instead of 10004
>
>Version:
>mysql Ver 12.22 Distrib 4.0.20, for pc-linux (i686)
>
>Don't know if this bug exists elsewhere, but I suspect it does.
>
>
>
--
MySQL Bugs Mailing List
For list archives: http://lists.mysql.com/bugs
To unsubscribe: http://lists.mysql.com/[email protected]