Skip to content

Commit

Permalink
MDEV-29697 Assertion failure in Diagnostics_area::set_ok_status
Browse files Browse the repository at this point in the history
           upon CREATE OR REPLACE causing ER_UPDATE_TABLE_USED

Missed set return status to 1.
  • Loading branch information
midenok committed Oct 5, 2022
1 parent 0779e2c commit 074e358
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
9 changes: 9 additions & 0 deletions mysql-test/main/create_or_replace.result
Original file line number Diff line number Diff line change
Expand Up @@ -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;
12 changes: 12 additions & 0 deletions mysql-test/main/create_or_replace.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;
1 change: 1 addition & 0 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 074e358

Please sign in to comment.