On Fri, 28 Aug 2026 at 03:05, Mihail Nikalayeu
<[email protected]> wrote:
>
> Attached are patches for master (which also applies to v19 as-is),
> v18, v17 and v16. The back-branch patches contain the code change
> only. The test requires the injection point added by bc32a12e0db; v18
> and v17 don't have it, and it can't be used on v16.

RelationFindReplTupleByIndex() is an extern function declared in a
core executor header (executor.h). Adding a new parameter
(isIdxSafeToSkipDuplicates) changes its calling convention. Any
third-party extension or out-of-tree apply worker compiled against an
earlier minor version like PG16 branch that calls this function will
pass incorrect arguments on the stack/registers, leading to stack
corruption or crashes when running on a patched minor release.
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -652,6 +652,7 @@ extern void check_exclusion_constraint(Relation
heap, Relation index,
  * prototypes from functions in execReplication.c
  */
 extern bool RelationFindReplTupleByIndex(Relation rel, Oid idxoid,
+ bool isIdxSafeToSkipDuplicates,
  LockTupleMode lockmode,
  TupleTableSlot *searchslot,
  TupleTableSlot *outslot);

Similarly I'm not sure of adding isidentity to LogicalRepRelMapEntry
in back branches as it will change its size and memory layout.
External extensions that embed, allocate, or iterate over arrays of
LogicalRepRelMapEntry across minor releases will experience struct
size mismatches and potential memory misalignment.
diff --git a/src/include/replication/logicalrelation.h
b/src/include/replication/logicalrelation.h
index 3f4d906d741..4f98b1ea789 100644
--- a/src/include/replication/logicalrelation.h
+++ b/src/include/replication/logicalrelation.h
@@ -33,6 +33,11 @@ typedef struct LogicalRepRelMapEntry
  AttrMap    *attrmap; /* map of local attributes to remote ones */
  bool updatable; /* Can apply updates/deletes? */
  Oid localindexoid; /* which index to use, or InvalidOid if none */
+ bool isidentity; /* localindexoid was chosen as the
+ * relation's replica identity or
+ * primary key, rather than as one
+ * usable for a REPLICA IDENTITY
+ * FULL remote relation */

Regards,
Vignesh


Reply via email to