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/r/events_bugs.result | |
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/r/events_bugs.result')
-rw-r--r-- | mysql-test/r/events_bugs.result | 50 |
1 files changed, 46 insertions, 4 deletions
diff --git a/mysql-test/r/events_bugs.result b/mysql-test/r/events_bugs.result index 08be6924e03..363033e487a 100644 --- a/mysql-test/r/events_bugs.result +++ b/mysql-test/r/events_bugs.result @@ -206,13 +206,13 @@ drop event events_test.mysqltest_user1; drop user mysqltest_user1@localhost; drop database mysqltest_db1; create event e_53 on schedule at (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 +ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' create event e_53 on schedule every (select s1 from ttx) second 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) second do drop table t' at line 1 +ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' create event e_53 on schedule every 5 second starts (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 +ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' 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 +ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' 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; @@ -226,4 +226,46 @@ set @a= 6; call p_16(); drop procedure p_16; drop event e_16; +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; +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; +create event e22830 on schedule every f22830() second do select 123; +ERROR 42000: This version of MySQL doesn't yet support 'Usage of subqueries or stored function calls as part of this statement' +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; +event_name event_definition interval_value interval_field +e22830_1 alter event e22830_1 on schedule every (select 8 from dual) hour 1 HOUR +e22830_2 alter event e22830_2 on schedule every (select 8 from t1) hour 1 HOUR +e22830_3 alter event e22830_3 on schedule every f22830() hour 1 HOUR +e22830_4 alter event e22830_4 on schedule every (select f22830() from dual) hour 1 HOUR +set global event_scheduler=on; +set global event_scheduler=off; +select event_name, event_definition, interval_value, interval_field from information_schema.events order by event_name; +event_name event_definition interval_value interval_field +e22830_1 alter event e22830_1 on schedule every (select 8 from dual) hour 8 HOUR +e22830_2 alter event e22830_2 on schedule every (select 8 from t1) hour 1 HOUR +e22830_3 alter event e22830_3 on schedule every f22830() hour 1 HOUR +e22830_4 alter event e22830_4 on schedule every (select f22830() from dual) hour 1 HOUR +drop function f22830; +drop event (select a from t2); +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 a from t2)' at line 1 +drop event e22830_1; +drop event e22830_2; +drop event e22830_3; +drop event e22830_4; +drop table t1; +drop table t2; drop database events_test; |