Hello.
Really, in my opinion, it contradicts with the manual. Please, send me the bug id in case you'll report the bug. Björn Persson wrote: > Gleb Paharenko: > >>Could you provide a repeatable test case for you problem? > > > I don't know how repeatable this is. As I said I have one computer where it= > =20 > seems to work sometimes, as if there's a race condition. Right now it seems= > =20 > repeatable on the computer I'm using at the moment: > > > mysql> select version(); > +-----------+ > | version() | > +-----------+ > | 4.1.14 | > +-----------+ > 1 row in set (0.00 sec) > > mysql> create table parent ( > -> ID int unsigned not null auto_increment, > -> value varchar(50), > -> primary key (ID) > -> ); > Query OK, 0 rows affected (0.01 sec) > > mysql> create table child ( > -> ID int unsigned not null auto_increment, > -> parent_ID int unsigned not null, > -> value varchar(50), > -> primary key (ID) > -> ); > Query OK, 0 rows affected (0.00 sec) > > mysql> insert into parent (value) values ('a'); > Query OK, 1 row affected (0.00 sec) > > mysql> insert into child (parent_ID, value) values > -> (last_insert_ID(), 'b1'), (last_insert_ID(), 'b2'), > -> (last_insert_ID(), 'b3'); > Query OK, 3 rows affected (0.00 sec) > Records: 3 Duplicates: 0 Warnings: 0 > > mysql> insert into parent (value) values ('c'); > Query OK, 1 row affected (0.00 sec) > > mysql> insert into child (parent_ID, value) values > -> (last_insert_ID(), 'd1'), (last_insert_ID(), 'd2'), > -> (last_insert_ID(), 'd3'); > Query OK, 3 rows affected (0.00 sec) > Records: 3 Duplicates: 0 Warnings: 0 > > mysql> select * from child; > +----+-----------+-------+ > | ID | parent_ID | value | > +----+-----------+-------+ > | 1 | 1 | b1 | > | 2 | 1 | b2 | > | 3 | 2 | b3 | > | 4 | 2 | d1 | > | 5 | 4 | d2 | > | 6 | 5 | d3 | > +----+-----------+-------+ > 6 rows in set (0.00 sec) > > > Note how child rows 1 and 4 have the IDs of their respective parent row in = > the=20 > parent_ID field, but child rows 3, 5 and 6 have the ID of the preceding chi= > ld=20 > row instead. (For row 2 we can't tell the difference.) > > Here's the SQL code for easy copying: > > > use test; > > create table parent ( > ID int unsigned not null auto_increment, > value varchar(50), > primary key (ID) > ); > > create table child ( > ID int unsigned not null auto_increment, > parent_ID int unsigned not null, > value varchar(50), > primary key (ID) > ); > > insert into parent (value) values ('a'); > > insert into child (parent_ID, value) values=20 > (last_insert_ID(), 'b1'), (last_insert_ID(), 'b2'), > (last_insert_ID(), 'b3'); > > insert into parent (value) values ('c'); > > insert into child (parent_ID, value) values=20 > (last_insert_ID(), 'd1'), (last_insert_ID(), 'd2'), > (last_insert_ID(), 'd3'); > > select * from child; > > > Bj=F6rn Persson > -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.NET http://www.ensita.net/ __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Gleb Paharenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.NET <___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]