mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-4752: Segfault during parsing of illegal query
Fix of nested join parsing of illegal query.
This commit is contained in:
@ -1472,4 +1472,9 @@ dog_id dog_id birthday dog_id t_id birthday dog_id t_id birthday a_id dog_id
|
|||||||
5918 5918 2004-07-22 5918 N 2004-07-22 5918 N 2004-07-22 5992424 5918
|
5918 5918 2004-07-22 5918 N 2004-07-22 5918 N 2004-07-22 5992424 5918
|
||||||
SET optimizer_switch=@tmp_optimizer_switch;
|
SET optimizer_switch=@tmp_optimizer_switch;
|
||||||
DROP TABLE t1,t2,t3,t4,t5;
|
DROP TABLE t1,t2,t3,t4,t5;
|
||||||
|
#
|
||||||
|
# MDEV-4752: Segfault during parsing of illegal query
|
||||||
|
#
|
||||||
|
SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);
|
||||||
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
|
||||||
SET optimizer_switch=@save_optimizer_switch;
|
SET optimizer_switch=@save_optimizer_switch;
|
||||||
|
@ -1135,4 +1135,11 @@ SET optimizer_switch=@tmp_optimizer_switch;
|
|||||||
|
|
||||||
DROP TABLE t1,t2,t3,t4,t5;
|
DROP TABLE t1,t2,t3,t4,t5;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-4752: Segfault during parsing of illegal query
|
||||||
|
--echo #
|
||||||
|
--error ER_PARSE_ERROR
|
||||||
|
SELECT * FROM t5 JOIN (t1 JOIN t2 UNION SELECT * FROM t3 JOIN t4);
|
||||||
|
|
||||||
|
|
||||||
SET optimizer_switch=@save_optimizer_switch;
|
SET optimizer_switch=@save_optimizer_switch;
|
||||||
|
@ -6276,6 +6276,8 @@ TABLE_LIST *st_select_lex::nest_last_join(THD *thd)
|
|||||||
for (uint i=0; i < 2; i++)
|
for (uint i=0; i < 2; i++)
|
||||||
{
|
{
|
||||||
TABLE_LIST *table= join_list->pop();
|
TABLE_LIST *table= join_list->pop();
|
||||||
|
if (!table)
|
||||||
|
DBUG_RETURN(NULL);
|
||||||
table->join_list= embedded_list;
|
table->join_list= embedded_list;
|
||||||
table->embedding= ptr;
|
table->embedding= ptr;
|
||||||
embedded_list->push_back(table);
|
embedded_list->push_back(table);
|
||||||
|
@ -9600,7 +9600,10 @@ table_ref:
|
|||||||
{
|
{
|
||||||
LEX *lex= Lex;
|
LEX *lex= Lex;
|
||||||
if (!($$= lex->current_select->nest_last_join(lex->thd)))
|
if (!($$= lex->current_select->nest_last_join(lex->thd)))
|
||||||
|
{
|
||||||
|
my_parse_error(ER(ER_SYNTAX_ERROR));
|
||||||
MYSQL_YYABORT;
|
MYSQL_YYABORT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user