Skip to content

Commit 3beb945

Browse files
author
Amit Kapila
committed
Improve assertion in FindReplTupleInLocalRel().
The first part of the assertion verifying that the passed index must be PK or RI was incorrectly passing index relation instead of heap relation in GetRelationIdentityOrPK(). The assertion was not failing because the second part of the assertion which needs to be performed only when remote relation has REPLICA_IDENTITY_FULL set was also incorrect. The change is not backpatched because the current coding doesn't lead to any failure. Reported-by: Dilip Kumar Author: Amit Kapila Reviewed-by: Vignesh C Discussion: https://postgr.es/m/CAFiTN-tmguaT1DXbCC+ZomZg-oZLmU6BPhr0po7akQSG6vNJrg@mail.gmail.com
1 parent 65c310b commit 3beb945

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/backend/replication/logical/worker.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -2929,9 +2929,10 @@ FindReplTupleInLocalRel(ApplyExecutionData *edata, Relation localrel,
29292929
Relation idxrel = index_open(localidxoid, AccessShareLock);
29302930

29312931
/* Index must be PK, RI, or usable for REPLICA IDENTITY FULL tables */
2932-
Assert(GetRelationIdentityOrPK(idxrel) == localidxoid ||
2933-
IsIndexUsableForReplicaIdentityFull(BuildIndexInfo(idxrel),
2934-
edata->targetRel->attrmap));
2932+
Assert(GetRelationIdentityOrPK(localrel) == localidxoid ||
2933+
(remoterel->replident == REPLICA_IDENTITY_FULL &&
2934+
IsIndexUsableForReplicaIdentityFull(BuildIndexInfo(idxrel),
2935+
edata->targetRel->attrmap)));
29352936
index_close(idxrel, AccessShareLock);
29362937
#endif
29372938

0 commit comments

Comments
 (0)