Commit 3b1280fa authored by Ramil Kalimullin's avatar Ramil Kalimullin

Fix for bug #46614: Assertion in show_create_trigger()

on SHOW CREATE TRIGGER + MERGE table

Problem: SHOW CREATE TRIGGER erroneously relies on fact
that we have the only underlying table for a trigger
(wrong for merge tables).

Fix: remove erroneous assert().


mysql-test/r/merge.result:
  Fix for bug #46614: Assertion in show_create_trigger() 
  on SHOW CREATE TRIGGER + MERGE table
    - test result.
mysql-test/t/merge.test:
  Fix for bug #46614: Assertion in show_create_trigger() 
  on SHOW CREATE TRIGGER + MERGE table
    - test case.
sql/sql_show.cc:
  Fix for bug #46614: Assertion in show_create_trigger() 
  on SHOW CREATE TRIGGER + MERGE table
    - unnecessary assert() removed as we may have more than 1 
  tables open e.g. for a merge table.
parent fce4fa36
...@@ -2207,4 +2207,16 @@ ERROR HY000: Table storage engine for 'm1' doesn't have this option ...@@ -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; DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
SELECT 1 FROM m1; SELECT 1 FROM m1;
ERROR 42S02: Table 'test.m1' doesn't exist 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 End of 5.1 tests
...@@ -1622,4 +1622,15 @@ DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7; ...@@ -1622,4 +1622,15 @@ DROP TABLE m1,t1,t2,t3,t4,t5,t6,t7;
--error ER_NO_SUCH_TABLE --error ER_NO_SUCH_TABLE
SELECT 1 FROM m1; # Should not hang! 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 --echo End of 5.1 tests
...@@ -7071,8 +7071,6 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name) ...@@ -7071,8 +7071,6 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name)
/* Perform closing actions and return error status. */ /* Perform closing actions and return error status. */
} }
DBUG_ASSERT(num_tables == 1);
Table_triggers_list *triggers= lst->table->triggers; Table_triggers_list *triggers= lst->table->triggers;
if (!triggers) if (!triggers)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment