diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c index 0fb577d328..925dff9cc4 100644 --- a/src/backend/replication/logical/worker.c +++ b/src/backend/replication/logical/worker.c @@ -2929,9 +2929,10 @@ FindReplTupleInLocalRel(ApplyExecutionData *edata, Relation localrel, Relation idxrel = index_open(localidxoid, AccessShareLock); /* Index must be PK, RI, or usable for REPLICA IDENTITY FULL tables */ - Assert(GetRelationIdentityOrPK(idxrel) == localidxoid || - IsIndexUsableForReplicaIdentityFull(BuildIndexInfo(idxrel), - edata->targetRel->attrmap)); + Assert(GetRelationIdentityOrPK(localrel) == localidxoid || + (remoterel->replident == REPLICA_IDENTITY_FULL && + IsIndexUsableForReplicaIdentityFull(BuildIndexInfo(idxrel), + edata->targetRel->attrmap))); index_close(idxrel, AccessShareLock); #endif