summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorMithun C Y <mithun.c.y@oracle.com>2015-08-17 15:23:47 +0530
committerMithun C Y <mithun.c.y@oracle.com>2015-08-17 15:23:47 +0530
commit557a57f3a23c486fbe12b66306ab7adffd609677 (patch)
treee3cc8becc48966c611b7a3b1ff03bc1e5da194db /sql
parentf3dce250f45b3a02a30743b2c0928f8aaf132e88 (diff)
downloadmariadb-git-557a57f3a23c486fbe12b66306ab7adffd609677.tar.gz
Bug #21350175: SUBQUERIES IN PROCEDURE CLAUSE OF SELECT STATEMENT CAUSES SERVER FAILURES.
Analysis : ========== During JOIN::prepare of sub-query which creates the derived tables we call setup_procedure. Here we call fix_fields for parameters of procedure clause. Calling setup_procedure at this point may cause issue. If sub-query is one of parameter being fixed it might lead to complicated dependencies on derived tables being prepared. SOLUTION : ========== In 5.6 with WL#6242, we have made procedure clause parameters can only be NUM, so sub-queries are not allowed as parameters. So in 5.5 we can block sub-queries in procedure clause parameters. This eliminates above conflicting dependencies.
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_yacc.yy12
1 files changed, 12 insertions, 0 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index d9a32f2dd35..991fa390e22 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -9373,8 +9373,20 @@ procedure_clause:
if (add_proc_to_list(lex->thd, item))
MYSQL_YYABORT;
Lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
+
+ /*
+ PROCEDURE CLAUSE cannot handle subquery as one of its parameter,
+ so set expr_allows_subselect as false to disallow any subqueries
+ further. Reset expr_allows_subselect back to true once the
+ parameters are reduced.
+ */
+ Lex->expr_allows_subselect= false;
}
'(' procedure_list ')'
+ {
+ /* Subqueries are allowed from now.*/
+ Lex->expr_allows_subselect= true;
+ }
;
procedure_list: