diff --git a/mysql-test/r/merge.result b/mysql-test/r/merge.result index d3563e9f1c1..893ea5acf88 100644 --- a/mysql-test/r/merge.result +++ b/mysql-test/r/merge.result @@ -2207,4 +2207,16 @@ ERROR HY000: Table storage engine for 'm1' doesn't have this option DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7; SELECT 1 FROM m1; ERROR 42S02: Table 'test.m1' doesn't exist +# +# Bug #46614: Assertion in show_create_trigger() +# +CREATE TABLE t1(a int); +CREATE TABLE t2(a int); +CREATE TABLE t3(a int) ENGINE = MERGE UNION(t1, t2); +CREATE TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo(); +SHOW CREATE TRIGGER tr1; +Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation +tr1 CREATE DEFINER=`root`@`localhost` TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo() latin1 latin1_swedish_ci latin1_swedish_ci +DROP TRIGGER tr1; +DROP TABLE t1, t2, t3; End of 5.1 tests diff --git a/mysql-test/t/merge.test b/mysql-test/t/merge.test index 39c805d2b5b..015ae28c155 100644 --- a/mysql-test/t/merge.test +++ b/mysql-test/t/merge.test @@ -1622,4 +1622,15 @@ DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7; --error ER_NO_SUCH_TABLE SELECT 1 FROM m1; # Should not hang! +--echo # +--echo # Bug #46614: Assertion in show_create_trigger() +--echo # +CREATE TABLE t1(a int); +CREATE TABLE t2(a int); +CREATE TABLE t3(a int) ENGINE = MERGE UNION(t1, t2); +CREATE TRIGGER tr1 AFTER INSERT ON t3 FOR EACH ROW CALL foo(); +SHOW CREATE TRIGGER tr1; +DROP TRIGGER tr1; +DROP TABLE t1, t2, t3; + --echo End of 5.1 tests diff --git a/sql/sql_show.cc b/sql/sql_show.cc index ae75609e2b6..5c2c351652b 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -7071,8 +7071,6 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name) /* Perform closing actions and return error status. */ } - DBUG_ASSERT(num_tables == 1); - Table_triggers_list *triggers= lst->table->triggers; if (!triggers)