Skip to content

Commit 07d53b5

Browse files
committed
Remove pagination test (for now)
1 parent 247e4e4 commit 07d53b5

File tree

2 files changed

+38
-86
lines changed

2 files changed

+38
-86
lines changed

test/expected/aggregate.out

Lines changed: 22 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,26 @@ begin;
2424
-- 5 Accounts
2525
insert into public.account(email, created_at)
2626
values
27-
('[email protected]', NOW() - INTERVAL '5 days'),
28-
('[email protected]', NOW() - INTERVAL '4 days'),
29-
('[email protected]', NOW() - INTERVAL '3 days'),
30-
('[email protected]', NOW() - INTERVAL '2 days'),
31-
('[email protected]', NOW() - INTERVAL '1 day');
27+
('[email protected]', '2025-04-27 12:00:00'),
28+
('[email protected]', '2025-04-28 12:00:00'),
29+
('[email protected]', '2025-04-29 12:00:00'),
30+
('[email protected]', '2025-04-30 12:00:00'),
31+
('[email protected]', '2025-05-01 12:00:00');
3232
insert into blog(owner_id, name, description, created_at)
3333
values
34-
((select id from account where email ilike 'a%'), 'A: Blog 1', 'a desc1', NOW() - INTERVAL '10 days'),
35-
((select id from account where email ilike 'a%'), 'A: Blog 2', 'a desc2', NOW() - INTERVAL '9 days'),
36-
((select id from account where email ilike 'a%'), 'A: Blog 3', 'a desc3', NOW() - INTERVAL '8 days'),
37-
((select id from account where email ilike 'b%'), 'B: Blog 3', 'b desc1', NOW() - INTERVAL '7 days');
34+
((select id from account where email ilike 'a%'), 'A: Blog 1', 'a desc1', '2025-04-22 12:00:00'),
35+
((select id from account where email ilike 'a%'), 'A: Blog 2', 'a desc2', '2025-04-23 12:00:00'),
36+
((select id from account where email ilike 'a%'), 'A: Blog 3', 'a desc3', '2025-04-24 12:00:00'),
37+
((select id from account where email ilike 'b%'), 'B: Blog 3', 'b desc1', '2025-04-25 12:00:00');
3838
insert into blog_post (blog_id, title, body, tags, status, created_at)
3939
values
40-
((SELECT id FROM blog WHERE name = 'A: Blog 1'), 'Post 1 in A Blog 1', 'Content for post 1 in A Blog 1', '{"tech", "update"}', 'RELEASED', NOW() - INTERVAL '30 days'),
41-
((SELECT id FROM blog WHERE name = 'A: Blog 1'), 'Post 2 in A Blog 1', 'Content for post 2 in A Blog 1', '{"announcement", "tech"}', 'PENDING', NOW() - INTERVAL '25 days'),
42-
((SELECT id FROM blog WHERE name = 'A: Blog 2'), 'Post 1 in A Blog 2', 'Content for post 1 in A Blog 2', '{"personal"}', 'RELEASED', NOW() - INTERVAL '20 days'),
43-
((SELECT id FROM blog WHERE name = 'A: Blog 2'), 'Post 2 in A Blog 2', 'Content for post 2 in A Blog 2', '{"update"}', 'RELEASED', NOW() - INTERVAL '15 days'),
44-
((SELECT id FROM blog WHERE name = 'A: Blog 3'), 'Post 1 in A Blog 3', 'Content for post 1 in A Blog 3', '{"travel", "adventure"}', 'PENDING', NOW() - INTERVAL '10 days'),
45-
((SELECT id FROM blog WHERE name = 'B: Blog 3'), 'Post 1 in B Blog 3', 'Content for post 1 in B Blog 3', '{"tech", "review"}', 'RELEASED', NOW() - INTERVAL '5 days'),
46-
((SELECT id FROM blog WHERE name = 'B: Blog 3'), 'Post 2 in B Blog 3', 'Content for post 2 in B Blog 3', '{"coding", "tutorial"}', 'PENDING', NOW());
40+
((SELECT id FROM blog WHERE name = 'A: Blog 1'), 'Post 1 in A Blog 1', 'Content for post 1 in A Blog 1', '{"tech", "update"}', 'RELEASED', '2025-04-02 12:00:00'),
41+
((SELECT id FROM blog WHERE name = 'A: Blog 1'), 'Post 2 in A Blog 1', 'Content for post 2 in A Blog 1', '{"announcement", "tech"}', 'PENDING', '2025-04-07 12:00:00'),
42+
((SELECT id FROM blog WHERE name = 'A: Blog 2'), 'Post 1 in A Blog 2', 'Content for post 1 in A Blog 2', '{"personal"}', 'RELEASED', '2025-04-12 12:00:00'),
43+
((SELECT id FROM blog WHERE name = 'A: Blog 2'), 'Post 2 in A Blog 2', 'Content for post 2 in A Blog 2', '{"update"}', 'RELEASED', '2025-04-17 12:00:00'),
44+
((SELECT id FROM blog WHERE name = 'A: Blog 3'), 'Post 1 in A Blog 3', 'Content for post 1 in A Blog 3', '{"travel", "adventure"}', 'PENDING', '2025-04-22 12:00:00'),
45+
((SELECT id FROM blog WHERE name = 'B: Blog 3'), 'Post 1 in B Blog 3', 'Content for post 1 in B Blog 3', '{"tech", "review"}', 'RELEASED', '2025-04-27 12:00:00'),
46+
((SELECT id FROM blog WHERE name = 'B: Blog 3'), 'Post 2 in B Blog 3', 'Content for post 2 in B Blog 3', '{"coding", "tutorial"}', 'PENDING', '2025-05-02 12:00:00');
4747
comment on table blog_post is e'@graphql({"totalCount": {"enabled": true}})';
4848
-- Test Case 1: Basic Count on accountCollection
4949
select graphql.resolve($$
@@ -245,9 +245,9 @@ begin;
245245
}
246246
}
247247
$$);
248-
resolve
249-
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
250-
{"data": {"blogCollection": {"aggregate": {"max": {"name": "B: Blog 3", "createdAt": "2025-04-25T22:04:39.666373", "description": "b desc1"}, "min": {"name": "A: Blog 1", "createdAt": "2025-04-22T22:04:39.666373", "description": "a desc1"}}}}}
248+
resolve
249+
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
250+
{"data": {"blogCollection": {"aggregate": {"max": {"name": "B: Blog 3", "createdAt": "2025-04-25T12:00:00", "description": "b desc1"}, "min": {"name": "A: Blog 1", "createdAt": "2025-04-22T12:00:00", "description": "a desc1"}}}}}
251251
(1 row)
252252

253253
-- Test Case 11: Aggregation with relationships (nested queries)
@@ -315,9 +315,9 @@ begin;
315315
}
316316
}
317317
$$);
318-
resolve
319-
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
320-
{"data": {"blogCollection": {"edges": [{"node": {"name": "A: Blog 1", "blogPostCollection": {"aggregate": {"max": {"createdAt": "2025-04-07T22:04:39.666373"}, "min": {"createdAt": "2025-04-02T22:04:39.666373"}, "count": 2}}}}, {"node": {"name": "A: Blog 2", "blogPostCollection": {"aggregate": {"max": {"createdAt": "2025-04-17T22:04:39.666373"}, "min": {"createdAt": "2025-04-12T22:04:39.666373"}, "count": 2}}}}, {"node": {"name": "A: Blog 3", "blogPostCollection": {"aggregate": {"max": {"createdAt": "2025-04-22T22:04:39.666373"}, "min": {"createdAt": "2025-04-22T22:04:39.666373"}, "count": 1}}}}, {"node": {"name": "B: Blog 3", "blogPostCollection": {"aggregate": {"max": {"createdAt": "2025-05-02T22:04:39.666373"}, "min": {"createdAt": "2025-04-27T22:04:39.666373"}, "count": 2}}}}], "aggregate": {"avg": {"id": 2.5}, "max": {"id": 4, "createdAt": "2025-04-25T22:04:39.666373"}, "min": {"id": 1, "createdAt": "2025-04-22T22:04:39.666373"}, "sum": {"id": 10}, "count": 4}}}}
318+
resolve
319+
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
320+
{"data": {"blogCollection": {"edges": [{"node": {"name": "A: Blog 1", "blogPostCollection": {"aggregate": {"max": {"createdAt": "2025-04-07T12:00:00"}, "min": {"createdAt": "2025-04-02T12:00:00"}, "count": 2}}}}, {"node": {"name": "A: Blog 2", "blogPostCollection": {"aggregate": {"max": {"createdAt": "2025-04-17T12:00:00"}, "min": {"createdAt": "2025-04-12T12:00:00"}, "count": 2}}}}, {"node": {"name": "A: Blog 3", "blogPostCollection": {"aggregate": {"max": {"createdAt": "2025-04-22T12:00:00"}, "min": {"createdAt": "2025-04-22T12:00:00"}, "count": 1}}}}, {"node": {"name": "B: Blog 3", "blogPostCollection": {"aggregate": {"max": {"createdAt": "2025-05-02T12:00:00"}, "min": {"createdAt": "2025-04-27T12:00:00"}, "count": 2}}}}], "aggregate": {"avg": {"id": 2.5}, "max": {"id": 4, "createdAt": "2025-04-25T12:00:00"}, "min": {"id": 1, "createdAt": "2025-04-22T12:00:00"}, "sum": {"id": 10}, "count": 4}}}}
321321
(1 row)
322322

323323
-- Test Case 13: Complex filters with aggregates using AND/OR/NOT
@@ -471,29 +471,3 @@ begin;
471471
{"data": {"blogCollection": {"edges": [{"node": {"name": "A: Blog 1", "blogPostCollection": {"aggregate": {"count": 1}}}}, {"node": {"name": "A: Blog 2", "blogPostCollection": {"aggregate": {"count": 2}}}}, {"node": {"name": "A: Blog 3", "blogPostCollection": {"aggregate": {"count": 0}}}}, {"node": {"name": "B: Blog 3", "blogPostCollection": {"aggregate": {"count": 1}}}}]}}}
472472
(1 row)
473473

474-
-- Test Case 19: Check aggregates work with pagination (should ignore pagination for aggregates)
475-
select graphql.resolve($$
476-
query {
477-
blogPostCollection(first: 2, offset: 1) {
478-
edges {
479-
node {
480-
title
481-
}
482-
}
483-
aggregate {
484-
count
485-
min {
486-
createdAt
487-
}
488-
max {
489-
createdAt
490-
}
491-
}
492-
}
493-
}
494-
$$);
495-
resolve
496-
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
497-
{"data": {"blogPostCollection": {"edges": [{"node": {"title": "Post 2 in A Blog 1"}}, {"node": {"title": "Post 1 in A Blog 3"}}], "aggregate": {"max": {"createdAt": "2025-05-02T22:04:39.666373"}, "min": {"createdAt": "2025-04-02T22:04:39.666373"}, "count": 7}}}}
498-
(1 row)
499-

test/sql/aggregate.sql

Lines changed: 16 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -33,28 +33,28 @@ begin;
3333
-- 5 Accounts
3434
insert into public.account(email, created_at)
3535
values
36-
('[email protected]', NOW() - INTERVAL '5 days'),
37-
('[email protected]', NOW() - INTERVAL '4 days'),
38-
('[email protected]', NOW() - INTERVAL '3 days'),
39-
('[email protected]', NOW() - INTERVAL '2 days'),
40-
('[email protected]', NOW() - INTERVAL '1 day');
36+
('[email protected]', '2025-04-27 12:00:00'),
37+
('[email protected]', '2025-04-28 12:00:00'),
38+
('[email protected]', '2025-04-29 12:00:00'),
39+
('[email protected]', '2025-04-30 12:00:00'),
40+
('[email protected]', '2025-05-01 12:00:00');
4141

4242
insert into blog(owner_id, name, description, created_at)
4343
values
44-
((select id from account where email ilike 'a%'), 'A: Blog 1', 'a desc1', NOW() - INTERVAL '10 days'),
45-
((select id from account where email ilike 'a%'), 'A: Blog 2', 'a desc2', NOW() - INTERVAL '9 days'),
46-
((select id from account where email ilike 'a%'), 'A: Blog 3', 'a desc3', NOW() - INTERVAL '8 days'),
47-
((select id from account where email ilike 'b%'), 'B: Blog 3', 'b desc1', NOW() - INTERVAL '7 days');
44+
((select id from account where email ilike 'a%'), 'A: Blog 1', 'a desc1', '2025-04-22 12:00:00'),
45+
((select id from account where email ilike 'a%'), 'A: Blog 2', 'a desc2', '2025-04-23 12:00:00'),
46+
((select id from account where email ilike 'a%'), 'A: Blog 3', 'a desc3', '2025-04-24 12:00:00'),
47+
((select id from account where email ilike 'b%'), 'B: Blog 3', 'b desc1', '2025-04-25 12:00:00');
4848

4949
insert into blog_post (blog_id, title, body, tags, status, created_at)
5050
values
51-
((SELECT id FROM blog WHERE name = 'A: Blog 1'), 'Post 1 in A Blog 1', 'Content for post 1 in A Blog 1', '{"tech", "update"}', 'RELEASED', NOW() - INTERVAL '30 days'),
52-
((SELECT id FROM blog WHERE name = 'A: Blog 1'), 'Post 2 in A Blog 1', 'Content for post 2 in A Blog 1', '{"announcement", "tech"}', 'PENDING', NOW() - INTERVAL '25 days'),
53-
((SELECT id FROM blog WHERE name = 'A: Blog 2'), 'Post 1 in A Blog 2', 'Content for post 1 in A Blog 2', '{"personal"}', 'RELEASED', NOW() - INTERVAL '20 days'),
54-
((SELECT id FROM blog WHERE name = 'A: Blog 2'), 'Post 2 in A Blog 2', 'Content for post 2 in A Blog 2', '{"update"}', 'RELEASED', NOW() - INTERVAL '15 days'),
55-
((SELECT id FROM blog WHERE name = 'A: Blog 3'), 'Post 1 in A Blog 3', 'Content for post 1 in A Blog 3', '{"travel", "adventure"}', 'PENDING', NOW() - INTERVAL '10 days'),
56-
((SELECT id FROM blog WHERE name = 'B: Blog 3'), 'Post 1 in B Blog 3', 'Content for post 1 in B Blog 3', '{"tech", "review"}', 'RELEASED', NOW() - INTERVAL '5 days'),
57-
((SELECT id FROM blog WHERE name = 'B: Blog 3'), 'Post 2 in B Blog 3', 'Content for post 2 in B Blog 3', '{"coding", "tutorial"}', 'PENDING', NOW());
51+
((SELECT id FROM blog WHERE name = 'A: Blog 1'), 'Post 1 in A Blog 1', 'Content for post 1 in A Blog 1', '{"tech", "update"}', 'RELEASED', '2025-04-02 12:00:00'),
52+
((SELECT id FROM blog WHERE name = 'A: Blog 1'), 'Post 2 in A Blog 1', 'Content for post 2 in A Blog 1', '{"announcement", "tech"}', 'PENDING', '2025-04-07 12:00:00'),
53+
((SELECT id FROM blog WHERE name = 'A: Blog 2'), 'Post 1 in A Blog 2', 'Content for post 1 in A Blog 2', '{"personal"}', 'RELEASED', '2025-04-12 12:00:00'),
54+
((SELECT id FROM blog WHERE name = 'A: Blog 2'), 'Post 2 in A Blog 2', 'Content for post 2 in A Blog 2', '{"update"}', 'RELEASED', '2025-04-17 12:00:00'),
55+
((SELECT id FROM blog WHERE name = 'A: Blog 3'), 'Post 1 in A Blog 3', 'Content for post 1 in A Blog 3', '{"travel", "adventure"}', 'PENDING', '2025-04-22 12:00:00'),
56+
((SELECT id FROM blog WHERE name = 'B: Blog 3'), 'Post 1 in B Blog 3', 'Content for post 1 in B Blog 3', '{"tech", "review"}', 'RELEASED', '2025-04-27 12:00:00'),
57+
((SELECT id FROM blog WHERE name = 'B: Blog 3'), 'Post 2 in B Blog 3', 'Content for post 2 in B Blog 3', '{"coding", "tutorial"}', 'PENDING', '2025-05-02 12:00:00');
5858

5959

6060
comment on table blog_post is e'@graphql({"totalCount": {"enabled": true}})';
@@ -413,25 +413,3 @@ begin;
413413
}
414414
$$);
415415

416-
417-
-- Test Case 19: Check aggregates work with pagination (should ignore pagination for aggregates)
418-
select graphql.resolve($$
419-
query {
420-
blogPostCollection(first: 2, offset: 1) {
421-
edges {
422-
node {
423-
title
424-
}
425-
}
426-
aggregate {
427-
count
428-
min {
429-
createdAt
430-
}
431-
max {
432-
createdAt
433-
}
434-
}
435-
}
436-
}
437-
$$);

0 commit comments

Comments
 (0)