diff options
author | Igor Babaev <igor@askmonty.org> | 2016-09-24 20:29:56 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2016-09-24 21:05:36 -0700 |
commit | 61ab7333db3b2dcc0e2b7d5b44c0692a6b0c3e8a (patch) | |
tree | d7c966755b72d49a80d909107e542f0e2e9a3f81 /mysql-test/r | |
parent | 018ac121cff32b72f782027688cc2d3e81c5664c (diff) | |
download | mariadb-git-61ab7333db3b2dcc0e2b7d5b44c0692a6b0c3e8a.tar.gz |
Fixed bug mdev-10883.
When a prepared statement uses a CTE definition with a column list
renaming of columns of the CTE expression must be performed
for every execution of the prepared statement.
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/cte_recursive.result | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result index 1aa469029dd..7285ef2f7f7 100644 --- a/mysql-test/r/cte_recursive.result +++ b/mysql-test/r/cte_recursive.result @@ -1604,6 +1604,35 @@ id name dob father mother 8 Grandpa Ben 1940-10-21 NULL NULL 6 Grandgrandma Martha 1923-05-17 NULL NULL drop table my_ancestors; +# +# MDEV-10883: execution of prepared statement from SELECT +# with recursive CTE that renames columns +# +prepare stmt from" +with recursive +ancestor_ids (id) +as +( + select father from folks where name = 'Me' + union + select mother from folks where name = 'Me' + union + select father from folks, ancestor_ids a where folks.id = a.id + union + select mother from folks, ancestor_ids a where folks.id = a.id +) +select p.* from folks as p, ancestor_ids as a where p.id = a.id; +"; +execute stmt; +id name dob father mother +20 Dad 1970-02-02 10 9 +30 Mom 1975-03-03 8 7 +10 Grandpa Bill 1940-04-05 NULL NULL +9 Grandma Ann 1941-10-15 NULL NULL +7 Grandma Sally 1943-08-23 NULL 6 +8 Grandpa Ben 1940-10-21 NULL NULL +6 Grandgrandma Martha 1923-05-17 NULL NULL +deallocate prepare stmt; drop table folks; # # MDEV-10372: [bb-10.2-mdev9864 tree] EXPLAIN with recursive CTE enters endless recursion |