From 948a422be120c069e48c63a8770fec7204307897 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Tue, 19 Dec 2023 12:01:36 +0100
Subject: Adding upstream version 20.3.0.

Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
---
 tests/fixtures/optimizer/merge_subqueries.sql | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

(limited to 'tests/fixtures/optimizer/merge_subqueries.sql')

diff --git a/tests/fixtures/optimizer/merge_subqueries.sql b/tests/fixtures/optimizer/merge_subqueries.sql
index eec8a73..7fc4b25 100644
--- a/tests/fixtures/optimizer/merge_subqueries.sql
+++ b/tests/fixtures/optimizer/merge_subqueries.sql
@@ -411,3 +411,20 @@ FROM (
       ON _q_0.a = y.b
 );
 SELECT y.b AS b FROM (x AS x JOIN y AS y ON x.a = y.b);
+
+# title: merge cte into subquery with overlapping alias
+WITH q AS (
+  SELECT
+    y.b AS a
+  FROM y AS y
+)
+SELECT
+  q.a AS a
+FROM x AS q
+WHERE
+  q.a IN (
+    SELECT
+      q.a AS a
+    FROM q AS q
+  );
+SELECT q.a AS a FROM x AS q WHERE q.a IN (SELECT y.b AS a FROM y AS y);
\ No newline at end of file
-- 
cgit v1.2.3

