Bug #78934 Failed INSERT(Dup entry) still change LAST_INSERT_ID() for auto_increment col
| Submitted: | 23 Oct 2015 4:14 | Modified: | 26 Oct 2015 13:37 |
|---|---|---|---|
| Reporter: | Su Dylan | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
| Version: | 5.7.8 | OS: | Any |
| Assigned to: | CPU Architecture: | Any |
[23 Oct 2015 4:14]
Su Dylan
[26 Oct 2015 13:37]
MySQL Verification Team
Hello Su Dylan, Thank you for the report. Imho if you insert multiple rows using a single INSERT statement, LAST_INSERT_ID() returns the value generated for the first inserted row only. Also, for transactional tables, if the statement is rolled back due to an error, the value of LAST_INSERT_ID() is left undefined. For manual ROLLBACK, the value of LAST_INSERT_ID() is not restored to that before the transaction; it remains as it was at the point of the ROLLBACK. Please see https://dev.mysql.com/doc/refman/5.7/en/information-functions.html#function_last-insert-id “Lost” auto-increment values and sequence gaps in https://dev.mysql.com/doc/refman/5.7/en/innodb-auto-increment-configurable.html Thanks, Umesh
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.049 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.