diff options
author | unknown <andrey@example.com> | 2006-11-02 13:51:43 +0100 |
---|---|---|
committer | unknown <andrey@example.com> | 2006-11-02 13:51:43 +0100 |
commit | 63030d767c98ff0bd57cddfe610b9bbe9ca06a63 (patch) | |
tree | 056ba4c6947c1fef6b27bd39ac904fd5a048b79f /mysql-test/t/events_bugs.test | |
parent | ae03b232ccb807c1351c1ee008bb9d6f06c22d50 (diff) | |
download | mariadb-git-63030d767c98ff0bd57cddfe610b9bbe9ca06a63.tar.gz |
Better fix for bug#22830
Events: crash with procedure which alters events with function
Post-review CS
This fix also changes the handling of KILL command combined with
subquery. It changes the error message given back to "not supported",
from parse error. The error for CREATE|ALTER EVENT has also been changed
to generate "not supported yet" instead of parse error.
In case of a SP call, the error is "not supported yet". This change
cleans the parser from code which should not belong to there. Still
LEX::expr_allows_subselect is existant because it simplifies the handling
of SQLCOM_HA_READ which forbids subselects.
mysql-test/r/events_bugs.result:
update resut
mysql-test/r/events_grant.result:
update result
mysql-test/r/kill.result:
the error message has been changed for KILL
mysql-test/t/events_bugs.test:
Update old tests with the new emitted error
Add a test case for
BUG#22830 Events: crash with procedure which alters events with function
mysql-test/t/events_grant.test:
add ORDER BY clause to keep the result deterministic.
mysql-test/t/kill.test:
use name of the error, and change the error
from parse error, to not supported
sql/sql_lex.cc:
Add an auxiliary function that checks whether SP and/or
tables are used in the statement. This function is helpful for
statements that cannot handle subqueries ans SP calls. Adding out
of the parser cleans the latter of handling of special cases and
letting it do its job of parsing.
sql/sql_lex.h:
helper function to check whether a table or SP was used
sql/sql_parse.cc:
Use LEX::table_or_sp_used() for SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT
and SQLCOM_KILL. SQLCOM_DROP event does not use `expr` rule and thus a check is
not needed.
sql/sql_yacc.yy:
Remove usage of LEX::expr_allows_subselect for CREATE|ALTER EVENT
and KILL. There is only one left occurence - SQLCOM_HAREAD, but it
adds one table to the list of tables
Diffstat (limited to 'mysql-test/t/events_bugs.test')
-rw-r--r-- | mysql-test/t/events_bugs.test | 51 |
1 files changed, 47 insertions, 4 deletions
diff --git a/mysql-test/t/events_bugs.test b/mysql-test/t/events_bugs.test index 60e8c78d8bb..6223395bfd9 100644 --- a/mysql-test/t/events_bugs.test +++ b/mysql-test/t/events_bugs.test @@ -222,13 +222,13 @@ drop database mysqltest_db1; # # START - BUG#16394: Events: Crash if schedule contains SELECT # ---error ER_PARSE_ERROR +--error ER_NOT_SUPPORTED_YET create event e_53 on schedule at (select s1 from ttx) do drop table t; ---error ER_PARSE_ERROR +--error ER_NOT_SUPPORTED_YET create event e_53 on schedule every (select s1 from ttx) second do drop table t; ---error ER_PARSE_ERROR +--error ER_NOT_SUPPORTED_YET create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t; ---error ER_PARSE_ERROR +--error ER_NOT_SUPPORTED_YET create event e_53 on schedule every 5 second ends (select s1 from ttx) do drop table t; # # END - BUG#16394: Events: Crash if schedule contains SELECT @@ -253,4 +253,47 @@ call p_16(); drop procedure p_16; drop event e_16; + +# +# START - BUG#22830 Events: crash with procedure which alters events with function +# +--disable_warnings +drop function if exists f22830; +drop event if exists e22830; +drop event if exists e22830_1; +drop event if exists e22830_2; +drop event if exists e22830_3; +drop event if exists e22830_4; +drop table if exists t1; +drop table if exists t2; +--enable_warnings +create table t1 (a int); +insert into t1 values (2); +create table t2 (a char(20)); +insert into t2 values ("e22830_1"); +create function f22830 () returns int return 5; +--error ER_NOT_SUPPORTED_YET +create event e22830 on schedule every f22830() second do select 123; +create event e22830_1 on schedule every 1 hour do alter event e22830_1 on schedule every (select 8 from dual) hour; +create event e22830_2 on schedule every 1 hour do alter event e22830_2 on schedule every (select 8 from t1) hour; +create event e22830_3 on schedule every 1 hour do alter event e22830_3 on schedule every f22830() hour; +create event e22830_4 on schedule every 1 hour do alter event e22830_4 on schedule every (select f22830() from dual) hour; +select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; +set global event_scheduler=on; +--sleep 0.7 +set global event_scheduler=off; +select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; +drop function f22830; +--error ER_PARSE_ERROR +drop event (select a from t2); +drop event e22830_1; +drop event e22830_2; +drop event e22830_3; +drop event e22830_4; +drop table t1; +drop table t2; + +# +# End of tests +# drop database events_test; |