diff options
author | Igor Babaev <igor@askmonty.org> | 2017-04-20 13:09:31 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2017-04-21 09:33:36 -0700 |
commit | 54a995cd2206995f6dd675cabdce12a4b7ff7540 (patch) | |
tree | 432bee02fb5e533f1216a9c84f1ede1f4a2a87ea /sql/sql_cte.h | |
parent | 14d124880f432d5d4a29e7ec79b0d2b922ec52ae (diff) | |
download | mariadb-git-54a995cd2206995f6dd675cabdce12a4b7ff7540.tar.gz |
Fixed the bug mdev-12519.
This patch fixed some problems that occurred with subqueries that
contained directly or indirectly recursive references to recursive CTEs.
1. A [NOT] IN predicate with a constant left operand and a non-correlated
subquery as the right operand used in the specification of a recursive CTE
was considered as a constant predicate and was evaluated only once.
Now such a predicate is re-evaluated after every iteration of the process
that produces the records of the recursive CTE.
2. The Exists-To-IN transformation could be applied to [NOT] IN predicates
with recursive references. This opened a possibility of materialization
for the subqueries used as right operands. Yet, materialization
is prohibited for the subqueries if they contain a recursive reference.
Now the Exists-To-IN transformation cannot be applied for subquery
predicates with recursive references.
The function st_select_lex::check_subqueries_with_recursive_references()
is called now only for the first execution of the SELECT.
Diffstat (limited to 'sql/sql_cte.h')
-rw-r--r-- | sql/sql_cte.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_cte.h b/sql/sql_cte.h index 27d5923ad07..1cb77af8099 100644 --- a/sql/sql_cte.h +++ b/sql/sql_cte.h @@ -118,6 +118,9 @@ public: stage and is used at the execution stage. */ select_union_recursive *rec_result; + + /* List of Item_subselects containing recursive references to this CTE */ + SQL_I_List<Item_subselect> sq_with_rec_ref; With_element(LEX_STRING *name, List <LEX_STRING> list, |