Below is the list of changes that have just been committed into a local
5.1 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2007-10-30 17:36:09+02:00, gkodinov@stripped +3 -0
Bug #31866: MySQL Server crashes on SHOW CREATE TRIGGER statement
SHOW CREATE TRIGGER was not checking for detected errors
opening/reading the trigger filer.
Fixed to return the already generated error.
mysql-test/r/trigger.result@stripped, 2007-10-30 17:36:08+02:00, gkodinov@stripped +3 -0
Bug #31866: test case
mysql-test/t/trigger.test@stripped, 2007-10-30 17:36:08+02:00, gkodinov@stripped +8 -0
Bug #31866: test case
sql/sql_show.cc@stripped, 2007-10-30 17:36:08+02:00, gkodinov@stripped +4 -1
Bug #31866: test for error and return it.
diff -Nrup a/mysql-test/r/trigger.result b/mysql-test/r/trigger.result
--- a/mysql-test/r/trigger.result 2007-07-19 18:40:42 +03:00
+++ b/mysql-test/r/trigger.result 2007-10-30 17:36:08 +02:00
@@ -1978,3 +1978,6 @@ a
1
drop table table_25411_a;
drop table table_25411_b;
+SHOW CREATE TRIGGER a;
+ERROR HY000: Trigger does not exist
+End of 5.1 tests.
diff -Nrup a/mysql-test/t/trigger.test b/mysql-test/t/trigger.test
--- a/mysql-test/t/trigger.test 2007-08-15 11:18:40 +03:00
+++ b/mysql-test/t/trigger.test 2007-10-30 17:36:08 +02:00
@@ -2246,3 +2246,11 @@ select * from table_25411_a;
drop table table_25411_a;
drop table table_25411_b;
+#
+# Bug #31866: MySQL Server crashes on SHOW CREATE TRIGGER statement
+#
+
+--error ER_TRG_DOES_NOT_EXIST
+SHOW CREATE TRIGGER a;
+
+--echo End of 5.1 tests.
diff -Nrup a/sql/sql_show.cc b/sql/sql_show.cc
--- a/sql/sql_show.cc 2007-10-23 11:20:49 +03:00
+++ b/sql/sql_show.cc 2007-10-30 17:36:08 +02:00
@@ -6860,7 +6860,10 @@ static TABLE_LIST *get_trigger_table(THD
bool show_create_trigger(THD *thd, const sp_name *trg_name)
{
- TABLE_LIST *lst= get_trigger_table(thd, trg_name);
+ TABLE_LIST *lst;
+
+ if (!(lst= get_trigger_table(thd, trg_name)))
+ return TRUE;
/*
Open the table by name in order to load Table_triggers_list object.