[Commits] c164835: MDEV-26202 Unexpected failure with query using indirectly a recursive CTE twice

IgorBabaev igor at mariadb.com
Fri Jul 23 03:07:17 EEST 2021


revision-id: c164835a45ae3fea59eb49ff0cb00fbfbccc12d0 (mariadb-10.2.31-1075-gc164835)
parent(s): 4aeb2b1c6c542e09be2474644358038279197529
author: Igor Babaev
committer: Igor Babaev
timestamp: 2021-07-22 17:07:17 -0700
message:

MDEV-26202 Unexpected failure with query using indirectly a recursive CTE twice

This bug was fixed by the patch for bug MDEV-26025.
Only a new test case is added here.

---
 mysql-test/r/cte_recursive.result | 22 ++++++++++++++++++++++
 mysql-test/t/cte_recursive.test   | 14 ++++++++++++++
 2 files changed, 36 insertions(+)

diff --git a/mysql-test/r/cte_recursive.result b/mysql-test/r/cte_recursive.result
index 1b1fd8b..168777f 100644
--- a/mysql-test/r/cte_recursive.result
+++ b/mysql-test/r/cte_recursive.result
@@ -4519,5 +4519,27 @@ drop procedure sp1;
 drop procedure sp2;
 drop table t1;
 #
+# MDEV-26202: Recursive CTE used indirectly twice
+# (fixed by the patch forMDEV-26025)
+#
+with recursive
+rcte as ( SELECT 1 AS a
+UNION ALL
+SELECT cast(a + 1 as unsigned int) FROM rcte WHERE a < 3),
+cte1 AS (SELECT a FROM rcte),
+cte2 AS (SELECT a FROM cte1),
+cte3 AS ( SELECT a FROM  cte2)
+SELECT * FROM cte2, cte3;
+a	a
+1	1
+2	1
+3	1
+1	2
+2	2
+3	2
+1	3
+2	3
+3	3
+#
 # End of 10.2 tests
 #
diff --git a/mysql-test/t/cte_recursive.test b/mysql-test/t/cte_recursive.test
index cdd3a07..3c845f9 100644
--- a/mysql-test/t/cte_recursive.test
+++ b/mysql-test/t/cte_recursive.test
@@ -2885,5 +2885,19 @@ drop procedure sp2;
 drop table t1;
 
 --echo #
+--echo # MDEV-26202: Recursive CTE used indirectly twice
+--echo # (fixed by the patch forMDEV-26025)
+--echo #
+
+with recursive
+  rcte as ( SELECT 1 AS a
+            UNION ALL
+            SELECT cast(a + 1 as unsigned int) FROM rcte WHERE a < 3),
+  cte1 AS (SELECT a FROM rcte),
+  cte2 AS (SELECT a FROM cte1),
+  cte3 AS ( SELECT a FROM  cte2)
+SELECT * FROM cte2, cte3;
+
+--echo #
 --echo # End of 10.2 tests
 --echo #


More information about the commits mailing list