summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Midenkov <midenok@gmail.com>2021-10-11 15:28:00 +0300
committerSergei Golubchik <serg@mariadb.org>2021-10-26 10:54:48 +0200
commitcf6db10ddbfc5b077fac8bcb90990754912461e7 (patch)
treea692bc444e2b746b0e0f3b0f56997febf3e09572
parentcf9295a6e6582200b5634d66ac7a735b45f153bb (diff)
downloadmariadb-git-preview-10.7-MDEV-22166-convert-partition.tar.gz
MDEV-26767 Server crashes when rename table and alter storage enginepreview-10.7-MDEV-22166-convert-partition
Wrong assertion leftover removed. m_sql_cmd can be allocated by any ALTER subcommand and before allocation it is checked for NULL first.
-rw-r--r--mysql-test/main/alter_table.result5
-rw-r--r--mysql-test/main/alter_table.test6
-rw-r--r--sql/sql_lex.cc1
3 files changed, 11 insertions, 1 deletions
diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
index a2830b95294..bef7f393d1d 100644
--- a/mysql-test/main/alter_table.result
+++ b/mysql-test/main/alter_table.result
@@ -3375,3 +3375,8 @@ drop table t1;
#
# End of 10.5 tests
#
+#
+# MDEV-26767 Server crashes when rename table and alter storage engine
+#
+alter table txxx engine=innodb, rename to tyyy;
+ERROR 42S02: Table 'test.txxx' doesn't exist
diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test
index d81f50e096c..4bf5eed5a43 100644
--- a/mysql-test/main/alter_table.test
+++ b/mysql-test/main/alter_table.test
@@ -2570,3 +2570,9 @@ drop table t1;
--echo #
--echo # End of 10.5 tests
--echo #
+
+--echo #
+--echo # MDEV-26767 Server crashes when rename table and alter storage engine
+--echo #
+--error ER_NO_SUCH_TABLE
+alter table txxx engine=innodb, rename to tyyy;
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 503f750fe61..f2fa44ad9c2 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -11260,7 +11260,6 @@ bool LEX::stmt_alter_table_exchange_partition(Table_ident *table)
bool LEX::stmt_alter_table(Table_ident *table)
{
DBUG_ASSERT(sql_command == SQLCOM_ALTER_TABLE);
- DBUG_ASSERT(!m_sql_cmd);
first_select_lex()->db= table->db;
if (first_select_lex()->db.str == NULL &&
copy_db_to(&first_select_lex()->db))