summaryrefslogtreecommitdiff
path: root/mysql-test/t/cte_nonrecursive.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/cte_nonrecursive.test')
-rw-r--r--mysql-test/t/cte_nonrecursive.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index c20a0dc1d39..ad6cb8cbf43 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -1542,4 +1542,40 @@ call sp();
drop procedure sp;
drop table t1;
+--echo #
+--echo # MDEV-25766: Unused CTE lead to a crash in
+--echo # find_field_in_tables/find_order_in_list
+--echo #
+
+create table t1 (f1 INTEGER);
+
+create view v1 as
+select
+ subq_0.c4 as c2,
+ subq_0.c4 as c4
+ from
+ (select
+ ref_0.f1 as c4
+ from
+ t1 as ref_0
+ where (select 1)
+ ) as subq_0
+ order by c2, c4 desc;
+
+WITH
+unused_with AS (select
+ subq_0.c4 as c6
+ from
+ (select
+ 11 as c4
+ from
+ v1 as ref_0
+ ) as subq_0,
+ v1 as ref_2
+)
+select 1 ;
+
+drop view v1;
+drop table t1;
+
--echo # End of 10.2 tests