mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
8d4f74be2d
- fix for bug#16423 (Events: SHOW CREATE EVENT doesn't work) - this Changeset commits makes CREATE/UPDATE/DELETE EVENT real DDL statements by committing the currently open transaction before they are executed. - this Changeset also fixes a trailing space problem since the very early days of the internal cron - adds sophisticated checking of whether mysql.event was tampered accidentally or with purpose by an user. - adds a lot of inline function documentation - documents everything left uncodumented - INTERVAL_XXXX to XXX in I_S.EVENTS.INTERVAL_FIELD WL#1034 (Internal CRON) mysql-test/r/events.result: update result mysql-test/t/events.test: add test cases for SHOW CREATE EVENT add test cases where the structure of mysql.event is changed and error reporting in this case sql/event.cc: - do a lot more checking on mysql.event whether it's valid introduced generic function table_check_intact() which can be used also for checking whether a system table (mysql.*) has been tampered by user and report an error in this case. The checking is quite strict, thus maybe some mechanism can be added later that loosens this like some session variable, for instance, i_am_aware_that_i_can_damage_my_data so the table will be opened nevertheless we think that it's not valid. - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - document a loooot. not a single function left undocumented. sql/event.h: - add evex_show_create_event(THD *thd, sp_name *spn, LEX_STRING definer) - change get_show_create_event() to get_create_event() - add TABLE_FIELD_W_TYPE used by table_check_intact() - add event_timed::sql_mode so it can be used by show create event. currently always 0, will be fixed by a patch for another bug. At least makes the code of show create event complete. sql/event_executor.cc: - add evex_check_system_tables() that checks on boot and event main thread startup that mysql.db and mysql.user tables are correct. - document everything! sql/event_priv.h: remove a line sql/event_timed.cc: - implement SHOW CREATE EVENT - document undocumented functions! sql/share/errmsg.txt: - fix an error message and add two new sql/sql_acl.cc: - add mysql.db table definition to use by table_check_intact() - exchange some of the positions by numbers from mysql.db to enum names (see sql_acl.h) sql/sql_acl.h: - define the structure of mysql.db table sql/sql_parse.cc: - handle SQLCOM_SHOW_CREATE_EVENT - end the current transaction becase CREATE/UPDATE/DELETE EVENT is a DDL statement sql/sql_show.cc: - remove interval_type_to_name - use common function event_reconstruct_interval_expression() that reconstructs the expression given at create/alter, to some extent - interval of 2:62 MINUTE_SECOND will be reconstructed as interval of 3:02 MINUTE_SECOND! sql/sql_yacc.yy: init the definer of event_timed also when doing SHOW CREATE EVENT because it's needed for checking into mysql.event sql/table.cc: - remove stale code. only mysql.event should be a 'system_table' - add table_check_intact() to check the consistency of a table. mostly usable with mysql.xxx tables. sql/table.h: - export TABLE_FIELD_W_TYPE and table_check_intact() which are used for checking the structure of a table. mostly usable for mysql.xxx tables.
305 lines
17 KiB
Text
305 lines
17 KiB
Text
create database if not exists events_test;
|
||
use events_test;
|
||
drop event if exists event1;
|
||
Warnings:
|
||
Note 1305 Event event1 does not exist
|
||
create event event1 on schedule every 15 minute starts now() ends date_add(now(), interval 5 hour) DO begin end;
|
||
alter event event1 rename to event2 enable;
|
||
alter event event2 disable;
|
||
alter event event2 enable;
|
||
alter event event2 on completion not preserve;
|
||
alter event event2 on schedule every 1 year on completion preserve rename to event3 comment "new comment" do begin select 1; end__
|
||
alter event event3 rename to event2;
|
||
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 e_43 on schedule every 1 second do set @a = 5;
|
||
set global event_scheduler = 1;
|
||
select sleep(2);
|
||
sleep(2)
|
||
0
|
||
alter event e_43 do alter event e_43 do set @a = 4;
|
||
select sleep(3);
|
||
sleep(3)
|
||
0
|
||
select db, name, body, status, interval_field, interval_value from mysql.event;
|
||
db name body status interval_field interval_value
|
||
events_test e_43 set @a = 4 ENABLED SECOND 1
|
||
drop event e_43;
|
||
select sleep(1);
|
||
sleep(1)
|
||
0
|
||
set global event_scheduler = 0;
|
||
create table t_event3 (a int, b float);
|
||
drop event if exists event3;
|
||
Warnings:
|
||
Note 1305 Event event3 does not exist
|
||
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());
|
||
set max_allowed_packet=128000000;
|
||
select count(*) from t_event3;
|
||
count(*)
|
||
0
|
||
drop event event3;
|
||
drop table t_event3;
|
||
set names utf8;
|
||
CREATE EVENT root6 ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1;
|
||
SHOW CREATE EVENT root6;
|
||
Event sql_mode Create Event
|
||
root6 CREATE EVENT `events_test`.`root6` ON SCHEDULE EVERY '10:20' MINUTE_SECOND ON COMPLETION PRESERVE ENABLE COMMENT 'some comment' DO select 1
|
||
create event root7 on schedule every 2 year do select 1;
|
||
SHOW CREATE EVENT root7;
|
||
Event sql_mode Create Event
|
||
root7 CREATE EVENT `events_test`.`root7` ON SCHEDULE EVERY 2 YEAR ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root8 on schedule every '2:5' year_month do select 1;
|
||
SHOW CREATE EVENT root8;
|
||
Event sql_mode Create Event
|
||
root8 CREATE EVENT `events_test`.`root8` ON SCHEDULE EVERY '2-5' YEAR_MONTH ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root8_1 on schedule every '2:15' year_month do select 1;
|
||
SHOW CREATE EVENT root8_1;
|
||
Event sql_mode Create Event
|
||
root8_1 CREATE EVENT `events_test`.`root8_1` ON SCHEDULE EVERY '3-3' YEAR_MONTH ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root9 on schedule every 2 week ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' do select 1;
|
||
SHOW CREATE EVENT root9;
|
||
Event sql_mode Create Event
|
||
root9 CREATE EVENT `events_test`.`root9` ON SCHEDULE EVERY 2 WEEK ON COMPLETION PRESERVE DISABLE COMMENT 'коментар на кирилица' DO select 1
|
||
create event root10 on schedule every '20:5' day_hour do select 1;
|
||
SHOW CREATE EVENT root10;
|
||
Event sql_mode Create Event
|
||
root10 CREATE EVENT `events_test`.`root10` ON SCHEDULE EVERY '20 5' DAY_HOUR ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root11 on schedule every '20:25' day_hour do select 1;
|
||
SHOW CREATE EVENT root11;
|
||
Event sql_mode Create Event
|
||
root11 CREATE EVENT `events_test`.`root11` ON SCHEDULE EVERY '21 1' DAY_HOUR ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root12 on schedule every '20:25' hour_minute do select 1;
|
||
SHOW CREATE EVENT root12;
|
||
Event sql_mode Create Event
|
||
root12 CREATE EVENT `events_test`.`root12` ON SCHEDULE EVERY '20:25' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root13 on schedule every '25:25' hour_minute do select 1;
|
||
SHOW CREATE EVENT root13;
|
||
Event sql_mode Create Event
|
||
root13 CREATE EVENT `events_test`.`root13` ON SCHEDULE EVERY '25:25' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root13_1 on schedule every '11:65' hour_minute do select 1;
|
||
SHOW CREATE EVENT root13_1;
|
||
Event sql_mode Create Event
|
||
root13_1 CREATE EVENT `events_test`.`root13_1` ON SCHEDULE EVERY '12:5' HOUR_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root14 on schedule every '35:35' minute_second do select 1;
|
||
SHOW CREATE EVENT root14;
|
||
Event sql_mode Create Event
|
||
root14 CREATE EVENT `events_test`.`root14` ON SCHEDULE EVERY '35:35' MINUTE_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root15 on schedule every '35:66' minute_second do select 1;
|
||
SHOW CREATE EVENT root15;
|
||
Event sql_mode Create Event
|
||
root15 CREATE EVENT `events_test`.`root15` ON SCHEDULE EVERY '36:6' MINUTE_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root16 on schedule every '35:56' day_minute do select 1;
|
||
SHOW CREATE EVENT root16;
|
||
Event sql_mode Create Event
|
||
root16 CREATE EVENT `events_test`.`root16` ON SCHEDULE EVERY '1 11:56' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root17 on schedule every '35:12:45' day_minute do select 1;
|
||
SHOW CREATE EVENT root17;
|
||
Event sql_mode Create Event
|
||
root17 CREATE EVENT `events_test`.`root17` ON SCHEDULE EVERY '35 12:45' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root17_1 on schedule every '35:25:65' day_minute do select 1;
|
||
SHOW CREATE EVENT root17_1;
|
||
Event sql_mode Create Event
|
||
root17_1 CREATE EVENT `events_test`.`root17_1` ON SCHEDULE EVERY '36 2:5' DAY_MINUTE ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root18 on schedule every '35:12:45' hour_second do select 1;
|
||
SHOW CREATE EVENT root18;
|
||
Event sql_mode Create Event
|
||
root18 CREATE EVENT `events_test`.`root18` ON SCHEDULE EVERY '35:12:45' HOUR_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root19 on schedule every '15:59:85' hour_second do select 1;
|
||
SHOW CREATE EVENT root19;
|
||
Event sql_mode Create Event
|
||
root19 CREATE EVENT `events_test`.`root19` ON SCHEDULE EVERY '16:0:25' HOUR_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
create event root20 on schedule every '50:20:12:45' day_second do select 1;
|
||
SHOW CREATE EVENT root20;
|
||
Event sql_mode Create Event
|
||
root20 CREATE EVENT `events_test`.`root20` ON SCHEDULE EVERY '50 20:12:45' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE DO select 1
|
||
set names cp1251;
|
||
create event <20><><EFBFBD><EFBFBD>21 on schedule every '50:23:59:95' day_second COMMENT '<27><><EFBFBD><EFBFBD> <20> 1251 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' do select 1;
|
||
SHOW CREATE EVENT <20><><EFBFBD><EFBFBD>21;
|
||
Event sql_mode Create Event
|
||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>21 CREATE EVENT `events_test`.`<60><><EFBFBD><EFBFBD>21` ON SCHEDULE EVERY '51 0:0:35' DAY_SECOND ON COMPLETION NOT PRESERVE ENABLE COMMENT '<27><><EFBFBD><EFBFBD> <20> 1251 <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>' DO select 1
|
||
insert into mysql.event (db, name, body, definer, interval_value, interval_field) values (database(), "root22", "select 1", user(), 100, "SECOND_MICROSECOND");
|
||
show create event root22;
|
||
ERROR HY000: Microseconds intervals are not yet supported
|
||
SHOW EVENTS;
|
||
ERROR HY000: Microseconds intervals are not yet supported
|
||
drop event root22;
|
||
drop event root6;
|
||
drop event root7;
|
||
drop event root8;
|
||
drop event root8_1;
|
||
drop event root9;
|
||
drop event root10;
|
||
drop event root11;
|
||
drop event root12;
|
||
drop event root13;
|
||
drop event root13_1;
|
||
drop event root14;
|
||
drop event root15;
|
||
drop event root16;
|
||
drop event root17;
|
||
drop event root17_1;
|
||
drop event root18;
|
||
drop event root19;
|
||
drop event root20;
|
||
drop event <20><><EFBFBD><EFBFBD>21;
|
||
set names latin1;
|
||
CREATE EVENT intact_check ON SCHEDULE EVERY 10 HOUR DO SELECT "nothing";
|
||
SHOW EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test intact_check root@localhost RECURRING NULL 10 10 HOUR # # ENABLED
|
||
ALTER TABLE mysql.event ADD dummy INT FIRST;
|
||
SHOW EVENTS;
|
||
ERROR HY000: Column count of mysql.event is wrong. Table probably corrupted. Expected 15, found 16.
|
||
ALTER TABLE mysql.event DROP dummy, ADD dummy2 VARCHAR(64) FIRST;
|
||
SHOW EVENTS;
|
||
ERROR HY000: Column count of mysql.event is wrong. Table probably corrupted. Expected 15, found 16.
|
||
ALTER TABLE mysql.event DROP dummy2;
|
||
SHOW EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test intact_check root@localhost RECURRING NULL 10 10 HOUR # # ENABLED
|
||
CREATE TABLE event_like LIKE mysql.event;
|
||
INSERT INTO event_like SELECT * FROM mysql.event;
|
||
ALTER TABLE mysql.event MODIFY db char(20) character set utf8 collate utf8_bin default '';
|
||
SHOW CREATE TABLE mysql.event;
|
||
Table Create Table
|
||
event CREATE TABLE `event` (
|
||
`db` char(20) character set utf8 collate utf8_bin NOT NULL default '',
|
||
`name` char(64) character set utf8 collate utf8_bin NOT NULL default '',
|
||
`body` longblob NOT NULL,
|
||
`definer` char(77) character set utf8 collate utf8_bin NOT NULL default '',
|
||
`execute_at` datetime default NULL,
|
||
`interval_value` int(11) default NULL,
|
||
`interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL,
|
||
`created` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
|
||
`modified` timestamp NOT NULL default '0000-00-00 00:00:00',
|
||
`last_executed` datetime default NULL,
|
||
`starts` datetime default NULL,
|
||
`ends` datetime default NULL,
|
||
`status` enum('ENABLED','DISABLED') NOT NULL default 'ENABLED',
|
||
`on_completion` enum('DROP','PRESERVE') NOT NULL default 'DROP',
|
||
`comment` char(64) character set utf8 collate utf8_bin NOT NULL default '',
|
||
PRIMARY KEY (`definer`,`db`,`name`)
|
||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events'
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
|
||
ALTER TABLE mysql.event MODIFY db char(64) character set utf8 collate utf8_bin default '';
|
||
"This should work"
|
||
SHOW EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test intact_check root@localhost RECURRING NULL 10 10 HOUR # # ENABLED
|
||
ALTER TABLE mysql.event MODIFY db char(64) character set cp1251 default '';
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
|
||
ALTER TABLE mysql.event MODIFY db varchar(64) character set utf8 collate utf8_bin default '';
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
ERROR HY000: Cannot load from mysql.event. Table probably corrupted. See error log.
|
||
ALTER TABLE mysql.event DROP comment, DROP starts;
|
||
SELECT event_name FROM INFORMATION_SCHEMA.EVENTS;
|
||
ERROR HY000: Column count of mysql.event is wrong. Table probably corrupted. Expected 15, found 13.
|
||
DROP TABLE mysql.event;
|
||
CREATE TABLE mysql.event like event_like;
|
||
INSERT INTO mysql.event SELECT * FROM event_like;
|
||
DROP TABLE event_like;
|
||
SHOW EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test intact_check root@localhost RECURRING NULL 10 10 HOUR # # ENABLED
|
||
DROP EVENT intact_check;
|
||
create event one_event on schedule every 10 second do select 123;
|
||
SHOW EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test one_event root@localhost RECURRING NULL 10 10 SECOND # # ENABLED
|
||
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
|
||
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
|
||
NULL events_test one_event root@localhost select 123 RECURRING NULL 10 10 SECOND ENABLED NOT PRESERVE
|
||
CREATE DATABASE events_test2;
|
||
CREATE USER ev_test@localhost;
|
||
GRANT ALL ON events_test.* to ev_test@localhost;
|
||
GRANT ALL on events_test2.* to ev_test@localhost;
|
||
REVOKE EVENT ON events_test2.* FROM ev_test@localhost;
|
||
REVOKE PROCESS on *.* from ev_test@localhost;
|
||
select "NEW CONNECTION";
|
||
NEW CONNECTION
|
||
NEW CONNECTION
|
||
SELECT USER(), DATABASE();
|
||
USER() DATABASE()
|
||
ev_test@localhost events_test2
|
||
SHOW GRANTS;
|
||
Grants for ev_test@localhost
|
||
GRANT USAGE ON *.* TO 'ev_test'@'localhost'
|
||
GRANT ALL PRIVILEGES ON `events_test`.* TO 'ev_test'@'localhost'
|
||
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, REFERENCES, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE ON `events_test2`.* TO 'ev_test'@'localhost'
|
||
"Here comes an error:";
|
||
SHOW EVENTS;
|
||
ERROR 42000: Access denied for user 'ev_test'@'localhost' to database 'events_test2'
|
||
USE events_test;
|
||
"Now the list should be empty:";
|
||
SHOW EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
select concat("Let's create some new events from the name of ",user());
|
||
concat("Let's create some new events from the name of ",user())
|
||
Let's create some new events from the name of ev_test@localhost
|
||
create event one_event on schedule every 20 second do select 123;
|
||
create event two_event on schedule every 20 second on completion not preserve comment "two event" do select 123;
|
||
create event three_event on schedule every 20 second on completion preserve comment "three event" do select 123;
|
||
"Now we should see 3 events:";
|
||
SHOW EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test one_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
events_test three_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
events_test two_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
"This should show us only 3 events:";
|
||
SHOW FULL EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test one_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
events_test three_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
events_test two_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
"This should show us only 2 events:";
|
||
SHOW FULL EVENTS LIKE 't%event';
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test three_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
events_test two_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
"This should show us no events:";
|
||
SHOW FULL EVENTS FROM test LIKE '%';
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
DROP DATABASE events_test2;
|
||
"should see 1 event:";
|
||
SHOW EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test one_event root@localhost RECURRING NULL 10 10 SECOND # # ENABLED
|
||
"we should see 4 events now:";
|
||
SHOW FULL EVENTS;
|
||
Db Name Definer Type Execute at Interval value Interval field Starts Ends Status
|
||
events_test one_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
events_test three_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
events_test two_event ev_test@localhost RECURRING NULL 20 20 SECOND # # ENABLED
|
||
events_test one_event root@localhost RECURRING NULL 10 10 SECOND # # ENABLED
|
||
SELECT EVENT_CATALOG, EVENT_SCHEMA, EVENT_NAME, DEFINER, EVENT_BODY, EVENT_TYPE, EXECUTE_AT, INTERVAL_VALUE, INTERVAL_FIELD, STATUS,ON_COMPLETION, EVENT_COMMENT from information_schema.events;
|
||
EVENT_CATALOG EVENT_SCHEMA EVENT_NAME DEFINER EVENT_BODY EVENT_TYPE EXECUTE_AT INTERVAL_VALUE INTERVAL_FIELD STATUS ON_COMPLETION EVENT_COMMENT
|
||
NULL events_test one_event ev_test@localhost select 123 RECURRING NULL 20 20 SECOND ENABLED NOT PRESERVE
|
||
NULL events_test three_event ev_test@localhost select 123 RECURRING NULL 20 20 SECOND ENABLED PRESERVE three event
|
||
NULL events_test two_event ev_test@localhost select 123 RECURRING NULL 20 20 SECOND ENABLED NOT PRESERVE two event
|
||
NULL events_test one_event root@localhost select 123 RECURRING NULL 10 10 SECOND ENABLED NOT PRESERVE
|
||
drop event one_event;
|
||
drop event two_event;
|
||
drop event three_event;
|
||
drop user ev_test@localhost;
|
||
drop event one_event;
|
||
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 disabled do set @a = 5;
|
||
ERROR HY000: Incorrect AT value: 'NULL'
|
||
create event e_26 on schedule at 'definitely not a datetime' disabled 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=0;
|
||
ERROR HY000: Variable 'event_scheduler' is a GLOBAL variable and should be set with SET GLOBAL
|
||
set global event_scheduler=2;
|
||
ERROR 42000: Variable 'event_scheduler' can't be set to the value of '2'
|
||
drop database events_test;
|