summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRamil Kalimullin <ramil@mysql.com>2009-08-14 00:49:28 +0500
committerRamil Kalimullin <ramil@mysql.com>2009-08-14 00:49:28 +0500
commit3b1280fa7eb411fdeaf60cbf023ff2580caecce7 (patch)
treedbcd2c58adcc0e19afc8c2b044950d3b8fac0e39
parentfce4fa362c5234f1e85212060f61b842844192b7 (diff)
downloadmariadb-git-3b1280fa7eb411fdeaf60cbf023ff2580caecce7.tar.gz
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.
-rw-r--r--mysql-test/r/merge.result12
-rw-r--r--mysql-test/t/merge.test11
-rw-r--r--sql/sql_show.cc2
3 files changed, 23 insertions, 2 deletions
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)