summaryrefslogtreecommitdiff
path: root/src/backend/executor
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2020-05-16 18:16:37 +0900
committerMichael Paquier <michael@paquier.xyz>2020-05-16 18:16:37 +0900
commit70ae82b9b4b5871604ba4e98ebe0f32bef223200 (patch)
tree2b4364a460db6d597ce8aa9ccaaf53700e66206d /src/backend/executor
parentee39a4b9e475348dd3de82781a54be82e63a3186 (diff)
Fix assertion with relation using REPLICA IDENTITY FULL in subscriber
In a logical replication subscriber, a table using REPLICA IDENTITY FULL which has a primary key would try to use the primary key's index available to scan for a tuple, but an assertion only assumed as correct the case of an index associated to REPLICA IDENTITY USING INDEX. This commit corrects the assertion so as the use of a primary key index is a valid case. Reported-by: Dilip Kumar Analyzed-by: Dilip Kumar Author: Euler Taveira Reviewed-by: Michael Paquier, Masahiko Sawada Discussion: https://postgr.es/m/CAFiTN-u64S5bUiPL1q5kwpHNd0hRnf1OE-bzxNiOs5zo84i51w@mail.gmail.com Backpatch-through: 10
Diffstat (limited to 'src/backend/executor')
-rw-r--r--src/backend/executor/execReplication.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c
index f18c9a82a9e..108162bb356 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -55,7 +55,8 @@ build_replindex_scan_key(ScanKey skey, Relation rel, Relation idxrel,
int2vector *indkey = &idxrel->rd_index->indkey;
bool hasnulls = false;
- Assert(RelationGetReplicaIndex(rel) == RelationGetRelid(idxrel));
+ Assert(RelationGetReplicaIndex(rel) == RelationGetRelid(idxrel) ||
+ RelationGetPrimaryKeyIndex(rel) == RelationGetRelid(idxrel));
indclassDatum = SysCacheGetAttr(INDEXRELID, idxrel->rd_indextuple,
Anum_pg_index_indclass, &isnull);