Skip to content

Commit

Permalink
test for pg_version 11:16
Browse files Browse the repository at this point in the history
  • Loading branch information
PerikAdjust committed Jul 23, 2024
1 parent 8b384bf commit b052059
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 9 deletions.
21 changes: 21 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: CI

on:
push:
branches:
- master
- main
pull_request:

jobs:
test:
strategy:
matrix:
pg: [16, 15, 14, 13, 12, 11]
name: 🐘 PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
container: pgxn/pgxn-tools
steps:
- run: pg-start ${{ matrix.pg }}
- uses: actions/checkout@v2
- run: pg-build-test
22 changes: 15 additions & 7 deletions test/expected/parallel_test.out
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
BEGIN;
SET max_parallel_workers_per_gather=4;
SET force_parallel_mode=on;
DO $$
BEGIN
IF current_setting('server_version_num')::int >= 160000 THEN
EXECUTE 'SET debug_parallel_query = on';
ELSE
EXECUTE 'SET force_parallel_mode = on';
END IF;
END $$;
CREATE TABLE parallel_test(i int, c language) WITH (parallel_workers = 4);
INSERT INTO parallel_test (i, c)
SELECT i, c.country
Expand All @@ -21,8 +28,9 @@ SELECT COUNT(*) FROM parallel_test WHERE c = 'id'::language;
-> Partial Aggregate
Output: PARTIAL count(*)
-> Parallel Seq Scan on public.parallel_test
Output: i, c
Filter: (parallel_test.c = 'id'::language)
(9 rows)
(10 rows)

EXPLAIN (costs off,verbose)
SELECT c, COUNT(*) FROM parallel_test GROUP BY 1;
Expand All @@ -31,17 +39,17 @@ SELECT c, COUNT(*) FROM parallel_test GROUP BY 1;
Finalize GroupAggregate
Output: c, count(*)
Group Key: parallel_test.c
-> Sort
-> Gather Merge
Output: c, (PARTIAL count(*))
Sort Key: parallel_test.c
-> Gather
Workers Planned: 4
-> Sort
Output: c, (PARTIAL count(*))
Workers Planned: 4
Sort Key: parallel_test.c
-> Partial HashAggregate
Output: c, PARTIAL count(*)
Group Key: parallel_test.c
-> Parallel Seq Scan on public.parallel_test
Output: c
Output: i, c
(14 rows)

ROLLBACK;
10 changes: 8 additions & 2 deletions test/sql/parallel_test.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
BEGIN;
SET max_parallel_workers_per_gather=4;
SET force_parallel_mode=on;

DO $$
BEGIN
IF current_setting('server_version_num')::int >= 160000 THEN
EXECUTE 'SET debug_parallel_query = on';
ELSE
EXECUTE 'SET force_parallel_mode = on';
END IF;
END $$;
CREATE TABLE parallel_test(i int, c language) WITH (parallel_workers = 4);
INSERT INTO parallel_test (i, c)
SELECT i, c.country
Expand Down

0 comments on commit b052059

Please sign in to comment.