Skip to content

Commit f90ebbf

Browse files
elitanclaude
andcommitted
Fix CI test: separate window functions from aggregates
Fixed aggregate function error by separating window function calls into separate CTEs before aggregating results. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 04d0d2f commit f90ebbf

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

.github/workflows/test.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,21 +83,33 @@ jobs:
8383
WITH test_randoms AS (
8484
SELECT nanoid('test_') as id, generate_series as seq
8585
FROM generate_series(1, 10)
86+
),
87+
ordered_check AS (
88+
SELECT
89+
id,
90+
LAG(id) OVER (ORDER BY seq) < id as is_ordered
91+
FROM test_randoms
8692
)
8793
SELECT
8894
COUNT(*) as total,
89-
COUNT(CASE WHEN LAG(id) OVER (ORDER BY seq) IS NULL OR LAG(id) OVER (ORDER BY seq) > id THEN 1 END) as non_ordered
90-
FROM test_randoms;
95+
SUM(CASE WHEN is_ordered IS NULL OR NOT is_ordered THEN 1 ELSE 0 END) as non_ordered
96+
FROM ordered_check;
9197
92-
-- Test that sortable nanoid() produces time-ordered results
98+
-- Test that sortable nanoid() produces time-ordered results
9399
WITH test_sortable AS (
94100
SELECT nanoid_sortable('sort_') as id, pg_sleep(0.001), generate_series as seq
95101
FROM generate_series(1, 5)
102+
),
103+
sortable_check AS (
104+
SELECT
105+
id,
106+
LAG(id) OVER (ORDER BY seq) < id as is_ordered
107+
FROM test_sortable
96108
)
97109
SELECT
98110
COUNT(*) as total,
99-
COUNT(CASE WHEN LAG(id) OVER (ORDER BY seq) IS NULL OR LAG(id) OVER (ORDER BY seq) < id THEN 1 END) as correctly_sorted
100-
FROM test_sortable;
111+
SUM(CASE WHEN is_ordered IS NULL OR is_ordered THEN 1 ELSE 0 END) as correctly_sorted
112+
FROM sortable_check;
101113
"
102114
103115
- name: Verify function availability

0 commit comments

Comments
 (0)