diff options
author | Igor Babaev <igor@askmonty.org> | 2016-09-24 21:04:54 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2016-09-24 21:05:36 -0700 |
commit | 54efb080227cf3f79efb7ab2660bf66582cd07fd (patch) | |
tree | 91ffd40d0258b8143b6c1f42bc68221787ebe41f /mysql-test/t/cte_recursive.test | |
parent | 61ab7333db3b2dcc0e2b7d5b44c0692a6b0c3e8a (diff) | |
download | mariadb-git-54efb080227cf3f79efb7ab2660bf66582cd07fd.tar.gz |
Fixed bug mdev-10881
The server missed to call check_dependencies_in_with_clauses()
when processing PREPARE ... FROM CREATE ... SELECT / INSERT ... SELECT
with WITH clause before SELECT.
Diffstat (limited to 'mysql-test/t/cte_recursive.test')
-rw-r--r-- | mysql-test/t/cte_recursive.test | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test index ef0ed5c48f0..1fc27ff4999 100644 --- a/mysql-test/t/cte_recursive.test +++ b/mysql-test/t/cte_recursive.test @@ -1223,6 +1223,54 @@ select p.* from folks as p, ancestor_ids as a where p.id = a.id; execute stmt; deallocate prepare stmt; +--echo # +--echo # MDEV-10881: execution of prepared statement from +--echo # CREATE ... SELECT, INSERT ... SELECT +--echo # + +prepare stmt from" +create table my_ancestors +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; +deallocate prepare stmt; +select * from my_ancestors; + +delete from my_ancestors; + +prepare stmt from" +insert into my_ancestors +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; +deallocate prepare stmt; +select * from my_ancestors; + +drop table my_ancestors; drop table folks; |