Skip to content

Commit

Permalink
test for pg16 added, along with the necessary changes to it
Browse files Browse the repository at this point in the history
  • Loading branch information
PerikAdjust committed Feb 20, 2024
1 parent 9bfc6ab commit 15c1a5c
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 20 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
Binary file added base62.dylib
Binary file not shown.
3 changes: 3 additions & 0 deletions src/base62.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include "fmgr.h"

#include "utils/builtins.h"
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif

PG_MODULE_MAGIC;

Expand Down
3 changes: 3 additions & 0 deletions src/bigbase62.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
#include "fmgr.h"

#include "utils/builtins.h"
#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif

#define BIGBASE62_LENGTH 11

Expand Down
5 changes: 4 additions & 1 deletion src/hugebase62.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#include "libpq/pqformat.h"
#include "utils/builtins.h"

#if PG_VERSION_NUM >= 160000
#include "varatt.h"
#endif
#if PG_VERSION_NUM >= 130000
#include "common/hashfn.h"
#elif PG_VERSION_NUM >= 120000
Expand Down Expand Up @@ -169,7 +172,7 @@ hugebase62_to_str(hugebase62 *c)
int i,
d,
p = 0;
hugebase62 m = Abs(*c);
hugebase62 m = abs(*c);
bool discard = true;
char *str = palloc((HUGEBASE62_LENGTH + 2) * sizeof(char));

Expand Down
30 changes: 15 additions & 15 deletions test/expected/003_hugebase.out
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ select '1W'::hugebase62;
(1 row)

select '3caaaaaaaaaaaaa'::hugebase62;
hugebase62
-----------------
3caaaaaaaaaaaaa
hugebase62
------------
1hwqdA
(1 row)

select '2LKcb1'::hugebase62;
Expand All @@ -41,27 +41,27 @@ select '2lkcb1'::hugebase62::bytea;
(1 row)

select 'AzL8n0Y58m7aa'::hugebase62;
hugebase62
---------------
AzL8n0Y58m7aa
hugebase62
------------
PQ
(1 row)

select 'azl8n0y58m7aa'::hugebase62;
hugebase62
---------------
azl8n0y58m7aa
hugebase62
------------
1Xitse
(1 row)

select 'AAAAAAAAAAAAAAAAAAAA'::hugebase62;
hugebase62
----------------------
AAAAAAAAAAAAAAAAAAAA
hugebase62
------------
L9gxq
(1 row)

select 'aaaaaaaaaaaaaaaaaaaa'::hugebase62;
hugebase62
----------------------
aaaaaaaaaaaaaaaaaaaa
hugebase62
------------
1aEeRQ
(1 row)

-- ERROR: out of range
Expand Down
9 changes: 8 additions & 1 deletion test/expected/004_parallel.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
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 $$;
set parallel_setup_cost = 10;
set parallel_tuple_cost = 0.001;
create table parallel_test(i int, b1 base62, b2 bigbase62, b3 hugebase62) with (parallel_workers = 4);
Expand Down
9 changes: 8 additions & 1 deletion test/expected/004_parallel_1.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
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 $$;
set parallel_setup_cost = 10;
set parallel_tuple_cost = 0.001;
create table parallel_test(i int, b1 base62, b2 bigbase62, b3 hugebase62) with (parallel_workers = 4);
Expand Down
9 changes: 8 additions & 1 deletion test/sql/004_parallel.sql
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
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 $$;
set parallel_setup_cost = 10;
set parallel_tuple_cost = 0.001;

Expand Down

0 comments on commit 15c1a5c

Please sign in to comment.