diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 8728090..568a4f6 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: PGUSER: postgres strategy: matrix: - postgresql_version: [11, 12, 13, 14, 15, 16] + postgresql_version: [12, 13, 14, 15, 16, 17] experimental: [false] repo: ["pgdg"] # Define the current dev version to be experimental diff --git a/Makefile b/Makefile index e4f366c..100220d 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -short_ver = 1.1.13 -last_ver = 1.1.12 +short_ver = 1.1.14 +last_ver = 1.1.13 long_ver = $(shell git describe --long 2>/dev/null || echo $(short_ver)-0-unknown-g`git describe --always`) generated = aiven_extras.control \ sql/aiven_extras--$(short_ver).sql \ @@ -23,7 +23,7 @@ EXTRA_CLEAN = aiven_extras.control aiven-extras-rpm-src.tar include $(PGXS) -rpm: rpm-96 rpm-10 rpm-11 rpm-12 rpm-13 rpm-14 rpm-15 rpm-16 +rpm: rpm-12 rpm-13 rpm-14 rpm-15 rpm-16 rpm-17 aiven_extras.control: aiven_extras.control.in mkdir -p $(@D) diff --git a/sql/aiven_extras--1.1.13--1.1.14.sql b/sql/aiven_extras--1.1.13--1.1.14.sql new file mode 100644 index 0000000..e2f08fc --- /dev/null +++ b/sql/aiven_extras--1.1.13--1.1.14.sql @@ -0,0 +1 @@ +-- NOOP diff --git a/sql/aiven_extras.sql b/sql/aiven_extras.sql index 1129229..f27dd13 100644 --- a/sql/aiven_extras.sql +++ b/sql/aiven_extras.sql @@ -597,12 +597,14 @@ END; $OUTER$; -- standby slots functions -DROP FUNCTION IF EXISTS aiven_extras.pg_create_logical_replication_slot_on_standby(name, name, boolean, boolean); +DROP FUNCTION IF EXISTS aiven_extras.pg_create_logical_replication_slot_on_standby(name, name, boolean, boolean, boolean, boolean); CREATE FUNCTION aiven_extras.pg_create_logical_replication_slot_on_standby( slot_name name, plugin name, temporary boolean DEFAULT false, twophase boolean DEFAULT false, + failover boolean DEFAULT false, + synced boolean DEFAULT false, OUT slot_name name, OUT lsn pg_lsn) AS 'MODULE_PATHNAME', 'standby_slot_create' LANGUAGE C; diff --git a/src/aiven_extras.c b/src/aiven_extras.c index 630ec53..210e214 100644 --- a/src/aiven_extras.c +++ b/src/aiven_extras.c @@ -31,6 +31,8 @@ standby_slot_create(PG_FUNCTION_ARGS) Name plugin = PG_GETARG_NAME(1); bool temporary = PG_GETARG_BOOL(2); bool two_phase = PG_GETARG_BOOL(3); + bool failover = PG_GETARG_BOOL(4); + bool synced = PG_GETARG_BOOL(5); Datum result; TupleDesc tupdesc; HeapTuple tuple; @@ -75,6 +77,16 @@ standby_slot_create(PG_FUNCTION_ARGS) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("two phase commits are only available on PG >= 14"))); +#endif +#if PG_VERSION_NUM < 17000 + if (failover) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("failover is only available on PG >= 17"))); + if (synced) + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("synced is only available on PG >= 17"))); #endif /* Don't bother returning anything else than void for now */ Assert(!MyReplicationSlot); @@ -87,10 +99,16 @@ standby_slot_create(PG_FUNCTION_ARGS) * slots can be created as temporary from beginning as they get dropped on * error as well. */ - ReplicationSlotCreate(NameStr(*name), true, + ReplicationSlotCreate( + NameStr(*name), + true, temporary ? RS_TEMPORARY : RS_EPHEMERAL #if PG_VERSION_NUM >= 140000 , two_phase +#endif +#if PG_VERSION_NUM >= 170000 + , failover + , synced #endif );