mirror of
https://github.com/MariaDB/server.git
synced 2025-12-24 11:21:21 +03:00
MDEV-10779 Failing assertion lex->proc_list.elements == 0 or syntax error on PROCEDURE ANALYSE in UNION
Reverting a part of the patch for "MDEV-8909union parser cleanup", as a parenthesized SELECT with PROCEDURE followed by UNION is not disallowed by the grammar (only a non-parenthesized SELECT with PROCEDURE followed by a UNION is disallowed grammatically).
This commit is contained in:
@@ -7485,8 +7485,22 @@ mysql_new_select(LEX *lex, bool move_down)
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
// SELECT 1 FROM t1 PROCEDURE ANALYSE() UNION ... -- not possible
|
||||
DBUG_ASSERT(lex->proc_list.elements == 0);
|
||||
/*
|
||||
This type of query is not possible in the grammar:
|
||||
SELECT 1 FROM t1 PROCEDURE ANALYSE() UNION ... ;
|
||||
|
||||
But this type of query is still possible:
|
||||
(SELECT 1 FROM t1 PROCEDURE ANALYSE()) UNION ... ;
|
||||
and it's not easy to disallow this grammatically,
|
||||
because there can be any parenthesis nest level:
|
||||
(((SELECT 1 FROM t1 PROCEDURE ANALYSE()))) UNION ... ;
|
||||
*/
|
||||
if (lex->proc_list.elements!=0)
|
||||
{
|
||||
my_error(ER_WRONG_USAGE, MYF(0), "UNION",
|
||||
"SELECT ... PROCEDURE ANALYSE()");
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
// SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 -- not possible
|
||||
DBUG_ASSERT(!lex->current_select->order_list.first ||
|
||||
lex->current_select->braces);
|
||||
|
||||
Reference in New Issue
Block a user