Commit 5d16b95b authored by hhunger@hh-nb.hungers's avatar hhunger@hh-nb.hungers

Merge bk-internal:/home/bk/mysql-5.1-build

into  hh-nb.hungers:/work/trees/mysql-5.1-build-src-clean
parents 26008126 9ef8a849
......@@ -3019,3 +3019,4 @@ mysql-test/.DS_Store
.DS_Store
libmysqld/sql_profile.cc
mysql-test/suite/funcs_1.tar.zip
mysql-test/reg.log
......@@ -309,7 +309,7 @@ ERROR HY000: Unknown event 'intact_check'
DROP EVENT no_such_event;
ERROR HY000: Unknown event 'no_such_event'
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
ERROR HY000: Cannot load from mysql.event. The table is probably corrupted
ERROR HY000: Failed to store event name. Error code 2 from storage engine.
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
ERROR HY000: Unknown event 'intact_check_1'
ALTER EVENT intact_check_1 RENAME TO intact_check_2;
......@@ -425,321 +425,4 @@ CREATE TABLE mysql.event like event_like;
DROP TABLE event_like;
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
events_test e_26 set @a = 5 root@localhost 2017-01-01 00:00:00 DROP
drop event e_26;
create event e_26 on schedule at NULL disable do set @a = 5;
ERROR HY000: Incorrect AT value: 'NULL'
create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5;
ERROR HY000: Incorrect AT value: 'definitely not a datetime'
set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка;
set event_scheduler=off;
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
set global event_scheduler=3;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '3'
set global event_scheduler=disabled;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
"DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=off;
select definer, name, db from mysql.event;
definer name db
select get_lock("test_lock1", 20);
get_lock("test_lock1", 20)
1
create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
"Should return 1 row"
select definer, name, db from mysql.event;
definer name db
root@localhost закачка events_test
"Should be only 0 process"
select /*1*/ user, host, db, command, state, info
from information_schema.processlist
where (user='event_scheduler')
order by info;
user host db command state info
select release_lock("test_lock1");
release_lock("test_lock1")
1
drop event закачка;
"Should have 0 events"
select count(*) from mysql.event;
count(*)
0
"ENABLE the scheduler and get a lock"
set global event_scheduler=on;
select get_lock("test_lock2", 20);
get_lock("test_lock2", 20)
1
"Create an event which tries to acquire a mutex. The event locks on the mutex"
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
"Should have only 2 processes: the scheduler and the locked event"
select /*2*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info
event_scheduler localhost NULL Daemon Waiting for next activation NULL
root localhost events_test Connect User lock select get_lock("test_lock2", 20)
"Release the mutex, the event worker should finish."
select release_lock("test_lock2");
release_lock("test_lock2")
1
drop event закачка;
set global event_scheduler=1;
select get_lock("test_lock2_1", 20);
get_lock("test_lock2_1", 20)
1
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
"Should have only 2 processes: the scheduler and the locked event"
select /*3*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info
event_scheduler localhost NULL Daemon Waiting for next activation NULL
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
set global event_scheduler=off;
"Should have only our process now:"
select /*4*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
select release_lock("test_lock2_1");
release_lock("test_lock2_1")
1
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: Recursion of EVENT DDL statements is forbidden when body is present
drop table t_16;
create event white_space
on schedule every 10 hour
disable
do
select 1;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
events_test white_space root@localhost select 1
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
events_test white_space root@localhost select 2
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
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;
SHOW EVENTS FROM aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
SHOW EVENTS FROM ``;
ERROR 42000: Incorrect database name ''
SHOW EVENTS FROM `events\\test`;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
LOCK TABLES mode.
create table t1 (a int);
create event e1 on schedule every 10 hour do select 1;
lock table t1 read;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
alter event e2 disable;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
alter event e2 rename to e3;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
drop event e2;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
drop event e1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
unlock tables;
lock table t1 write;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
alter event e2 disable;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
alter event e2 rename to e3;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
drop event e2;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
drop event e1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
unlock tables;
lock table t1 read, mysql.event read;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
alter event e2 disable;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
alter event e2 rename to e3;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
drop event e2;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
drop event e1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
unlock tables;
lock table t1 write, mysql.event read;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
alter event e2 disable;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
alter event e2 rename to e3;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
drop event e2;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
drop event e1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
unlock tables;
lock table t1 read, mysql.event write;
ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
lock table t1 write, mysql.event write;
ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
lock table mysql.event write;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
alter event e2 disable;
alter event e2 rename to e3;
drop event e3;
drop event e1;
unlock tables;
Make sure we have left no events
select event_name from information_schema.events;
event_name
Events in sub-statements, events and prelocking
create event e1 on schedule every 10 hour do select 1;
create function f1() returns int
begin
show create event e1;
return 1;
end|
ERROR 0A000: Not allowed to return a result set from a function
create trigger trg before insert on t1 for each row
begin
show create event e1;
end|
ERROR 0A000: Not allowed to return a result set from a trigger
create function f1() returns int
begin
select event_name from information_schema.events;
return 1;
end|
ERROR 0A000: Not allowed to return a result set from a function
create trigger trg before insert on t1 for each row
begin
select event_name from information_schema.events;
end|
ERROR 0A000: Not allowed to return a result set from a trigger
create function f1() returns int
begin
create event e2 on schedule every 10 hour do select 1;
return 1;
end|
ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
create function f1() returns int
begin
alter event e1 rename to e2;
return 1;
end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
create function f1() returns int
begin
drop event e2;
return 1;
end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
----------------------------------------------------------------------
create trigger trg before insert on t1 for each row
begin
set new.a= f1();
end|
create function f1() returns int
begin
call p1();
return 0;
end|
create procedure p1()
begin
select event_name from information_schema.events;
end|
insert into t1 (a) values (1)|
ERROR 0A000: Not allowed to return a result set from a trigger
drop procedure p1|
create procedure p1()
begin
show create event e1;
end|
insert into t1 (a) values (1)|
ERROR 0A000: Not allowed to return a result set from a trigger
drop procedure p1|
create procedure p1()
begin
create temporary table tmp select event_name from information_schema.events;
end|
expected to work, since we redirect the output into a tmp table
insert into t1 (a) values (1)|
select * from tmp|
event_name
e1
drop temporary table tmp|
drop procedure p1|
create procedure p1()
begin
alter event e1 rename to e2;
end|
insert into t1 (a) values (1)|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop procedure p1|
create procedure p1()
begin
drop event e1;
end|
insert into t1 (a) values (1)|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop table t1|
drop event e1|
drop database events_test;
drop database if exists events_test;
create database events_test;
use events_test;
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
db name body definer convert_tz(execute_at, 'UTC', 'SYSTEM') on_completion
events_test e_26 set @a = 5 root@localhost 2017-01-01 00:00:00 DROP
drop event e_26;
create event e_26 on schedule at NULL disable do set @a = 5;
ERROR HY000: Incorrect AT value: 'NULL'
create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5;
ERROR HY000: Incorrect AT value: 'definitely not a datetime'
set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка;
set event_scheduler=off;
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
set global event_scheduler=3;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '3'
set global event_scheduler=disabled;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
"DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=off;
select definer, name, db from mysql.event;
definer name db
select get_lock("test_lock1", 20);
get_lock("test_lock1", 20)
1
create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
"Should return 1 row"
select definer, name, db from mysql.event;
definer name db
root@localhost закачка events_test
"Should be only 0 process"
select /*1*/ user, host, db, command, state, info
from information_schema.processlist
where (user='event_scheduler')
order by info;
user host db command state info
select release_lock("test_lock1");
release_lock("test_lock1")
1
drop event закачка;
"Should have 0 events"
select count(*) from mysql.event;
count(*)
0
"ENABLE the scheduler and get a lock"
set global event_scheduler=on;
select get_lock("test_lock2", 20);
get_lock("test_lock2", 20)
1
"Create an event which tries to acquire a mutex. The event locks on the mutex"
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
"Should have only 2 processes: the scheduler and the locked event"
select /*2*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info
event_scheduler localhost NULL Daemon Waiting for next activation NULL
root localhost events_test Connect User lock select get_lock("test_lock2", 20)
"Release the mutex, the event worker should finish."
select release_lock("test_lock2");
release_lock("test_lock2")
1
drop event закачка;
set global event_scheduler=1;
select get_lock("test_lock2_1", 20);
get_lock("test_lock2_1", 20)
1
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
"Should have only 2 processes: the scheduler and the locked event"
select /*3*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info
event_scheduler localhost NULL Daemon Waiting for next activation NULL
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
set global event_scheduler=off;
"Should have only our process now:"
select /*4*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
user host db command state info
root localhost events_test Connect User lock select get_lock("test_lock2_1", 20)
select release_lock("test_lock2_1");
release_lock("test_lock2_1")
1
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: Recursion of EVENT DDL statements is forbidden when body is present
drop table t_16;
create event white_space
on schedule every 10 hour
disable
do
select 1;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
events_test white_space root@localhost select 1
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
events_test white_space root@localhost select 2
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
event_schema event_name definer event_definition
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;
SHOW EVENTS FROM aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'
SHOW EVENTS FROM ``;
ERROR 42000: Incorrect database name ''
SHOW EVENTS FROM `events\\test`;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
LOCK TABLES mode.
create table t1 (a int);
create event e1 on schedule every 10 hour do select 1;
lock table t1 read;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
alter event e2 disable;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
alter event e2 rename to e3;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
drop event e2;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
drop event e1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
unlock tables;
lock table t1 write;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
alter event e2 disable;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
alter event e2 rename to e3;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
drop event e2;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
drop event e1;
ERROR HY000: Table 'event' was not locked with LOCK TABLES
unlock tables;
lock table t1 read, mysql.event read;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
alter event e2 disable;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
alter event e2 rename to e3;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
drop event e2;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
drop event e1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
unlock tables;
lock table t1 write, mysql.event read;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
alter event e2 disable;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
alter event e2 rename to e3;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
drop event e2;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
drop event e1;
ERROR HY000: Table 'event' was locked with a READ lock and can't be updated
unlock tables;
lock table t1 read, mysql.event write;
ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
lock table t1 write, mysql.event write;
ERROR HY000: You can't combine write-locking of system tables with other tables or lock types
lock table mysql.event write;
show create event e1;
Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation
e1 SYSTEM CREATE EVENT `e1` ON SCHEDULE EVERY 10 HOUR STARTS '#' ON COMPLETION NOT PRESERVE ENABLE DO select 1 utf8 utf8_general_ci latin1_swedish_ci
select event_name from information_schema.events;
event_name
e1
create event e2 on schedule every 10 hour do select 1;
alter event e2 disable;
alter event e2 rename to e3;
drop event e3;
drop event e1;
unlock tables;
Make sure we have left no events
select event_name from information_schema.events;
event_name
Events in sub-statements, events and prelocking
create event e1 on schedule every 10 hour do select 1;
create function f1() returns int
begin
show create event e1;
return 1;
end|
ERROR 0A000: Not allowed to return a result set from a function
create trigger trg before insert on t1 for each row
begin
show create event e1;
end|
ERROR 0A000: Not allowed to return a result set from a trigger
create function f1() returns int
begin
select event_name from information_schema.events;
return 1;
end|
ERROR 0A000: Not allowed to return a result set from a function
create trigger trg before insert on t1 for each row
begin
select event_name from information_schema.events;
end|
ERROR 0A000: Not allowed to return a result set from a trigger
create function f1() returns int
begin
create event e2 on schedule every 10 hour do select 1;
return 1;
end|
ERROR HY000: Recursion of EVENT DDL statements is forbidden when body is present
create function f1() returns int
begin
alter event e1 rename to e2;
return 1;
end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
create function f1() returns int
begin
drop event e2;
return 1;
end|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
----------------------------------------------------------------------
create trigger trg before insert on t1 for each row
begin
set new.a= f1();
end|
create function f1() returns int
begin
call p1();
return 0;
end|
create procedure p1()
begin
select event_name from information_schema.events;
end|
insert into t1 (a) values (1)|
ERROR 0A000: Not allowed to return a result set from a trigger
drop procedure p1|
create procedure p1()
begin
show create event e1;
end|
insert into t1 (a) values (1)|
ERROR 0A000: Not allowed to return a result set from a trigger
drop procedure p1|
create procedure p1()
begin
create temporary table tmp select event_name from information_schema.events;
end|
expected to work, since we redirect the output into a tmp table
insert into t1 (a) values (1)|
select * from tmp|
event_name
e1
drop temporary table tmp|
drop procedure p1|
create procedure p1()
begin
alter event e1 rename to e2;
end|
insert into t1 (a) values (1)|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop procedure p1|
create procedure p1()
begin
drop event e1;
end|
insert into t1 (a) values (1)|
ERROR HY000: Explicit or implicit commit is not allowed in stored function or trigger.
drop table t1|
drop event e1|
drop database events_test;
......@@ -15,7 +15,6 @@ concurrent_innodb : BUG#21579 2006-08-11 mleich innodb_concurrent random
ctype_big5 : BUG#26711 2007-06-21 Lars Test has never worked on Double Whopper
federated_transactions : Bug#29523 Transactions do not work
events : Bug#32664 events.test fails randomly
lowercase_table3 : Bug#32667 lowercase_table3.test reports to error log
kill : Bug#29149: Test "kill" fails on Windows
innodb_mysql : Bug#32724: innodb_mysql.test fails randomly
......
# changes 2008-02-20 hhunger splitted events.test into events_1 and events_2
# changes 2008-02-22 hhunger replaced all sleep by wait_condition
#
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
......@@ -24,7 +27,8 @@ CREATE EVENT e_x2 ON SCHEDULE EVERY 1 SECOND DO DROP TABLE x_table;
connection default;
SHOW DATABASES LIKE 'db_x';
SET GLOBAL event_scheduler=1;
--sleep 1.2
let $wait_condition= SELECT count(*)= 1 FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME LIKE 'db_x';
--source include/wait_condition.inc
SHOW DATABASES LIKE 'db_x';
SHOW TABLES FROM db_x;
SET GLOBAL event_scheduler=off;
......@@ -90,7 +94,8 @@ begin
end|
delimiter ;|
set global event_scheduler = on;
--sleep 3
let $wait_condition= SELECT count(*)>0 from mysql.event where name='e_43' and interval_value= 5;
--source include/wait_condition.inc
select db, name, body, status, interval_field, interval_value from mysql.event;
drop event e_43;
drop table test_nested;
......@@ -98,7 +103,8 @@ drop table test_nested;
--echo "Let's check whether we can use non-qualified names"
create table non_qualif(a int);
create event non_qualif_ev on schedule every 10 minute do insert into non_qualif values (800219);
--sleep 1.1
let $wait_condition=SELECT count(*)= 1 from non_qualif where a=800219;
--source include/wait_condition.inc
select * from non_qualif;
drop event non_qualif_ev;
drop table non_qualif;
......@@ -118,6 +124,8 @@ drop event existant;
create table t_event3 (a int, b float);
drop event if exists event3;
create event event3 on schedule every 50 + 10 minute starts date_add("20100101", interval 5 minute) ends date_add("20151010", interval 5 day) comment "portokala_comment" DO insert into t_event3 values (unix_timestamp(), rand());
let $wait_condition=SELECT count(*)=0 from t_event3;
--source include/wait_condition.inc
select count(*) from t_event3;
drop event event3;
drop table t_event3;
......@@ -302,7 +310,7 @@ SELECT event_name FROM INFORMATION_SCHEMA.events;
SHOW CREATE EVENT intact_check;
--error ER_EVENT_DOES_NOT_EXIST
DROP EVENT no_such_event;
--error ER_CANNOT_LOAD_FROM_TABLE
--error ER_EVENT_STORE_FAILED
CREATE EVENT intact_check_1 ON SCHEDULE EVERY 5 HOUR DO SELECT 5;
--error ER_EVENT_DOES_NOT_EXIST
ALTER EVENT intact_check_1 ON SCHEDULE EVERY 8 HOUR DO SELECT 8;
......@@ -399,396 +407,6 @@ CREATE TABLE mysql.event like event_like;
DROP TABLE event_like;
--replace_column 8 # 9 #
SHOW EVENTS;
#
# mysql.event intact checking end
#
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
drop event e_26;
--error ER_WRONG_VALUE
create event e_26 on schedule at NULL disable do set @a = 5;
--error ER_WRONG_VALUE
create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5;
set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка;
# event_scheduler is a global var
--error ER_GLOBAL_VARIABLE
set event_scheduler=off;
# event_scheduler could be only either 1 or 2
--error ER_WRONG_VALUE_FOR_VAR
set global event_scheduler=3;
--error ER_WRONG_VALUE_FOR_VAR
set global event_scheduler=disabled;
--echo "DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=off;
select definer, name, db from mysql.event;
select get_lock("test_lock1", 20);
create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
--echo "Should return 1 row"
select definer, name, db from mysql.event;
--echo "Should be only 0 process"
select /*1*/ user, host, db, command, state, info
from information_schema.processlist
where (user='event_scheduler')
order by info;
select release_lock("test_lock1");
drop event закачка;
--echo "Should have 0 events"
select count(*) from mysql.event;
#
#
#
--echo "ENABLE the scheduler and get a lock"
set global event_scheduler=on;
select get_lock("test_lock2", 20);
--echo "Create an event which tries to acquire a mutex. The event locks on the mutex"
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
--echo "Should have only 2 processes: the scheduler and the locked event"
let $wait_condition= select count(*) = 2 from information_schema.processlist
where ( (state like 'User lock%' AND info like 'select get_lock%')
OR (command='Daemon' AND user='event_scheduler' AND
state = 'Waiting for next activation'));
--source include/wait_condition.inc
select /*2*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
--echo "Release the mutex, the event worker should finish."
select release_lock("test_lock2");
drop event закачка;
# Wait for release_lock("test_lock2") to complete,
# to avoid polluting the next test information_schema.processlist
let $wait_condition= select count(*) = 0 from information_schema.processlist
where (state like 'User lock%' AND info like 'select get_lock%');
--source include/wait_condition.inc
##
## 1. get a lock
## 2. create an event
## 3. sleep so it has time to start
## 4. should appear in processlist
## 5. kill the scheduler, it will wait for the child to stop
## 6. both processes should be there on show processlist
## 7. release the lock and sleep, both scheduler and child should end
set global event_scheduler=1;
select get_lock("test_lock2_1", 20);
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
--echo "Should have only 2 processes: the scheduler and the locked event"
let $wait_condition= select count(*) = 2 from information_schema.processlist
where ( (state like 'User lock%' AND info like 'select get_lock%')
OR (command='Daemon' AND user='event_scheduler' AND
state = 'Waiting for next activation'));
--source include/wait_condition.inc
select /*3*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
set global event_scheduler=off;
let $wait_condition= select count(*) =1 from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler');
--source include/wait_condition.inc
--echo "Should have only our process now:"
select /*4*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
select release_lock("test_lock2_1");
drop event закачка21;
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where db='events_test' and command = 'Connect' and user=current_user();
--source include/wait_condition.inc
####
# Bug #16410 Events: CREATE EVENT is legal in a CREATE TRIGGER statement
#
create table t_16 (s1 int);
--error ER_EVENT_RECURSION_FORBIDDEN
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
####
#
# START: BUG #17453: Creating Event crash the server
#
create event white_space
on schedule every 10 hour
disable
do
select 1;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
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);
##select sleep(2);
##select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка;
##select release_lock("test_lock3");
#
# test with very often occuring event
# (disabled for now, locks)
##select get_lock("test_lock4", 20);
##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20);
##select sleep(3);
##select /*6*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка4;
##select release_lock("test_lock4");
##set global event_scheduler=off;
##select sleep(2);
##--replace_column 1 # 6 #
##show processlist;
##select count(*) from mysql.event;
#
# Test wrong syntax
#
--error 1102
SHOW EVENTS FROM aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
--error 1102
SHOW EVENTS FROM ``;
SHOW EVENTS FROM `events\\test`;
#
# A check for events SQL under LOCK TABLES and in pre-locked mode.
#
--echo
--echo LOCK TABLES mode.
--echo
#
# SHOW CREATE EVENT and INFORMATION_SCHEMA.events are available and
# cause an implicit lock/unlock of mysql.event table, regardless of the
# currently locked tables.
#
create table t1 (a int);
create event e1 on schedule every 10 hour do select 1;
#
lock table t1 read;
#
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
--error ER_TABLE_NOT_LOCKED
create event e2 on schedule every 10 hour do select 1;
--error ER_TABLE_NOT_LOCKED
alter event e2 disable;
--error ER_TABLE_NOT_LOCKED
alter event e2 rename to e3;
--error ER_TABLE_NOT_LOCKED
drop event e2;
--error ER_TABLE_NOT_LOCKED
drop event e1;
unlock tables;
#
lock table t1 write;
#
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
--error ER_TABLE_NOT_LOCKED
create event e2 on schedule every 10 hour do select 1;
--error ER_TABLE_NOT_LOCKED
alter event e2 disable;
--error ER_TABLE_NOT_LOCKED
alter event e2 rename to e3;
--error ER_TABLE_NOT_LOCKED
drop event e2;
--error ER_TABLE_NOT_LOCKED
drop event e1;
unlock tables;
#
lock table t1 read, mysql.event read;
#
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
create event e2 on schedule every 10 hour do select 1;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
alter event e2 disable;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
alter event e2 rename to e3;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop event e2;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop event e1;
unlock tables;
#
lock table t1 write, mysql.event read;
#
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
create event e2 on schedule every 10 hour do select 1;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
alter event e2 disable;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
alter event e2 rename to e3;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop event e2;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop event e1;
unlock tables;
#
--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
lock table t1 read, mysql.event write;
#
--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
lock table t1 write, mysql.event write;
#
lock table mysql.event write;
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
create event e2 on schedule every 10 hour do select 1;
alter event e2 disable;
alter event e2 rename to e3;
drop event e3;
drop event e1;
unlock tables;
--echo Make sure we have left no events
select event_name from information_schema.events;
--echo
--echo Events in sub-statements, events and prelocking
--echo
--echo
create event e1 on schedule every 10 hour do select 1;
delimiter |;
--error ER_SP_NO_RETSET
create function f1() returns int
begin
show create event e1;
return 1;
end|
--error ER_SP_NO_RETSET
create trigger trg before insert on t1 for each row
begin
show create event e1;
end|
--error ER_SP_NO_RETSET
create function f1() returns int
begin
select event_name from information_schema.events;
return 1;
end|
--error ER_SP_NO_RETSET
create trigger trg before insert on t1 for each row
begin
select event_name from information_schema.events;
end|
--error ER_EVENT_RECURSION_FORBIDDEN
create function f1() returns int
begin
create event e2 on schedule every 10 hour do select 1;
return 1;
end|
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function f1() returns int
begin
alter event e1 rename to e2;
return 1;
end|
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function f1() returns int
begin
drop event e2;
return 1;
end|
--echo ----------------------------------------------------------------------
create trigger trg before insert on t1 for each row
begin
set new.a= f1();
end|
create function f1() returns int
begin
call p1();
return 0;
end|
create procedure p1()
begin
select event_name from information_schema.events;
end|
--error ER_SP_NO_RETSET
insert into t1 (a) values (1)|
drop procedure p1|
create procedure p1()
begin
show create event e1;
end|
--error ER_SP_NO_RETSET
insert into t1 (a) values (1)|
drop procedure p1|
create procedure p1()
begin
create temporary table tmp select event_name from information_schema.events;
end|
--echo expected to work, since we redirect the output into a tmp table
insert into t1 (a) values (1)|
select * from tmp|
drop temporary table tmp|
drop procedure p1|
create procedure p1()
begin
alter event e1 rename to e2;
end|
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
insert into t1 (a) values (1)|
drop procedure p1|
create procedure p1()
begin
drop event e1;
end|
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
insert into t1 (a) values (1)|
drop table t1|
drop event e1|
delimiter ;|
#
# End of tests
#
......
# changes 2008-02-20 hhunger splitted events.test into events_1 and events_2
#
# Can't test with embedded server that doesn't support grants
-- source include/not_embedded.inc
--disable_warnings
drop database if exists events_test;
--enable_warnings
create database events_test;
use events_test;
#
# mysql.event intact checking end
#
create event e_26 on schedule at '2017-01-01 00:00:00' disable do set @a = 5;
select db, name, body, definer, convert_tz(execute_at, 'UTC', 'SYSTEM'), on_completion from mysql.event;
drop event e_26;
--error ER_WRONG_VALUE
create event e_26 on schedule at NULL disable do set @a = 5;
--error ER_WRONG_VALUE
create event e_26 on schedule at 'definitely not a datetime' disable do set @a = 5;
set names utf8;
create event задачка on schedule every 123 minute starts now() ends now() + interval 1 month do select 1;
drop event задачка;
# event_scheduler is a global var
--error ER_GLOBAL_VARIABLE
set event_scheduler=off;
# event_scheduler could be only either 1 or 2
--error ER_WRONG_VALUE_FOR_VAR
set global event_scheduler=3;
--error ER_WRONG_VALUE_FOR_VAR
set global event_scheduler=disabled;
--echo "DISABLE the scheduler. Testing that it does not work when the variable is 0"
set global event_scheduler=off;
select definer, name, db from mysql.event;
select get_lock("test_lock1", 20);
create event закачка on schedule every 10 hour do select get_lock("test_lock1", 20);
--echo "Should return 1 row"
select definer, name, db from mysql.event;
--echo "Should be only 0 process"
select /*1*/ user, host, db, command, state, info
from information_schema.processlist
where (user='event_scheduler')
order by info;
select release_lock("test_lock1");
drop event закачка;
--echo "Should have 0 events"
select count(*) from mysql.event;
#
#
#
--echo "ENABLE the scheduler and get a lock"
set global event_scheduler=on;
select get_lock("test_lock2", 20);
--echo "Create an event which tries to acquire a mutex. The event locks on the mutex"
create event закачка on schedule every 10 hour do select get_lock("test_lock2", 20);
--echo "Should have only 2 processes: the scheduler and the locked event"
let $wait_condition= select count(*) = 2 from information_schema.processlist
where ( (state like 'User lock%' AND info like 'select get_lock%')
OR (command='Daemon' AND user='event_scheduler' AND
state = 'Waiting for next activation'));
--source include/wait_condition.inc
select /*2*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
--echo "Release the mutex, the event worker should finish."
select release_lock("test_lock2");
drop event закачка;
# Wait for release_lock("test_lock2") to complete,
# to avoid polluting the next test information_schema.processlist
let $wait_condition= select count(*) = 0 from information_schema.processlist
where (state like 'User lock%' AND info like 'select get_lock%');
--source include/wait_condition.inc
##
## 1. get a lock
## 2. create an event
## 3. sleep so it has time to start
## 4. should appear in processlist
## 5. kill the scheduler, it will wait for the child to stop
## 6. both processes should be there on show processlist
## 7. release the lock and sleep, both scheduler and child should end
set global event_scheduler=1;
select get_lock("test_lock2_1", 20);
create event закачка21 on schedule every 10 hour do select get_lock("test_lock2_1", 20);
--echo "Should have only 2 processes: the scheduler and the locked event"
let $wait_condition= select count(*) = 2 from information_schema.processlist
where ( (state like 'User lock%' AND info like 'select get_lock%')
OR (command='Daemon' AND user='event_scheduler' AND
state = 'Waiting for next activation'));
--source include/wait_condition.inc
select /*3*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
set global event_scheduler=off;
let $wait_condition= select count(*) =1 from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler');
--source include/wait_condition.inc
--echo "Should have only our process now:"
select /*4*/ user, host, db, command, state, info
from information_schema.processlist
where (info like "select get_lock%" OR user='event_scheduler')
order by info;
select release_lock("test_lock2_1");
drop event закачка21;
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where db='events_test' and command = 'Connect' and user=current_user();
--source include/wait_condition.inc
####
# Bug #16410 Events: CREATE EVENT is legal in a CREATE TRIGGER statement
#
create table t_16 (s1 int);
--error ER_EVENT_RECURSION_FORBIDDEN
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
####
#
# START: BUG #17453: Creating Event crash the server
#
create event white_space
on schedule every 10 hour
disable
do
select 1;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
drop event white_space;
create event white_space on schedule every 10 hour disable do
select 2;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
drop event white_space;
create event white_space on schedule every 10 hour disable do select 3;
select event_schema, event_name, definer, event_definition from information_schema.events where event_name='white_space';
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);
##select sleep(2);
##select /*5*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка;
##select release_lock("test_lock3");
#
# test with very often occuring event
# (disabled for now, locks)
##select get_lock("test_lock4", 20);
##create event закачка4 on schedule every 1 second do select get_lock("test_lock4", 20);
##select sleep(3);
##select /*6*/ user, host, db, command, state, info from information_schema.processlist where info is null or info not like '%processlist%' order by info;
##drop event закачка4;
##select release_lock("test_lock4");
##set global event_scheduler=off;
##select sleep(2);
##--replace_column 1 # 6 #
##show processlist;
##select count(*) from mysql.event;
#
# Test wrong syntax
#
--error ER_WRONG_DB_NAME
SHOW EVENTS FROM aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa;
--error ER_WRONG_DB_NAME
SHOW EVENTS FROM ``;
SHOW EVENTS FROM `events\\test`;
#
# A check for events SQL under LOCK TABLES and in pre-locked mode.
#
--echo
--echo LOCK TABLES mode.
--echo
#
# SHOW CREATE EVENT and INFORMATION_SCHEMA.events are available and
# cause an implicit lock/unlock of mysql.event table, regardless of the
# currently locked tables.
#
create table t1 (a int);
create event e1 on schedule every 10 hour do select 1;
#
lock table t1 read;
#
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
--error ER_TABLE_NOT_LOCKED
create event e2 on schedule every 10 hour do select 1;
--error ER_TABLE_NOT_LOCKED
alter event e2 disable;
--error ER_TABLE_NOT_LOCKED
alter event e2 rename to e3;
--error ER_TABLE_NOT_LOCKED
drop event e2;
--error ER_TABLE_NOT_LOCKED
drop event e1;
unlock tables;
#
lock table t1 write;
#
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
--error ER_TABLE_NOT_LOCKED
create event e2 on schedule every 10 hour do select 1;
--error ER_TABLE_NOT_LOCKED
alter event e2 disable;
--error ER_TABLE_NOT_LOCKED
alter event e2 rename to e3;
--error ER_TABLE_NOT_LOCKED
drop event e2;
--error ER_TABLE_NOT_LOCKED
drop event e1;
unlock tables;
#
lock table t1 read, mysql.event read;
#
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
create event e2 on schedule every 10 hour do select 1;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
alter event e2 disable;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
alter event e2 rename to e3;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop event e2;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop event e1;
unlock tables;
#
lock table t1 write, mysql.event read;
#
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
create event e2 on schedule every 10 hour do select 1;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
alter event e2 disable;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
alter event e2 rename to e3;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop event e2;
--error ER_TABLE_NOT_LOCKED_FOR_WRITE
drop event e1;
unlock tables;
#
--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
lock table t1 read, mysql.event write;
#
--error ER_WRONG_LOCK_OF_SYSTEM_TABLE
lock table t1 write, mysql.event write;
#
lock table mysql.event write;
--replace_regex /STARTS '[^']+'/STARTS '#'/
show create event e1;
select event_name from information_schema.events;
create event e2 on schedule every 10 hour do select 1;
alter event e2 disable;
alter event e2 rename to e3;
drop event e3;
drop event e1;
unlock tables;
--echo Make sure we have left no events
select event_name from information_schema.events;
--echo
--echo Events in sub-statements, events and prelocking
--echo
--echo
create event e1 on schedule every 10 hour do select 1;
delimiter |;
--error ER_SP_NO_RETSET
create function f1() returns int
begin
show create event e1;
return 1;
end|
--error ER_SP_NO_RETSET
create trigger trg before insert on t1 for each row
begin
show create event e1;
end|
--error ER_SP_NO_RETSET
create function f1() returns int
begin
select event_name from information_schema.events;
return 1;
end|
--error ER_SP_NO_RETSET
create trigger trg before insert on t1 for each row
begin
select event_name from information_schema.events;
end|
--error ER_EVENT_RECURSION_FORBIDDEN
create function f1() returns int
begin
create event e2 on schedule every 10 hour do select 1;
return 1;
end|
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function f1() returns int
begin
alter event e1 rename to e2;
return 1;
end|
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
create function f1() returns int
begin
drop event e2;
return 1;
end|
--echo ----------------------------------------------------------------------
create trigger trg before insert on t1 for each row
begin
set new.a= f1();
end|
create function f1() returns int
begin
call p1();
return 0;
end|
create procedure p1()
begin
select event_name from information_schema.events;
end|
--error ER_SP_NO_RETSET
insert into t1 (a) values (1)|
drop procedure p1|
create procedure p1()
begin
show create event e1;
end|
--error ER_SP_NO_RETSET
insert into t1 (a) values (1)|
drop procedure p1|
create procedure p1()
begin
create temporary table tmp select event_name from information_schema.events;
end|
--echo expected to work, since we redirect the output into a tmp table
insert into t1 (a) values (1)|
select * from tmp|
drop temporary table tmp|
drop procedure p1|
create procedure p1()
begin
alter event e1 rename to e2;
end|
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
insert into t1 (a) values (1)|
drop procedure p1|
create procedure p1()
begin
drop event e1;
end|
--error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
insert into t1 (a) values (1)|
drop table t1|
drop event e1|
delimiter ;|
#
# End of tests
#
let $wait_condition=
select count(*) = 0 from information_schema.processlist
where db='events_test' and command = 'Connect' and user=current_user();
--source include/wait_condition.inc
drop database events_test;
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