Skip to content

Commit 0bb37b2

Browse files
author
Antonin Houska
committed
Fixed compatibility with PG 17.
1 parent 1d1777f commit 0bb37b2

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

concurrent.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,11 @@ plugin_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
674674
HeapTuple newtuple;
675675

676676
newtuple = change->data.tp.newtuple != NULL ?
677+
#if PG_VERSION_NUM >= 170000
678+
change->data.tp.newtuple : NULL;
679+
#else
677680
&change->data.tp.newtuple->tuple : NULL;
681+
#endif
678682

679683
/*
680684
* Identity checks in the main function should have made this
@@ -692,9 +696,17 @@ plugin_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
692696
newtuple;
693697

694698
oldtuple = change->data.tp.oldtuple != NULL ?
699+
#if PG_VERSION_NUM >= 170000
700+
change->data.tp.oldtuple : NULL;
701+
#else
695702
&change->data.tp.oldtuple->tuple : NULL;
703+
#endif
696704
newtuple = change->data.tp.newtuple != NULL ?
705+
#if PG_VERSION_NUM >= 170000
706+
change->data.tp.newtuple : NULL;
707+
#else
697708
&change->data.tp.newtuple->tuple : NULL;
709+
#endif
698710

699711
if (newtuple == NULL)
700712
elog(ERROR, "Incomplete update info.");
@@ -710,7 +722,11 @@ plugin_change(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
710722
HeapTuple oldtuple;
711723

712724
oldtuple = change->data.tp.oldtuple ?
725+
#if PG_VERSION_NUM >= 170000
726+
change->data.tp.oldtuple : NULL;
727+
#else
713728
&change->data.tp.oldtuple->tuple : NULL;
729+
#endif
714730

715731
if (oldtuple == NULL)
716732
elog(ERROR, "Incomplete delete info.");

pg_squeeze.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2820,6 +2820,14 @@ build_transient_indexes(Relation rel_dst, Relation rel_src,
28202820
opclassOptions,
28212821
#endif
28222822
indoptions,
2823+
#if PG_VERSION_NUM >= 170000
2824+
/*
2825+
* stattargets not needed for the transient
2826+
* index, the value of the source index
2827+
* will remain (we only swap the storage).
2828+
*/
2829+
NULL,
2830+
#endif
28232831
PointerGetDatum(reloptions),
28242832
flags, /* flags */
28252833
0, /* constr_flags */
@@ -3251,8 +3259,10 @@ swap_relation_files(Oid r1, Oid r2)
32513259

32523260
table_close(relRelation, RowExclusiveLock);
32533261

3262+
#if PG_VERSION_NUM < 170000
32543263
RelationCloseSmgrByOid(r1);
32553264
RelationCloseSmgrByOid(r2);
3265+
#endif
32563266
}
32573267

32583268
/*

worker.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,9 @@ create_replication_slots(int nslots, MemoryContext mcxt)
15591559
snprintf(name, NAMEDATALEN, REPL_SLOT_PREFIX "%u_%u", MyDatabaseId,
15601560
slot_nr);
15611561

1562-
#if PG_VERSION_NUM >= 140000
1562+
#if PG_VERSION_NUM >= 170000
1563+
ReplicationSlotCreate(name, true, RS_PERSISTENT, false, false, false);
1564+
#elif PG_VERSION_NUM >= 140000
15631565
ReplicationSlotCreate(name, true, RS_PERSISTENT, false);
15641566
#else
15651567
ReplicationSlotCreate(name, true, RS_PERSISTENT);

0 commit comments

Comments
 (0)