diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2015-08-18 13:28:17 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2015-09-14 16:20:14 +0200 |
commit | 4430d555a34b8471fde9615dc2f8c301f319f65e (patch) | |
tree | 34f71c80e71468e54beec17f97a5b7d647133bd8 /sql/sql_parse.cc | |
parent | 5fe8b747e9e3440f2f746accca0eb11e287a6713 (diff) | |
download | mariadb-git-mdev-8380.tar.gz |
MDEV-8380: Subquery parse errormdev-8380
backport mysql parser fixes
0034963fbf199696792491bcb79d5f0731c98804
5948561812bc691bd0c13cf518a3fe77d9daf920
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r-- | sql/sql_parse.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 5e58ceb9621..f7eed09c789 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -6932,11 +6932,28 @@ mysql_new_select(LEX *lex, bool move_down) } else { + bool const outer_most= (lex->current_select->master_unit() == &lex->unit); + if (outer_most && lex->result) + { + my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO"); + DBUG_RETURN(TRUE); + } + if (lex->proc_list.elements!=0) + { + my_error(ER_WRONG_USAGE, MYF(0), "UNION", + "SELECT ... PROCEDURE ANALYSE()"); + DBUG_RETURN(TRUE); + } if (lex->current_select->order_list.first && !lex->current_select->braces) { my_error(ER_WRONG_USAGE, MYF(0), "UNION", "ORDER BY"); DBUG_RETURN(1); } + if (lex->current_select->explicit_limit && !lex->current_select->braces) + { + my_error(ER_WRONG_USAGE, MYF(0), "UNION", "LIMIT"); + DBUG_RETURN(1); + } select_lex->include_neighbour(lex->current_select); SELECT_LEX_UNIT *unit= select_lex->master_unit(); if (!unit->fake_select_lex && unit->add_fake_select_lex(lex->thd)) |