Gleb Paharenko:
> So in you query both last_insert_id() should return the same value,
> which equals to the value that was set for an AUTO_INCREMENT column by
> the last INSERT or UPDATE query. Note that you have one query, which
> just inserts several rows, so during it is processed the returned value
> of last_insert_id() is constant, even if your bulk insert is changing an
> AUTO_INCREMENT field.

That's what I thought, and on one server I have (4.0.21) it seems to work 
reliably that way. On another server (4.1.10a) that kind of insertions failed 
on a foreign key constraint. (I use InnoDB.) On a third box (4.1.14) it seems 
to work sometimes and fail sometimes. I think what happens when it fails is 
that the second last_insert_ID() gets the ID of the first row in the same 
query.

I suppose I should file a bug report then?

Björn Persson

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to