Below is the list of changes that have just been committed into a local
5.1 repository of andrey. When andrey does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet
1.2225 06/06/29 11:53:51 andrey@lmy004. +3 -0
fix for bug#16394 "Events: Crash if schedule contains SELECT"
Parsing of CREATE/ALTER EVENT statement was crashing because of early
initialization done during parsing, instead in the after parsing phase.
Moreover, we don't want SUBqueries in CREATE/ALTER EVENT therefore we
disable them, though it is possible to make them work. It can be emulated
inside SP with a cursor and SP variable (CREATE/ALTER EVENT can still
accept variables as values).
sql/sql_yacc.yy
1.487 06/06/29 11:53:42 andrey@lmy004. +18 -8
disallow subqueries when SQLCOM_CREATE_EVENT | SQLCOM_ALTER_EVENT
The fix is not big, though lex->forbid_subqueries could have been introduced.
Easier is just to set the sql_command and check in both rules where
subqueries enter.
mysql-test/t/events_bugs.test
1.11 06/06/29 11:53:42 andrey@lmy004. +15 -0
tests for bug#16384
mysql-test/r/events_bugs.result
1.13 06/06/29 11:53:42 andrey@lmy004. +8 -0
update result
# This is a BitKeeper patch. What follows are the unified diffs for the
# set of deltas contained in the patch. The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User: andrey
# Host: lmy004.
# Root: /work/mysql-5.1-runtime-wl3337
--- 1.486/sql/sql_yacc.yy 2006-06-29 00:42:14 +02:00
+++ 1.487/sql/sql_yacc.yy 2006-06-29 11:53:42 +02:00
@@ -1303,6 +1303,9 @@ event_tail:
*/
$<ulong_num>$= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES;
YYTHD->client_capabilities &= (~CLIENT_MULTI_QUERIES);
+
+ /* We need that for disallowing subqueries */
+ Lex->sql_command= SQLCOM_CREATE_EVENT;
}
ON SCHEDULE_SYM ev_schedule_time
opt_ev_on_completion
@@ -4638,6 +4641,9 @@ alter:
*/
$<ulong_num>$= YYTHD->client_capabilities & CLIENT_MULTI_QUERIES;
YYTHD->client_capabilities &= ~CLIENT_MULTI_QUERIES;
+
+ /* we need that for disallowing subqueries */
+ Lex->sql_command= SQLCOM_ALTER_EVENT;
}
ev_alter_on_schedule_completion
opt_ev_rename_to
@@ -4653,15 +4659,15 @@ alter:
*/
YYTHD->client_capabilities |= $<ulong_num>4;
- /*
- sql_command is set here because some rules in ev_sql_stmt
- can overwrite it
- */
if (!($5 || $6 || $7 || $8 || $9))
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
}
+ /*
+ sql_command is set here because some rules in ev_sql_stmt
+ can overwrite it
+ */
Lex->sql_command= SQLCOM_ALTER_EVENT;
}
| ALTER TABLESPACE alter_tablespace_info
@@ -6959,8 +6965,10 @@ select_derived2:
{
LEX *lex= Lex;
lex->derived_tables|= DERIVED_SUBQUERY;
- if (lex->sql_command == (int)SQLCOM_HA_READ ||
- lex->sql_command == (int)SQLCOM_KILL)
+ if (lex->sql_command == SQLCOM_HA_READ ||
+ lex->sql_command == SQLCOM_KILL ||
+ lex->sql_command == SQLCOM_CREATE_EVENT ||
+ lex->sql_command == SQLCOM_ALTER_EVENT)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
@@ -10592,8 +10600,10 @@ subselect_start:
'(' SELECT_SYM
{
LEX *lex=Lex;
- if (lex->sql_command == (int)SQLCOM_HA_READ ||
- lex->sql_command == (int)SQLCOM_KILL)
+ if (lex->sql_command == SQLCOM_HA_READ ||
+ lex->sql_command == SQLCOM_KILL ||
+ lex->sql_command == SQLCOM_CREATE_EVENT ||
+ lex->sql_command == SQLCOM_ALTER_EVENT)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
--- 1.12/mysql-test/r/events_bugs.result 2006-06-27 13:15:31 +02:00
+++ 1.13/mysql-test/r/events_bugs.result 2006-06-29 11:53:42 +02:00
@@ -190,4 +190,12 @@ events_test mysqltest_user1 mysqltest_us
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
+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
+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
+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 database events_test;
--- 1.10/mysql-test/t/events_bugs.test 2006-06-27 13:15:31 +02:00
+++ 1.11/mysql-test/t/events_bugs.test 2006-06-29 11:53:42 +02:00
@@ -198,4 +198,19 @@ drop database mysqltest_db1;
# END - 18897: Events: unauthorized action possible with alter event rename
#
+#
+# START - BUG#16394: Events: Crash if schedule contains SELECT
+#
+--error ER_PARSE_ERROR
+create event e_53 on schedule at (select s1 from ttx) do drop table t;
+--error ER_PARSE_ERROR
+create event e_53 on schedule every (select s1 from ttx) second do drop table t;
+--error ER_PARSE_ERROR
+create event e_53 on schedule every 5 second starts (select s1 from ttx) do drop table t;
+--error ER_PARSE_ERROR
+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
+#
+
drop database events_test;
| Thread |
|---|
| • bk commit into 5.1 tree (andrey:1.2225) BUG#16394 | ahristov | 29 Jun |