diff options
author | Sergei Golubchik <serg@mariadb.org> | 2018-12-14 14:28:30 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-12-20 08:06:55 +0100 |
commit | 7b2e2288e9f784ea12f85dc005503511fe99f796 (patch) | |
tree | a64ade4e4d6f7a98e78210b757053e8114a94f4c /sql/sql_table.cc | |
parent | a79183b01e4e1f3af55abd102715560cecbbddae (diff) | |
download | mariadb-git-7b2e2288e9f784ea12f85dc005503511fe99f796.tar.gz |
MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table
if the CHECK constraint failed in copy_data_between_tables(),
the loop was aborted prematurely and to->auto_increment_field_not_null
wasn't reset.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1765e352b88..9e72278db8d 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10065,14 +10065,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, error= 1; break; } - if (to->next_number_field) - { - if (auto_increment_field_copied) - to->auto_increment_field_not_null= TRUE; - else - to->next_number_field->reset(); - } - + for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++) { copy_ptr->do_copy(copy_ptr); @@ -10091,6 +10084,13 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, error= 1; break; } + if (to->next_number_field) + { + if (auto_increment_field_copied) + to->auto_increment_field_not_null= TRUE; + else + to->next_number_field->reset(); + } error=to->file->ha_write_row(to->record[0]); to->auto_increment_field_not_null= FALSE; if (error) |