summaryrefslogtreecommitdiffstats
path: root/tests/fixtures/optimizer/merge_subqueries.sql
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-16 05:45:52 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-16 05:45:52 +0000
commit3d48060515ba25b4c49d975a520ee0682327d1b7 (patch)
treee8730f509026e866d77c459f74a384505425363a /tests/fixtures/optimizer/merge_subqueries.sql
parentReleasing debian version 21.0.2-1. (diff)
downloadsqlglot-3d48060515ba25b4c49d975a520ee0682327d1b7.tar.xz
sqlglot-3d48060515ba25b4c49d975a520ee0682327d1b7.zip
Merging upstream version 21.1.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/fixtures/optimizer/merge_subqueries.sql')
-rw-r--r--tests/fixtures/optimizer/merge_subqueries.sql6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/fixtures/optimizer/merge_subqueries.sql b/tests/fixtures/optimizer/merge_subqueries.sql
index 7bc45a7..0f22925 100644
--- a/tests/fixtures/optimizer/merge_subqueries.sql
+++ b/tests/fixtures/optimizer/merge_subqueries.sql
@@ -218,6 +218,7 @@ with t1 as (
ROW_NUMBER() OVER (PARTITION BY x.a ORDER BY x.a) as row_num
FROM
x
+ ORDER BY x.a, x.b, row_num
)
SELECT
t1.a,
@@ -226,7 +227,7 @@ FROM
t1
WHERE
row_num = 1;
-WITH t1 AS (SELECT x.a AS a, x.b AS b, ROW_NUMBER() OVER (PARTITION BY x.a ORDER BY x.a) AS row_num FROM x AS x) SELECT t1.a AS a, t1.b AS b FROM t1 AS t1 WHERE t1.row_num = 1;
+WITH t1 AS (SELECT x.a AS a, x.b AS b, ROW_NUMBER() OVER (PARTITION BY x.a ORDER BY x.a) AS row_num FROM x AS x ORDER BY x.a, x.b, row_num) SELECT t1.a AS a, t1.b AS b FROM t1 AS t1 WHERE t1.row_num = 1;
# title: Test preventing merge of window expressions join clause
with t1 as (
@@ -301,6 +302,7 @@ with t1 as (
ROW_NUMBER() OVER (PARTITION BY x.a ORDER BY x.a) as row_num
FROM
x
+ ORDER BY x.a, x.b, row_num
)
SELECT
t1.a,
@@ -308,7 +310,7 @@ SELECT
t1.row_num
FROM
t1;
-SELECT x.a AS a, x.b AS b, ROW_NUMBER() OVER (PARTITION BY x.a ORDER BY x.a) AS row_num FROM x AS x;
+SELECT x.a AS a, x.b AS b, ROW_NUMBER() OVER (PARTITION BY x.a ORDER BY x.a) AS row_num FROM x AS x ORDER BY x.a, x.b, row_num;
# title: Don't merge window functions, inner table is aliased in outer query
with t1 as (