Bug #1714 | last_insert_id next value even upon failed insert | ||
---|---|---|---|
Submitted: | 30 Oct 2003 12:05 | Modified: | 3 Nov 2003 12:16 |
Reporter: | Patrick Galbraith | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | MySQL Server: InnoDB storage engine | Severity: | S4 (Feature request) |
Version: | 4.0.15 | OS: | Linux (Linux, RH 9.0) |
Assigned to: | CPU Architecture: | Any |
[30 Oct 2003 12:05]
Patrick Galbraith
[30 Oct 2003 12:14]
Dean Ellis
Behaviour occurs with both MyISAM and InnoDB with 4.0.16. LAST_INSERT_ID() reports an incremented value. The next successful insert uses the value the duplicate-key query would have used if successful, rather than last_insert_id() + 1. You should be testing for success of INSERT before testing the value of LAST_INSERT_ID(), but I agree, LAST_INSERT_ID() should not be returning the increment value. Thank you
[3 Nov 2003 12:16]
Brian Aker
Hi Pat! This is not a bug since you should not be using the state of the last insert id to determine whether or not the insert occured.