summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2016-09-13 12:10:53 -0700
committerIgor Babaev <igor@askmonty.org>2016-09-13 12:10:53 -0700
commit61d46e0423c61ff2fd1eedd707924193006cdedd (patch)
tree247f50ee637ede28d9109d2623115c5ae26404bf /sql
parent08ba474174c6d8eb8668488110e3949cb82c50d7 (diff)
parenta0db19bed9e792314a3a7d4ebc996c76270d5797 (diff)
downloadmariadb-git-61d46e0423c61ff2fd1eedd707924193006cdedd.tar.gz
Merge branch '10.2' of github.com:MariaDB/server into 10.2
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_parse.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 6baff31537a..266c6119f13 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -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);