summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-10-15 01:41:37 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-10-15 01:41:37 +0300
commit6df00b8559347e090a07fc971a033419432fda27 (patch)
tree71714848c8c1afacccfa28bb3e56d305993b87d8 /sql/sql_table.cc
parentaabf07307497c8ed2089869f8f1d2210c06c1709 (diff)
downloadmariadb-git-6df00b8559347e090a07fc971a033419432fda27.tar.gz
MDEV-29783 ER_NO_SUCH_TABLE_IN_ENGINE after failed CREATE OR REPLACE with FK violation
If atomic C-O-R fails it reverts back to original table. When doing so InnoDB code checked old table for foreign key consistency and failed. The patch disables foreign key check when reverting to original table: they was created in previous statement and current statement has nothing to do with that. InnoDB part just disables any warnings in that case. The warnings was done when the foreign keys was created.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 82f750b420f..1f075d7d088 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4531,7 +4531,10 @@ void HA_CREATE_INFO::finalize_ddl(THD *thd, bool roll_back)
debug_crash_here("ddl_log_create_fk_fail");
ddl_log_complete(ddl_log_state_rm);
debug_crash_here("ddl_log_create_fk_fail2");
+ ulonglong option_bits_save= thd->variables.option_bits;
+ thd->variables.option_bits|= OPTION_NO_FOREIGN_KEY_CHECKS;
(void) ddl_log_revert(thd, ddl_log_state_create);
+ thd->variables.option_bits= option_bits_save;
debug_crash_here("ddl_log_create_fk_fail3");
}
else