Commit 32ae54bd authored by andrey@lmy004's avatar andrey@lmy004

fix for bug#16410 (Events: CREATE EVENT is legal in a CREATE TRIGGER statement)

WL#1034 (Internal CRON)
(post-post-review updates)
parent 3195aef7
...@@ -361,4 +361,8 @@ show processlist; ...@@ -361,4 +361,8 @@ show processlist;
Id User Host db Command Time State Info Id User Host db Command Time State Info
# root localhost events_test Query # NULL show processlist # root localhost events_test Query # NULL show processlist
drop event закачка21; drop event закачка21;
create table t_16 (s1 int);
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop table t_16;
drop database events_test; drop database events_test;
...@@ -323,6 +323,17 @@ select release_lock("test_lock2_1"); ...@@ -323,6 +323,17 @@ select release_lock("test_lock2_1");
show processlist; show processlist;
drop event закаÑка21; drop event закаÑка21;
####
# Bug #16410 Events: CREATE EVENT is legal in a CREATE TRIGGER statement
#
create table t_16 (s1 int);
--error 1422
create trigger t_16_bi before insert on t_16 for each row create event e_16 on schedule every 1 second do set @a=5;
drop table t_16;
#
# end of test case
####
##set global event_scheduler=1; ##set global event_scheduler=1;
##select get_lock("test_lock3", 20); ##select get_lock("test_lock3", 20);
##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20); ##create event закачка on schedule every 10 hour do select get_lock("test_lock3", 20);
......
...@@ -255,6 +255,9 @@ sp_get_flags_for_command(LEX *lex) ...@@ -255,6 +255,9 @@ sp_get_flags_for_command(LEX *lex)
case SQLCOM_ALTER_FUNCTION: case SQLCOM_ALTER_FUNCTION:
case SQLCOM_DROP_PROCEDURE: case SQLCOM_DROP_PROCEDURE:
case SQLCOM_DROP_FUNCTION: case SQLCOM_DROP_FUNCTION:
case SQLCOM_CREATE_EVENT:
case SQLCOM_ALTER_EVENT:
case SQLCOM_DROP_EVENT:
flags= sp_head::HAS_COMMIT_OR_ROLLBACK; flags= sp_head::HAS_COMMIT_OR_ROLLBACK;
break; break;
default: default:
......
...@@ -3773,6 +3773,12 @@ mysql_execute_command(THD *thd) ...@@ -3773,6 +3773,12 @@ mysql_execute_command(THD *thd)
is_schema_db(lex->et->dbname.str))) is_schema_db(lex->et->dbname.str)))
break; break;
if (end_active_trans(thd))
{
res= -1;
break;
}
switch (lex->sql_command) { switch (lex->sql_command) {
case SQLCOM_CREATE_EVENT: case SQLCOM_CREATE_EVENT:
res= evex_create_event(thd, lex->et, (uint) lex->create_info.options, res= evex_create_event(thd, lex->et, (uint) lex->create_info.options,
......
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