diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-24 08:03:45 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-07-24 08:03:45 +0000 |
commit | ca57dc468e5d8d0920e964d45ad25271ae6e633d (patch) | |
tree | 319d8bffcb5c3e9afe9e62beca9ef401480578d2 /tests/fixtures/optimizer/merge_subqueries.sql | |
parent | Adding upstream version 17.4.1. (diff) | |
download | sqlglot-ca57dc468e5d8d0920e964d45ad25271ae6e633d.tar.xz sqlglot-ca57dc468e5d8d0920e964d45ad25271ae6e633d.zip |
Adding upstream version 17.7.0.upstream/17.7.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/fixtures/optimizer/merge_subqueries.sql | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/fixtures/optimizer/merge_subqueries.sql b/tests/fixtures/optimizer/merge_subqueries.sql index fb69ea7..b89e2fb 100644 --- a/tests/fixtures/optimizer/merge_subqueries.sql +++ b/tests/fixtures/optimizer/merge_subqueries.sql @@ -372,3 +372,27 @@ FROM x AS x LEFT JOIN i AS i ON x.a = i.a; WITH i AS (SELECT x.a AS a FROM y AS y JOIN x AS x ON y.b = x.b) SELECT x.a AS a FROM x AS x LEFT JOIN i AS i ON x.a = i.a; + +# title: Outer scope selects from wrapped table with a join (unknown schema) +# execute: false +WITH _q_0 AS (SELECT t1.c AS c FROM t1 AS t1) SELECT * FROM (_q_0 AS _q_0 CROSS JOIN t2 AS t2); +WITH _q_0 AS (SELECT t1.c AS c FROM t1 AS t1) SELECT * FROM (_q_0 AS _q_0 CROSS JOIN t2 AS t2); + +# title: Outer scope selects single column from wrapped table with a join +WITH _q_0 AS ( + SELECT + x.a AS a + FROM x AS x +), y_2 AS ( + SELECT + y.b AS b + FROM y AS y +) +SELECT + y.b AS b +FROM ( + _q_0 AS _q_0 + JOIN y_2 AS y + ON _q_0.a = y.b +); +SELECT y.b AS b FROM (x AS x JOIN y AS y ON x.a = y.b); |