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:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-02-16 05:45:49 +0000
commit87bb420e43bf31021b090be98143a32042255a46 (patch)
treef68baf119ccffb6ebc64ba066af1491ddcb0f121 /tests/fixtures/optimizer/merge_subqueries.sql
parentAdding upstream version 21.0.2. (diff)
downloadsqlglot-87bb420e43bf31021b090be98143a32042255a46.tar.xz
sqlglot-87bb420e43bf31021b090be98143a32042255a46.zip
Adding upstream version 21.1.1.upstream/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 (