Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Not a Bug
-
10.2.16, 10.3.7
-
None
Description
When inserting values into a table with auto_increment column via bulk operation, the result of mysql_stmt_insert_id() differs:
In case buffer_type MYSQL_TYPE_NULL is used, or indicator variable was set to STMT_INDICATOR_IGNORE the values of first inserted row will be returned.
Output from attached test case:
Insert id with buffer_type MYSQL_TYPE_LONG: 2 |
Max value for t1.a=2 |
Insert id with buffer_type MYSQL_TYPE_NULL: 1 |
Max value for t1.a=2 |
Insert id with buffer_type STMT_INDICATOR_NULL: 1 |
Max value for t1.a=2 |
It is according to our documentation https://mariadb.com/kb/en/library/last_insert_id/
if statement insert several rows, mysql_stmt_insert_id is assigned with first insert value