Bug #31866: MySQL Server crashes on SHOW CREATE TRIGGER statement

SHOW CREATE TRIGGER was not checking for detected errors 
opening/reading the trigger file. 
Fixed to return the already generated error.
parent 69ed192e
...@@ -1978,3 +1978,9 @@ a ...@@ -1978,3 +1978,9 @@ a
1 1
drop table table_25411_a; drop table table_25411_a;
drop table table_25411_b; drop table table_25411_b;
DROP TRIGGER IF EXISTS trg;
Warnings:
Note 1360 Trigger does not exist
SHOW CREATE TRIGGER trg;
ERROR HY000: Trigger does not exist
End of 5.1 tests.
...@@ -2246,3 +2246,15 @@ select * from table_25411_a; ...@@ -2246,3 +2246,15 @@ select * from table_25411_a;
drop table table_25411_a; drop table table_25411_a;
drop table table_25411_b; drop table table_25411_b;
#
# Bug #31866: MySQL Server crashes on SHOW CREATE TRIGGER statement
#
--disable-warnings
DROP TRIGGER IF EXISTS trg;
--enable-warnings
--error ER_TRG_DOES_NOT_EXIST
SHOW CREATE TRIGGER trg;
--echo End of 5.1 tests.
...@@ -6862,6 +6862,9 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name) ...@@ -6862,6 +6862,9 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name)
{ {
TABLE_LIST *lst= get_trigger_table(thd, trg_name); TABLE_LIST *lst= get_trigger_table(thd, trg_name);
if (!lst)
return TRUE;
/* /*
Open the table by name in order to load Table_triggers_list object. Open the table by name in order to load Table_triggers_list object.
......
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