From 918abde014f9e5c75dfbe21110c379f7f70435c9 Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Sun, 12 Feb 2023 11:06:28 +0100
Subject: Merging upstream version 11.0.1.

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

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

diff --git a/tests/fixtures/optimizer/expand_laterals.sql b/tests/fixtures/optimizer/expand_laterals.sql
new file mode 100644
index 0000000..09bbd0f
--- /dev/null
+++ b/tests/fixtures/optimizer/expand_laterals.sql
@@ -0,0 +1,40 @@
+# title: expand alias reference
+SELECT
+  x.a + 1 AS i,
+  i + 1 AS j,
+  j + 1 AS k
+FROM x;
+SELECT
+  x.a + 1 AS i,
+  x.a + 1 + 1 AS j,
+  x.a + 1 + 1 + 1 AS k
+FROM x;
+
+# title: noop - reference comes before alias
+SELECT
+  b + 1 AS j,
+  x.a + 1 AS i
+FROM x;
+SELECT
+  b + 1 AS j,
+  x.a + 1 AS i
+FROM x;
+
+
+# title: subquery
+SELECT
+  *
+FROM (
+  SELECT
+    x.a + 1 AS i,
+    i + 1 AS j
+  FROM x
+);
+SELECT
+  *
+FROM (
+  SELECT
+    x.a + 1 AS i,
+    x.a + 1 + 1 AS j
+  FROM x
+);
-- 
cgit v1.2.3

