Commit a09487b8 authored by msvensson@neptunus.(none)'s avatar msvensson@neptunus.(none)

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

into  neptunus.(none):/home/msvensson/mysql/mysql-5.1-runtime
parents 18f04d48 f7a779ac
......@@ -38,52 +38,37 @@ drop event event2;
create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
drop event event2;
CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1;
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test event_starts_test root@localhost RECURRING NULL 10 SECOND # # ENABLED
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
starts IS NULL ends IS NULL comment
0 1
SELECT interval_field, interval_value, body FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
interval_field interval_value body
SECOND 10 SELECT 1
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
execute_at IS NULL starts IS NULL ends IS NULL comment
1 0 1
ALTER EVENT event_starts_test ON SCHEDULE AT '2020-02-02 20:00:02';
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test event_starts_test root@localhost ONE TIME 2020-02-02 17:00:02 NULL NULL # # ENABLED
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
starts IS NULL ends IS NULL comment
1 1
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
execute_at IS NULL starts IS NULL ends IS NULL comment
0 1 1
ALTER EVENT event_starts_test COMMENT "non-empty comment";
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test event_starts_test root@localhost ONE TIME 2020-02-02 17:00:02 NULL NULL # # ENABLED
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
starts IS NULL ends IS NULL comment
1 1 non-empty comment
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
execute_at IS NULL starts IS NULL ends IS NULL comment
0 1 1 non-empty comment
ALTER EVENT event_starts_test COMMENT "";
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test event_starts_test root@localhost ONE TIME 2020-02-02 17:00:02 NULL NULL # # ENABLED
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
starts IS NULL ends IS NULL comment
1 1
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
execute_at IS NULL starts IS NULL ends IS NULL comment
0 1 1
DROP EVENT event_starts_test;
CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '2020-02-02 20:00:02' ENDS '2022-02-02 20:00:02' DO SELECT 2;
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test event_starts_test root@localhost RECURRING NULL 20 SECOND # # ENABLED
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
starts IS NULL ends IS NULL comment
0 0
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
execute_at IS NULL starts IS NULL ends IS NULL comment
1 0 0
ALTER EVENT event_starts_test COMMENT "non-empty comment";
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test event_starts_test root@localhost RECURRING NULL 20 SECOND # # ENABLED
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
starts IS NULL ends IS NULL comment
0 0 non-empty comment
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
execute_at IS NULL starts IS NULL ends IS NULL comment
1 0 0 non-empty comment
ALTER EVENT event_starts_test COMMENT "";
SHOW EVENTS;
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
events_test event_starts_test root@localhost RECURRING NULL 20 SECOND # # ENABLED
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
execute_at IS NULL starts IS NULL ends IS NULL comment
1 0 0
DROP EVENT event_starts_test;
create table test_nested(a int);
create event e_43 on schedule every 1 second do set @a = 5;
......
......@@ -213,4 +213,17 @@ create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select s1 from ttx) do drop table t' at line 1
create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t;
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'select s1 from ttx) do drop table t' at line 1
drop event if exists e_16;
drop procedure if exists p_16;
create event e_16 on schedule every 1 second do set @a=5;
create procedure p_16 () alter event e_16 on schedule every @a second;
set @a = null;
call p_16();
ERROR HY000: Incorrect INTERVAL value: 'NULL'
call p_16();
ERROR HY000: Incorrect INTERVAL value: 'NULL'
set @a= 6;
call p_16();
drop procedure p_16;
drop event e_16;
drop database events_test;
SHOW VARIABLES LIKE 'event%';
Variable_name Value
event_scheduler DISABLED
SELECT @@global.event_scheduler;
@@global.event_scheduler
DISABLED
SET GLOBAL event_scheduler=on;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=off;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=0;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=1;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
SET GLOBAL event_scheduler=SUSPEND;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
SET GLOBAL event_scheduler=SUSPENDED;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
SET GLOBAL event_scheduler=disabled;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
......@@ -49,35 +49,26 @@ drop event event2;
create event event2 on schedule every 2 second starts now() ends date_add(now(), interval 5 hour) comment "some" DO begin end;
drop event event2;
#
# BUG #16537 (Events: mysql.event.starts is null)
#
CREATE EVENT event_starts_test ON SCHEDULE EVERY 10 SECOND COMMENT "" DO SELECT 1;
--replace_column 8 # 9 #
SHOW EVENTS;
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
SELECT interval_field, interval_value, body FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test ON SCHEDULE AT '2020-02-02 20:00:02';
--replace_column 8 # 9 #
SHOW EVENTS;
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test COMMENT "non-empty comment";
--replace_column 8 # 9 #
SHOW EVENTS;
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test COMMENT "";
--replace_column 8 # 9 #
SHOW EVENTS;
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
DROP EVENT event_starts_test;
CREATE EVENT event_starts_test ON SCHEDULE EVERY 20 SECOND STARTS '2020-02-02 20:00:02' ENDS '2022-02-02 20:00:02' DO SELECT 2;
--replace_column 8 # 9 #
SHOW EVENTS;
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test COMMENT "non-empty comment";
--replace_column 8 # 9 #
SHOW EVENTS;
SELECT starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
ALTER EVENT event_starts_test COMMENT "";
--replace_column 8 # 9 #
SHOW EVENTS;
SELECT execute_at IS NULL, starts IS NULL, ends IS NULL, comment FROM mysql.event WHERE db='events_test' AND name='event_starts_test';
DROP EVENT event_starts_test;
#
#
......
......@@ -234,4 +234,23 @@ create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop t
# END - BUG#16394: Events: Crash if schedule contains SELECT
#
#
# START - BUG#22397: Events: crash with procedure which alters events
#
--disable_warnings
drop event if exists e_16;
drop procedure if exists p_16;
--enable_warnings
create event e_16 on schedule every 1 second do set @a=5;
create procedure p_16 () alter event e_16 on schedule every @a second;
set @a = null;
--error ER_WRONG_VALUE
call p_16();
--error ER_WRONG_VALUE
call p_16();
set @a= 6;
call p_16();
drop procedure p_16;
drop event e_16;
drop database events_test;
SHOW VARIABLES LIKE 'event%';
Variable_name Value
event_scheduler DISABLED
SELECT @@global.event_scheduler;
@@global.event_scheduler
DISABLED
SET GLOBAL event_scheduler=on;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=off;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=0;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=1;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
SET GLOBAL event_scheduler=SUSPEND;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
SET GLOBAL event_scheduler=SUSPENDED;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
SET GLOBAL event_scheduler=disabled;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
SHOW VARIABLES LIKE 'event%';
Variable_name Value
event_scheduler DISABLED
SELECT @@global.event_scheduler;
@@global.event_scheduler
DISABLED
SET GLOBAL event_scheduler=on;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=off;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=0;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=1;
ERROR HY000: The MySQL server is running with the --event-scheduler=DISABLED option so it cannot execute this statement
SET GLOBAL event_scheduler=2;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
SET GLOBAL event_scheduler=SUSPEND;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPEND'
SET GLOBAL event_scheduler=SUSPENDED;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'SUSPENDED'
SET GLOBAL event_scheduler=disabled;
ERROR 42000: Variable 'event_scheduler' can't be set to the value of 'disabled'
......@@ -353,7 +353,7 @@ Event_parse_data::init_interval(THD *thd)
DBUG_RETURN(0);
wrong_value:
report_bad_value("INTERVAL", item_execute_at);
report_bad_value("INTERVAL", item_expression);
DBUG_RETURN(ER_WRONG_VALUE);
}
......
......@@ -55,7 +55,7 @@ public:
{
EVENTS_OFF= 0,
EVENTS_ON= 1,
EVENTS_DISABLED= 5
EVENTS_DISABLED= 4
};
static enum_opt_event_scheduler opt_event_scheduler;
......
......@@ -4201,8 +4201,6 @@ static interval_type get_real_interval_type(interval_type i_type)
return INTERVAL_SECOND;
}
extern LEX_STRING interval_type_to_name[];
/*
Loads an event from mysql.event and copies it's data to a row of
......
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