summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2023-01-18 16:52:12 +0300
committerAleksey Midenkov <midenok@gmail.com>2023-01-26 17:15:21 +0300
commit6a3244b94db08718884d62ee1fd13bffb4afb5b3 (patch)
tree7df9115204cb9ba87a81a56027be49bb975b3c79
parentf257c8c00843213f3c89fffc0cd2dec83755250f (diff)
downloadmariadb-git-6a3244b94db08718884d62ee1fd13bffb4afb5b3.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 275c0c09fe6..357f5236470 100644
--- a/sql/sql_insert.cc
+++ b/sql/sql_insert.cc
@@ -4797,7 +4797,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)
@@ -4816,7 +4816,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)))