diff options
author | Igor Babaev <igor@askmonty.org> | 2021-07-16 22:46:50 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2021-07-19 10:35:23 -0700 |
commit | f053349797a1dca5206a3b8d5ff33353f45430d8 (patch) | |
tree | d4b1b15af1198f499be889c9ec293b2f459fbcec /mysql-test/r | |
parent | b7886f55eb707c4cf7d8a5d94e79a87909f153e7 (diff) | |
download | mariadb-git-f053349797a1dca5206a3b8d5ff33353f45430d8.tar.gz |
MDEV-26135 Assertion failure when executing PS with a hanging recursive CTE
The bug affected execution of queries with With clauses containing so-called
hanging recursive CTEs in PREPARE mode. A CTE is hanging if it's not used
in the query. Preparation of a prepared statement from a query with a
hanging CTE caused a leak in the server and execution of this prepared
statement led to an assert failure of the server built in the debug mode.
This happened because the units specifying recursive CTEs erroneously were
not cleaned up if those CTEs were hanging.
The patch enforces cleanup of hanging recursive CTEs in the same way as
other hanging CTEs.
Approved by dmitry.shulga@mariadb.com
Diffstat (limited to 'mysql-test/r')
-rw-r--r-- | mysql-test/r/cte_recursive.result | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result index 3e926525e99..a4d821ed1a0 100644 --- a/mysql-test/r/cte_recursive.result +++ b/mysql-test/r/cte_recursive.result @@ -4454,5 +4454,32 @@ deallocate prepare stmt; drop table folks; set big_tables=@save_big_tables; # +# MDEV-26135: execution of PS for query with hanging recursive CTE +# +create table t1 (a int); +insert into t1 values (5), (7); +create table t2 (b int); +insert into t2 values (3), (7), (1); +with recursive r as (select a from t1 union select a+1 from r where a < 10) +select * from t2; +b +3 +7 +1 +prepare stmt from "with recursive r as (select a from t1 union select a+1 from r where a < 10) +select * from t2"; +execute stmt; +b +3 +7 +1 +execute stmt; +b +3 +7 +1 +deallocate prepare stmt; +drop table t1,t2; +# # End of 10.2 tests # |