diff options
author | Aleksey Midenkov <midenok@gmail.com> | 2022-10-05 17:46:51 +0300 |
---|---|---|
committer | Aleksey Midenkov <midenok@gmail.com> | 2022-10-05 19:53:13 +0300 |
commit | 074e358213ac8f358fa01c2c03ed58e94c81baf8 (patch) | |
tree | 95c71997e93b5d0cfe0c7cb16cae79cf6838ce98 | |
parent | 0779e2cb1013556c4d67bcc326706dfd449db392 (diff) | |
download | mariadb-git-074e358213ac8f358fa01c2c03ed58e94c81baf8.tar.gz |
MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status
upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED
Missed set return status to 1.
-rw-r--r-- | mysql-test/main/create_or_replace.result | 9 | ||||
-rw-r--r-- | mysql-test/main/create_or_replace.test | 12 | ||||
-rw-r--r-- | sql/sql_table.cc | 1 |
3 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/main/create_or_replace.result b/mysql-test/main/create_or_replace.result index c9863f56154..09ae481e3d9 100644 --- a/mysql-test/main/create_or_replace.result +++ b/mysql-test/main/create_or_replace.result @@ -532,3 +532,12 @@ SELECT * FROM t3; ERROR HY000: Table 't3' was not locked with LOCK TABLES UNLOCK TABLES; DROP TABLE t3; +# +# MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status +# upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED +# +CREATE TABLE t (a INT) ENGINE=MyISAM; +CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t); +CREATE OR REPLACE TABLE t LIKE tm; +ERROR HY000: Table 'tm' is specified twice, both as a target for 'CREATE' and as a separate source for data +DROP TABLE IF EXISTS tm, t; diff --git a/mysql-test/main/create_or_replace.test b/mysql-test/main/create_or_replace.test index ba32f4b7603..badb7d0642a 100644 --- a/mysql-test/main/create_or_replace.test +++ b/mysql-test/main/create_or_replace.test @@ -485,3 +485,15 @@ CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT ''); SELECT * FROM t3; UNLOCK TABLES; DROP TABLE t3; + +--echo # +--echo # MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status +--echo # upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED +--echo # +CREATE TABLE t (a INT) ENGINE=MyISAM; +CREATE TABLE tm (a INT) ENGINE=MERGE UNION(t); +--error ER_UPDATE_TABLE_USED +CREATE OR REPLACE TABLE t LIKE tm; + +# Cleanup +DROP TABLE IF EXISTS tm, t; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 02b9a2cb96b..413d78ae814 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -5742,6 +5742,7 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, if ((duplicate= unique_table(thd, table, src_table, 0))) { update_non_unique_table_error(src_table, "CREATE", duplicate); + res= 1; goto err; } } |