From f818ab3b896d52e874634b7c4db3533078c1887f Mon Sep 17 00:00:00 2001
From: Daniel Baumann <daniel.baumann@progress-linux.org>
Date: Mon, 10 Oct 2022 13:29:05 +0200
Subject: Merging upstream version 6.3.1.

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

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

diff --git a/tests/fixtures/optimizer/qualify_columns__with_invisible.sql b/tests/fixtures/optimizer/qualify_columns__with_invisible.sql
new file mode 100644
index 0000000..ee46c23
--- /dev/null
+++ b/tests/fixtures/optimizer/qualify_columns__with_invisible.sql
@@ -0,0 +1,35 @@
+--------------------------------------
+-- Qualify columns
+--------------------------------------
+SELECT a FROM x;
+SELECT x.a AS a FROM x AS x;
+
+SELECT b FROM x;
+SELECT x.b AS b FROM x AS x;
+
+--------------------------------------
+-- Derived tables
+--------------------------------------
+SELECT x.a FROM x AS x JOIN (SELECT * FROM x);
+SELECT x.a AS a FROM x AS x JOIN (SELECT x.a AS a FROM x AS x) AS "_q_0";
+
+SELECT x.b FROM x AS x JOIN (SELECT b FROM x);
+SELECT x.b AS b FROM x AS x JOIN (SELECT x.b AS b FROM x AS x) AS "_q_0";
+
+--------------------------------------
+-- Expand *
+--------------------------------------
+SELECT * FROM x;
+SELECT x.a AS a FROM x AS x;
+
+SELECT * FROM y JOIN z ON y.b = z.b;
+SELECT y.b AS b, z.b AS b FROM y AS y JOIN z AS z ON y.b = z.b;
+
+SELECT * FROM y JOIN z ON y.c = z.c;
+SELECT y.b AS b, z.b AS b FROM y AS y JOIN z AS z ON y.c = z.c;
+
+SELECT a FROM (SELECT * FROM x);
+SELECT "_q_0".a AS a FROM (SELECT x.a AS a FROM x AS x) AS "_q_0";
+
+SELECT * FROM (SELECT a FROM x);
+SELECT "_q_0".a AS a FROM (SELECT x.a AS a FROM x AS x) AS "_q_0";
-- 
cgit v1.2.3

