Skip to content

Commit

Permalink
Merge pull request #25 from adjust/pg16_test
Browse files Browse the repository at this point in the history
add pg16 test, add modifications to adapt to pg16
  • Loading branch information
PerikAdjust authored Apr 22, 2024
2 parents ff2d2a8 + ab246c1 commit 69ff71e
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
test:
strategy:
matrix:
pg: [15, 14, 13, 12, 11, 10]
pg: [16, 15, 14, 13, 12, 11, 10]
name: 🐘 PostgreSQL ${{ matrix.pg }}
runs-on: ubuntu-latest
container: pgxn/pgxn-tools
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
*.o
*.so
*.dylib


sha*.sql.in
sha*.sql
sha*.c
Expand Down
9 changes: 8 additions & 1 deletion 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, md md5hash, md2 md5hash) WITH (parallel_workers = 4);
INSERT INTO parallel_test (i, md, md2)
SELECT i, md5(i::text), md5((i + 1)::text)
Expand Down
9 changes: 8 additions & 1 deletion expected/parallel_test_0.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, md md5hash, md2 md5hash) WITH (parallel_workers = 4);
INSERT INTO parallel_test (i, md, md2)
SELECT i, md5(i::text), md5((i + 1)::text)
Expand Down
9 changes: 8 additions & 1 deletion sql/parallel_test.sql
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, md md5hash, md2 md5hash) WITH (parallel_workers = 4);
INSERT INTO parallel_test (i, md, md2)
Expand Down
3 changes: 3 additions & 0 deletions src/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@

#include "common.h"
#include "fmgr.h"
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif

PG_MODULE_MAGIC;

Expand Down
3 changes: 3 additions & 0 deletions src/md5.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "fmgr.h"
#include "utils/builtins.h"
#include "libpq/pqformat.h"
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif

#define MD5_LENGTH 16

Expand Down
3 changes: 3 additions & 0 deletions src/sha.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#ifndef SHA_NAME
#error No algorithm name defined
#endif
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif

typedef struct Sha {
unsigned char bytes[SHA_LENGTH];
Expand Down

0 comments on commit 69ff71e

Please sign in to comment.