From 705047ac5a8350aaf2a16dd978e7371c31b503bc Mon Sep 17 00:00:00 2001 From: Henson Choi Date: Sun, 28 Jun 2026 14:21:41 +0900 Subject: [PATCH] Add EXCLUDE TIES window frame test coverage Cover the EXCLUDE TIES exclusion accounting for nth_value() and last_value() over ROWS frames, which was otherwise untested. --- src/test/regress/expected/window.out | 36 ++++++++++++++++++++++++++++ src/test/regress/sql/window.sql | 8 +++++++ 2 files changed, 44 insertions(+) diff --git a/src/test/regress/expected/window.out b/src/test/regress/expected/window.out index 90d9f953b81..dd887c6b925 100644 --- a/src/test/regress/expected/window.out +++ b/src/test/regress/expected/window.out @@ -1037,6 +1037,42 @@ FROM tenk1 WHERE unique1 < 10; 7 | 7 | 3 (10 rows) +SELECT nth_value(unique1,2) over (ORDER BY four rows between current row and 3 following exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 10; + nth_value | unique1 | four +-----------+---------+------ + 5 | 0 | 0 + 5 | 8 | 0 + 5 | 4 | 0 + 6 | 5 | 1 + 6 | 9 | 1 + 6 | 1 | 1 + 3 | 6 | 2 + 3 | 2 | 2 + | 3 | 3 + | 7 | 3 +(10 rows) + +SELECT last_value(unique1) over (ORDER BY four rows between 1 following and 2 following exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 12 ORDER BY four, unique1; + last_value | unique1 | four +------------+---------+------ + 1 | 0 | 0 + | 4 | 0 + 5 | 8 | 0 + 6 | 1 | 1 + | 5 | 1 + 10 | 9 | 1 + 3 | 2 | 2 + | 6 | 2 + 7 | 10 | 2 + | 3 | 3 + | 7 | 3 + | 11 | 3 +(12 rows) + SELECT sum(unique1) over (rows between 2 preceding and 1 preceding), unique1, four FROM tenk1 WHERE unique1 < 10; diff --git a/src/test/regress/sql/window.sql b/src/test/regress/sql/window.sql index 5ac3a486e16..31fece7fb8a 100644 --- a/src/test/regress/sql/window.sql +++ b/src/test/regress/sql/window.sql @@ -235,6 +235,14 @@ SELECT last_value(unique1) over (ORDER BY four rows between current row and 2 fo unique1, four FROM tenk1 WHERE unique1 < 10; +SELECT nth_value(unique1,2) over (ORDER BY four rows between current row and 3 following exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 10; + +SELECT last_value(unique1) over (ORDER BY four rows between 1 following and 2 following exclude ties), + unique1, four +FROM tenk1 WHERE unique1 < 12 ORDER BY four, unique1; + SELECT sum(unique1) over (rows between 2 preceding and 1 preceding), unique1, four FROM tenk1 WHERE unique1 < 10; -- 2.50.1 (Apple Git-155)