diff options
author | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-05-27 18:42:28 +0700 |
---|---|---|
committer | Dmitry Shulga <Dmitry.Shulga@oracle.com> | 2011-05-27 18:42:28 +0700 |
commit | c34a99b8b91dbf4c61c0c659d11ff7d62f0e2ffb (patch) | |
tree | c1f9ac889f06425764a59c638f9df97659d53aba /mysql-test/t/events_bugs.test | |
parent | 20791d83dec2736bdc6ff7dfc2f3365595c1fd00 (diff) | |
parent | 56a735b78226f6de336c520936df3485d929d685 (diff) | |
download | mariadb-git-c34a99b8b91dbf4c61c0c659d11ff7d62f0e2ffb.tar.gz |
Manual-merge of patch for bug#12546938 from mysql-5.1->mysql-5.5
Diffstat (limited to 'mysql-test/t/events_bugs.test')
-rw-r--r-- | mysql-test/t/events_bugs.test | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index 9432e64e032..036a1132acd 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -857,6 +857,7 @@ DROP EVENT e2; DROP EVENT e1; SET TIME_ZONE=@save_time_zone; +SET TIMESTAMP=DEFAULT; # # START - BUG#28666 CREATE EVENT ... EVERY 0 SECOND let server crash @@ -1235,6 +1236,55 @@ SHOW EVENTS; DROP DATABASE event_test1; DROP DATABASE event_test12; +--echo # +--echo # Bug#12546938 (formerly known as bug#61005): +--echo # CREATE IF NOT EXIST EVENT WILL CREATE MULTIPLE RUNNING EVENTS +--echo # +USE events_test; +SET GLOBAL event_scheduler = ON; + +--disable_warnings +DROP TABLE IF EXISTS table_bug12546938; +DROP EVENT IF EXISTS event_Bug12546938; +--enable_warnings +CREATE TABLE table_bug12546938 (i INT); + +delimiter |; + +--echo # Create an event which will be executed with a small delay +--echo # and won't be automatically dropped after that. +CREATE EVENT event_Bug12546938 +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE +ENABLE DO +BEGIN + INSERT INTO table_bug12546938 VALUES(1); +END +| + +--echo # Now try to create the same event using CREATE EVENT IF NOT EXISTS. +--echo # A warning should be emitted. A new event should not be created nor +--echo # the old event should be re-executed. +CREATE EVENT IF NOT EXISTS event_bug12546938 +ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 SECOND ON COMPLETION PRESERVE +ENABLE DO +BEGIN + INSERT INTO table_bug12546938 VALUES (1); +END +| + +delimiter ;| + +--echo # Wait until at least one instance of event is executed. +let $wait_condition= SELECT COUNT(*) FROM table_bug12546938; +--source include/wait_condition.inc + +--echo # Check that only one instance of our event was executed. +SELECT COUNT(*) FROM table_bug12546938; + +--echo # Clean-up. +DROP EVENT IF EXISTS event_Bug12546938; +DROP TABLE table_bug12546938; +SET GLOBAL EVENT_SCHEDULER = OFF; ########################################################################### # |