Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
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 e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY STARTS '2006-01-01 00:00:00' DO
...
@@ -796,6 +796,20 @@ COUNT(*)
...
@@ -796,6 +796,20 @@ COUNT(*)
DROP EVENT IF EXISTS event_Bug12546938;
DROP EVENT IF EXISTS event_Bug12546938;
DROP TABLE table_bug12546938;
DROP TABLE table_bug12546938;
SET GLOBAL EVENT_SCHEDULER = OFF;
SET GLOBAL EVENT_SCHEDULER = OFF;
DROP DATABASE IF EXISTS event_test11764334;
CREATE DATABASE event_test11764334;
USE event_test11764334;
CREATE EVENT ev1 ON SCHEDULE EVERY 3 SECOND DISABLE DO SELECT 1;
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 3 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
ALTER EVENT ev1 ON SCHEDULE EVERY 4 SECOND;
SHOW EVENTS IN event_test11764334 WHERE NAME='ev1';
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
event_test11764334 ev1 root@localhost SYSTEM RECURRING NULL 4 SECOND # # DISABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci
DROP EVENT ev1;
DROP DATABASE event_test11764334;
USE test;
DROP DATABASE events_test;
DROP DATABASE events_test;
SET GLOBAL event_scheduler= 'ON';
SET GLOBAL event_scheduler= 'ON';
SET @@global.concurrent_insert= @concurrent_insert;
SET @@global.concurrent_insert= @concurrent_insert;
# Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
#
DROP TABLE IF EXISTS t1, t2, t3;
CREATE TABLE t1 ( a INT );
CREATE TABLE t2 ( a INT );
CREATE TABLE t3 ( a INT );
INSERT INTO t1 VALUES (1), (2), (3);
INSERT INTO t2 VALUES (1), (2), (3);
INSERT INTO t3 VALUES (1), (2), (3);
# We simulate importing a trigger from 5.0 by writing a .TRN file for
# each trigger plus a .TRG file the way MySQL 5.0 would have done it,
# with syntax allowed in 5.0 only.
#
# Note that in 5.0 the following lines are missing from t1.TRG:
#
# client_cs_names='latin1'
# connection_cl_names='latin1_swedish_ci'
# db_cl_names='latin1_swedish_ci'
# We will get parse errors for most DDL and DML statements when the table
# has broken triggers. The parse error refers to the first broken
# trigger.
CREATE TRIGGER tr16 AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t1 VALUES (1);
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
CREATE TRIGGER tr22 BEFORE INSERT ON t2 FOR EACH ROW DELETE FROM non_existing_table;
ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
tr11 INSERT t1 DELETE FROM t3 BEFORE NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
tr12 INSERT t1 DELETE FROM t3 AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
tr14 DELETE t1 DELETE FROM non_existing_table AFTER NULL root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
Warning 1603 Triggers for table `test`.`t2` have no creation context
INSERT INTO t1 VALUES (1);
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
INSERT INTO t2 VALUES (1);
ERROR 42000: Unknown trigger has an error in its body: '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 'Not allowed syntax here, and trigger name cant be extracted either.' at line 1'
DELETE FROM t1;
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
UPDATE t1 SET a = 1 WHERE a = 1;
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
SELECT * FROM t1;
a
1
2
3
RENAME TABLE t1 TO t1_2;
ERROR 42000: Trigger 'tr13' has an error in its body: '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 'a USING t1 a' at line 1'
# We write the same trigger files one more time to test DROP TABLE.
DROP TABLE t1;
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
DROP TABLE t2;
Warnings:
Warning 1603 Triggers for table `test`.`t2` have no creation context
DROP TABLE t3;
# Make sure there is no trigger file left.
CREATE TABLE t1 ( a INT );
CREATE TABLE t2 ( a INT );
INSERT INTO t1 VALUES (1), (2), (3);
INSERT INTO t2 VALUES (1), (2), (3);
# We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
# and last trigger is broken.
# Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
FLUSH TABLE t1;
SHOW CREATE TRIGGER tr12;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
tr12 CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2 latin1 latin1_swedish_ci latin1_swedish_ci
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
SHOW CREATE TRIGGER tr11;
Trigger sql_mode SQL Original Statement character_set_client collation_connection Database Collation
tr11 CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a latin1 latin1_swedish_ci latin1_swedish_ci
DROP TRIGGER tr12;
Warnings:
Warning 1603 Triggers for table `test`.`t1` have no creation context
Warning 1064 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 'VALUES (1)' at line 1
INSERT INTO t2 VALUES (1);
INSERT INTO t2 VALUES (1);
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 'VALUES (1)' at line 1
ERROR 42000: Trigger 'trg1' has an error in its body: '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 'VALUES (1)' at line 1'
--echo# Bug#45235: 5.1 does not support 5.0-only syntax triggers in any way
--echo#
let$MYSQLD_DATADIR=`SELECT @@datadir`;
--disable_warnings
DROPTABLEIFEXISTSt1,t2,t3;
--enable_warnings
CREATETABLEt1(aINT);
CREATETABLEt2(aINT);
CREATETABLEt3(aINT);
INSERTINTOt1VALUES(1),(2),(3);
INSERTINTOt2VALUES(1),(2),(3);
INSERTINTOt3VALUES(1),(2),(3);
--echo# We simulate importing a trigger from 5.0 by writing a .TRN file for
--echo# each trigger plus a .TRG file the way MySQL 5.0 would have done it,
--echo# with syntax allowed in 5.0 only.
--echo#
--echo# Note that in 5.0 the following lines are missing from t1.TRG:
--echo#
--echo# client_cs_names='latin1'
--echo# connection_cl_names='latin1_swedish_ci'
--echo# db_cl_names='latin1_swedish_ci'
--write_file$MYSQLD_DATADIR/test/tr11.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr12.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr13.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr14.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr15.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/t1.TRG
TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3''CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3''CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a''CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table''CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
--echo# We write the same trigger files one more time to test DROP TABLE.
--write_file$MYSQLD_DATADIR/test/tr11.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr12.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr13.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr14.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr15.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/t1.TRG
TYPE=TRIGGERS
triggers='CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t3''CREATE DEFINER=`root`@`localhost` TRIGGER tr12 AFTER INSERT ON t1 FOR EACH ROW DELETE FROM t3''CREATE DEFINER=`root`@`localhost` TRIGGER tr13 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a''CREATE DEFINER=`root`@`localhost` TRIGGER tr14 AFTER DELETE ON t1 FOR EACH ROW DELETE FROM non_existing_table''CREATE DEFINER=`root`@`localhost` TRIGGER tr15 BEFORE UPDATE ON t1 FOR EACH ROW DELETE FROM non_existing_table a USING non_existing_table a'
--echo# We write three trigger files. First trigger is syntaxically incorrect, next trigger is correct
--echo# and last trigger is broken.
--echo# Next we try to execute SHOW CREATE TRGGIR command for broken trigger and then try to drop one.
--write_file$MYSQLD_DATADIR/test/tr11.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/tr12.TRN
TYPE=TRIGGERNAME
trigger_table=t1
EOF
--write_file$MYSQLD_DATADIR/test/t1.TRG
TYPE=TRIGGERS
triggers='CREATE the wrongest trigger_in_the_world''CREATE DEFINER=`root`@`localhost` TRIGGER tr11 BEFORE DELETE ON t1 FOR EACH ROW DELETE FROM t1 a USING t1 a''CREATE DEFINER=`root`@`localhost` TRIGGER tr12 BEFORE INSERT ON t1 FOR EACH ROW DELETE FROM t2'