File tree Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Expand file tree Collapse file tree 3 files changed +54
-0
lines changed Original file line number Diff line number Diff line change @@ -1604,6 +1604,35 @@ id name dob father mother
1604
1604
8 Grandpa Ben 1940-10-21 NULL NULL
1605
1605
6 Grandgrandma Martha 1923-05-17 NULL NULL
1606
1606
drop table my_ancestors;
1607
+ #
1608
+ # MDEV-10883: execution of prepared statement from SELECT
1609
+ # with recursive CTE that renames columns
1610
+ #
1611
+ prepare stmt from"
1612
+ with recursive
1613
+ ancestor_ids (id)
1614
+ as
1615
+ (
1616
+ select father from folks where name = 'Me'
1617
+ union
1618
+ select mother from folks where name = 'Me'
1619
+ union
1620
+ select father from folks, ancestor_ids a where folks.id = a.id
1621
+ union
1622
+ select mother from folks, ancestor_ids a where folks.id = a.id
1623
+ )
1624
+ select p.* from folks as p, ancestor_ids as a where p.id = a.id;
1625
+ ";
1626
+ execute stmt;
1627
+ id name dob father mother
1628
+ 20 Dad 1970-02-02 10 9
1629
+ 30 Mom 1975-03-03 8 7
1630
+ 10 Grandpa Bill 1940-04-05 NULL NULL
1631
+ 9 Grandma Ann 1941-10-15 NULL NULL
1632
+ 7 Grandma Sally 1943-08-23 NULL 6
1633
+ 8 Grandpa Ben 1940-10-21 NULL NULL
1634
+ 6 Grandgrandma Martha 1923-05-17 NULL NULL
1635
+ deallocate prepare stmt;
1607
1636
drop table folks;
1608
1637
#
1609
1638
# MDEV-10372: [bb-10.2-mdev9864 tree] EXPLAIN with recursive CTE enters endless recursion
Original file line number Diff line number Diff line change @@ -1200,6 +1200,30 @@ select * from my_ancestors;
1200
1200
1201
1201
drop table my_ancestors;
1202
1202
1203
+ --echo #
1204
+ --echo # MDEV-10883: execution of prepared statement from SELECT
1205
+ --echo # with recursive CTE that renames columns
1206
+ --echo #
1207
+
1208
+ prepare stmt from"
1209
+ with recursive
1210
+ ancestor_ids (id)
1211
+ as
1212
+ (
1213
+ select father from folks where name = 'Me'
1214
+ union
1215
+ select mother from folks where name = 'Me'
1216
+ union
1217
+ select father from folks, ancestor_ids a where folks.id = a.id
1218
+ union
1219
+ select mother from folks, ancestor_ids a where folks.id = a.id
1220
+ )
1221
+ select p.* from folks as p, ancestor_ids as a where p.id = a.id;
1222
+ ";
1223
+ execute stmt;
1224
+ deallocate prepare stmt;
1225
+
1226
+
1203
1227
drop table folks;
1204
1228
1205
1229
--echo #
Original file line number Diff line number Diff line change @@ -350,6 +350,7 @@ void With_element::reset_recursive_for_exec()
350
350
owner->with_prepared_anchor &= ~mutually_recursive;
351
351
owner->cleaned &= ~get_elem_map ();
352
352
cleanup_stabilized ();
353
+ spec->columns_are_renamed = false ;
353
354
}
354
355
355
356
You can’t perform that action at this time.
0 commit comments