mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-7150 Wrong auto increment values on INSERT .. ON DUPLICATE KEY UPDATE when the inserted columns include NULL in an auto-increment column
when restoring auto-inc value in INSERT ... ON DUPLICATE KEY UPDATE, take into account that 1. it may be changed in the UPDATE clause (old code did that) 2. it may be changed in the INSERT clause and then cause a dup key (old code missed that)
This commit is contained in:
@@ -1754,7 +1754,7 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
|
||||
|
||||
table->file->adjust_next_insert_id_after_explicit_value(table->next_number_field->val_int());
|
||||
}
|
||||
else
|
||||
else if (prev_insert_id_for_cur_row)
|
||||
{
|
||||
table->file->restore_auto_increment(prev_insert_id_for_cur_row);
|
||||
}
|
||||
|
Reference in New Issue
Block a user