summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mysql-test/r/events_bugs.result13
-rw-r--r--mysql-test/t/events_bugs.test19
-rw-r--r--sql/event_data_objects.cc2
3 files changed, 33 insertions, 1 deletions
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result
index 458fd151130..08be6924e03 100644
--- a/mysql-test/r/events_bugs.result
+++ b/mysql-test/r/events_bugs.result
@@ -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;
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test
index c9a8842f8f0..60e8c78d8bb 100644
--- a/mysql-test/t/events_bugs.test
+++ b/mysql-test/t/events_bugs.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;
diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc
index 6f865a2bcac..4b9aa43b14b 100644
--- a/sql/event_data_objects.cc
+++ b/sql/event_data_objects.cc
@@ -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);
}