Commit 593afb6a authored by unknown's avatar unknown

Bug#28553 mysqld crash in "purge master log before(select time from information_schema)"

forbid the use of subselect in PURGE LOGS BEFORE command


mysql-test/r/subselect.result:
  test result
mysql-test/t/subselect.test:
  test case
sql/sql_yacc.yy:
  forbid the use of subselect in PURGE LOGS BEFORE command
parent e5b2adea
......@@ -2834,6 +2834,8 @@ a
4
DROP TABLE t1,t2,t3;
purge master logs before (select adddate(current_timestamp(), interval -4 day));
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 adddate(current_timestamp(), interval -4 day))' at line 1
purge master logs before adddate(current_timestamp(), interval -4 day);
CREATE TABLE t1 (f1 INT);
CREATE TABLE t2 (f2 INT);
INSERT INTO t1 VALUES (1);
......
......@@ -1815,11 +1815,12 @@ SELECT * FROM t1
DROP TABLE t1,t2,t3;
#
# BUG #10308: purge log with subselect
# BUG#10308: purge log with subselect
# Bug#28553: mysqld crash in "purge master log before(select time from information_schema)"
#
--error 1064
purge master logs before (select adddate(current_timestamp(), interval -4 day));
purge master logs before adddate(current_timestamp(), interval -4 day);
#
# Bug#18503: Queries with a quantified subquery returning empty set may
......
......@@ -3567,7 +3567,8 @@ select_derived2:
LEX *lex= Lex;
lex->derived_tables= 1;
if (lex->sql_command == (int)SQLCOM_HA_READ ||
lex->sql_command == (int)SQLCOM_KILL)
lex->sql_command == (int)SQLCOM_KILL ||
lex->sql_command == (int)SQLCOM_PURGE)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
......@@ -4748,6 +4749,7 @@ purge:
{
LEX *lex=Lex;
lex->type=0;
lex->sql_command = SQLCOM_PURGE;
} purge_options
{}
;
......@@ -4759,7 +4761,6 @@ purge_options:
purge_option:
TO_SYM TEXT_STRING_sys
{
Lex->sql_command = SQLCOM_PURGE;
Lex->to_log = $2.str;
}
| BEFORE_SYM expr
......@@ -6212,7 +6213,8 @@ subselect_start:
{
LEX *lex=Lex;
if (lex->sql_command == (int)SQLCOM_HA_READ ||
lex->sql_command == (int)SQLCOM_KILL)
lex->sql_command == (int)SQLCOM_KILL ||
lex->sql_command == (int)SQLCOM_PURGE)
{
yyerror(ER(ER_SYNTAX_ERROR));
YYABORT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment