summaryrefslogtreecommitdiff
path: root/sql/sql_delete.cc
diff options
context:
space:
mode:
authorlrf141 <lucky.rabbitfoot141@gmail.com>2022-03-09 02:09:36 +0900
committerNikita Malyavin <nikitamalyavin@gmail.com>2022-11-24 02:05:53 +0300
commitda03d8d99f7ff441cc1079dc074fde204751ef63 (patch)
treeb4da7bcb872a556b5898ab1bd5a689381b72af40 /sql/sql_delete.cc
parent1ebf0b737202ecb8c0e83e2813cb0038a872d196 (diff)
downloadmariadb-git-da03d8d99f7ff441cc1079dc074fde204751ef63.tar.gz
MDEV-19190 Assertion `...auto_inc_initialized` failed in get_auto_increment
This is a DELETE only case. Normally this statement doesn't make inserts, but DELETE ... FOR PORTION changes it. UPDATE and INSERT initializes autoinc by calling handler::info(HA_STATUS_AUTO). Also myisam and innodb can lazily initialize it in their update_create_info overrides. The solution is to initialize autoinc during delete preparation, if period (DELETE FOR PORTION) is specified. The initial work has been done by Kento Takeuchi by his PR #2048, however this commit also holds a few technical modifications by Nikita Malyavin
Diffstat (limited to 'sql/sql_delete.cc')
-rw-r--r--sql/sql_delete.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 82d4dc48440..1b3fa3087e7 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -707,6 +707,10 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds,
{
table->use_all_columns();
table->rpl_write_set= table->write_set;
+ // Initialize autoinc.
+ // We don't set next_number_field here, as it is handled manually.
+ if (table->found_next_number_field)
+ table->file->info(HA_STATUS_AUTO);
}
else
{