summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2022-10-04 16:35:36 +0300
committerAleksey Midenkov <midenok@gmail.com>2022-10-14 19:46:06 +0300
commiteb4056f8459b382af172d84b447d327450757495 (patch)
treefe40a31c5966992155b7e736ee605fd97b603fcb
parentd9092e3de7b6868403f2611508249aa0bcd9022a (diff)
downloadmariadb-git-eb4056f8459b382af172d84b447d327450757495.tar.gz
MDEV-29699 Assertion `!table_list->table || frm.str || !atomic_replace'
failed upon CREATE OR REPLACE with ARCHIVE The assertion assumed that create_and_open_tmp_table() requires frm.str to work (to create temporary table for atomic replace). But actually this is not true. The table can be created without frm by using the discovery mechanism. This happens in the current case with ARCHIVE engine.
-rw-r--r--mysql-test/suite/archive/archive.result9
-rw-r--r--mysql-test/suite/archive/archive.test11
-rw-r--r--sql/sql_insert.cc3
3 files changed, 21 insertions, 2 deletions
diff --git a/mysql-test/suite/archive/archive.result b/mysql-test/suite/archive/archive.result
index 022b400fd97..6d606701179 100644
--- a/mysql-test/suite/archive/archive.result
+++ b/mysql-test/suite/archive/archive.result
@@ -12919,3 +12919,12 @@ ERROR HY000: Can't create table `test`.`t` (errno: 140 "Wrong create options")
#
# End of 10.8 tests
#
+#
+# MDEV-29699 Assertion `!table_list->table || frm.str || !atomic_replace'
+# failed upon CREATE OR REPLACE with ARCHIVE
+#
+create or replace table t engine=archive as select 1 as a;
+drop table t;
+#
+# End of 10.11 tests
+#
diff --git a/mysql-test/suite/archive/archive.test b/mysql-test/suite/archive/archive.test
index b6920827005..e0fdc212af2 100644
--- a/mysql-test/suite/archive/archive.test
+++ b/mysql-test/suite/archive/archive.test
@@ -1791,3 +1791,14 @@ create table t (t int auto_increment, key (t desc)) engine=archive;
--echo #
--echo # End of 10.8 tests
--echo #
+
+--echo #
+--echo # MDEV-29699 Assertion `!table_list->table || frm.str || !atomic_replace'
+--echo # failed upon CREATE OR REPLACE with ARCHIVE
+--echo #
+create or replace table t engine=archive as select 1 as a;
+drop table t;
+
+--echo #
+--echo # End of 10.11 tests
+--echo #
diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc
index c850bdbe34f..f5a4d09054f 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -4780,7 +4780,7 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
{
/*
The pointer to the newly created temporary table has been stored in
- table->create_info.
+ create_info->table.
*/
table_list->table= create_info->table;
if (!table_list->table)
@@ -4798,7 +4798,6 @@ TABLE *select_create::create_table_from_items(THD *thd, List<Item> *items,
table_list->table= 0; // Create failed
err:
- DBUG_ASSERT(!table_list->table || frm.str || !atomic_replace);
my_free(const_cast<uchar *>(frm.str));
if (unlikely(!(table= table_list->table)))