Commit 271d20ba authored by unknown's avatar unknown

A fix and test case for Bug#16164 "Easter egg":

SHOW AUTHORS caused 'Packets out of order' in stored functions:
add the corresponding SQLCOM to sp_get_flags_for_command so that
it'd return sp-related flags for it. 
Fix Bug#17403 "Events: packets out of order with show create event"
in the same chaneset.


mysql-test/r/events.result:
  Update the results (Bug#17403)
mysql-test/r/sp-error.result:
  Test results fixed (Bug#16164)
mysql-test/t/events.test:
  Add a test case for Bug#17403 "Events: packets out of order with
  show create event"
mysql-test/t/sp-error.test:
  Add a test case for Bug#16164 "Easter egg"
sql/sp_head.cc:
  Add SHOW AUTHORS to the list of commands that return a result
  set: such commands are not allowed in stored functions and
  triggers. Add SHOW CREATE EVENT for the same reason.
parent d38785aa
......@@ -465,4 +465,10 @@ select event_schema, event_name, definer, event_body from information_schema.eve
event_schema event_name definer event_body
events_test white_space root@localhost select 3
drop event white_space;
create event e1 on schedule every 1 year do set @a = 5;
create table t1 (s1 int);
create trigger t1_ai after insert on t1 for each row show create event e1;
ERROR 0A000: Not allowed to return a result set from a trigger
drop table t1;
drop event e1;
drop database events_test;
......@@ -1166,3 +1166,10 @@ drop procedure bug15091;
drop function if exists bug16896;
create aggregate function bug16896() returns int return 1;
ERROR 42000: AGGREGATE is not supported for stored functions
drop function if exists bug16164;
create function bug16164() returns int
begin
show authors;
return 42;
end|
ERROR 0A000: Not allowed to return a result set from a function
......@@ -427,6 +427,16 @@ drop event white_space;
# END: BUG #17453: Creating Event crash the server
#
#
# Bug#17403 "Events: packets out of order with show create event"
#
create event e1 on schedule every 1 year do set @a = 5;
create table t1 (s1 int);
--error ER_SP_NO_RETSET
create trigger t1_ai after insert on t1 for each row show create event e1;
drop table t1;
drop event e1;
##set global event_scheduler=1;
##select get_lock("test_lock3", 20);
##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
......
......@@ -1691,6 +1691,24 @@ drop function if exists bug16896;
--error ER_SP_NO_AGGREGATE
create aggregate function bug16896() returns int return 1;
#
# End of 5.0 tests
#
#
# Bug#16164 "Easter egg": check that SHOW AUTHORS is disabled in
# stored functions/triggers
#
--disable_warnings
drop function if exists bug16164;
--enable_warnings
delimiter |;
--error ER_SP_NO_RETSET
create function bug16164() returns int
begin
show authors;
return 42;
end|
#
# BUG#NNNN: New bug synopsis
......
......@@ -176,6 +176,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_CREATE_DB:
case SQLCOM_SHOW_CREATE_FUNC:
case SQLCOM_SHOW_CREATE_PROC:
case SQLCOM_SHOW_CREATE_EVENT:
case SQLCOM_SHOW_DATABASES:
case SQLCOM_SHOW_ERRORS:
case SQLCOM_SHOW_FIELDS:
......@@ -200,6 +201,7 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_SHOW_WARNS:
case SQLCOM_SHOW_PROC_CODE:
case SQLCOM_SHOW_FUNC_CODE:
case SQLCOM_SHOW_AUTHORS:
case SQLCOM_REPAIR:
case SQLCOM_BACKUP_TABLE:
case SQLCOM_RESTORE_TABLE:
......
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