1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2021-06-18 09:16:20 +03:00
10 changed files with 167 additions and 5 deletions

View File

@ -10508,7 +10508,12 @@ do_continue:;
DBUG_PRINT("info", ("is_table_renamed: %d engine_changed: %d",
alter_ctx.is_table_renamed(), engine_changed));
if (!alter_ctx.is_table_renamed())
/*
InnoDB cannot use the rename optimization when foreign key
constraint is involved because InnoDB fails to drop the
parent table due to foreign key constraint
*/
if (!alter_ctx.is_table_renamed() || alter_ctx.fk_error_if_delete_row)
{
/*
Rename the old table to temporary name to have a backup in case
@ -10560,7 +10565,7 @@ do_continue:;
(void) quick_rm_table(thd, new_db_type, &alter_ctx.new_db,
&alter_ctx.tmp_name, FN_IS_TMP);
if (!alter_ctx.is_table_renamed())
if (!alter_ctx.is_table_renamed() || alter_ctx.fk_error_if_delete_row)
{
// Restore the backup of the original table to the old name.
(void) mysql_rename_table(old_db_type, &alter_ctx.db, &backup_name,