Commit c1eaa385 authored by Oleksandr Byelkin's avatar Oleksandr Byelkin

MDEV-21616: Server crash when using "SET STATEMENT max_statement_time=0 FOR...

MDEV-21616: Server crash when using "SET STATEMENT max_statement_time=0 FOR desc xxx" lead to collapse

Main select should be pushed first.
parent 2acc6f2d
...@@ -1797,4 +1797,14 @@ select * from t2; ...@@ -1797,4 +1797,14 @@ select * from t2;
ERROR HY000: Table 't2' was not locked with LOCK TABLES ERROR HY000: Table 't2' was not locked with LOCK TABLES
SET STATEMENT max_statement_time=900 FOR unlock tables; SET STATEMENT max_statement_time=900 FOR unlock tables;
drop table t1, t2; drop table t1, t2;
#
# MDEV-21616: Server crash when using
# "SET STATEMENT max_statement_time=0 FOR desc xxx" lead to collapse
#
create table t1 (a int);
SET STATEMENT max_statement_time=0 FOR desc t1;
Field Type Null Key Default Extra
a int(11) YES NULL
drop table t1;
SET STATEMENT max_statement_time=0 FOR do 1;
# End of 10.4 tests # End of 10.4 tests
...@@ -1565,4 +1565,14 @@ select * from t2; ...@@ -1565,4 +1565,14 @@ select * from t2;
SET STATEMENT max_statement_time=900 FOR unlock tables; SET STATEMENT max_statement_time=900 FOR unlock tables;
drop table t1, t2; drop table t1, t2;
--echo #
--echo # MDEV-21616: Server crash when using
--echo # "SET STATEMENT max_statement_time=0 FOR desc xxx" lead to collapse
--echo #
create table t1 (a int);
SET STATEMENT max_statement_time=0 FOR desc t1;
drop table t1;
SET STATEMENT max_statement_time=0 FOR do 1;
--echo # End of 10.4 tests --echo # End of 10.4 tests
...@@ -13253,11 +13253,14 @@ do: ...@@ -13253,11 +13253,14 @@ do:
{ {
LEX *lex=Lex; LEX *lex=Lex;
lex->sql_command = SQLCOM_DO; lex->sql_command = SQLCOM_DO;
if (lex->main_select_push())
MYSQL_YYABORT;
mysql_init_select(lex); mysql_init_select(lex);
} }
expr_list expr_list
{ {
Lex->insert_list= $3; Lex->insert_list= $3;
Lex->pop_select(); //main select
} }
; ;
...@@ -14552,6 +14555,8 @@ describe: ...@@ -14552,6 +14555,8 @@ describe:
describe_command table_ident describe_command table_ident
{ {
LEX *lex= Lex; LEX *lex= Lex;
if (lex->main_select_push())
MYSQL_YYABORT;
mysql_init_select(lex); mysql_init_select(lex);
lex->current_select->parsing_place= SELECT_LIST; lex->current_select->parsing_place= SELECT_LIST;
lex->sql_command= SQLCOM_SHOW_FIELDS; lex->sql_command= SQLCOM_SHOW_FIELDS;
...@@ -14563,6 +14568,7 @@ describe: ...@@ -14563,6 +14568,7 @@ describe:
opt_describe_column opt_describe_column
{ {
Select->parsing_place= NO_MATTER; Select->parsing_place= NO_MATTER;
Lex->pop_select(); //main select
} }
| describe_command opt_extended_describe | describe_command opt_extended_describe
{ Lex->describe|= DESCRIBE_NORMAL; } { Lex->describe|= DESCRIBE_NORMAL; }
......
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