diff options
author | Michael Paquier <michael@paquier.xyz> | 2020-05-16 18:15:18 +0900 |
---|---|---|
committer | Michael Paquier <michael@paquier.xyz> | 2020-05-16 18:15:18 +0900 |
commit | 7ccb2f54d9f3f3c5b4ac092d62c846b02a47f8d5 (patch) | |
tree | 4f4aa836199d83b82c88810831e9afed18a89400 /src/backend/executor/execReplication.c | |
parent | 474e7da6485687425d216eda1685d7e530b24fd6 (diff) | |
download | postgresql-7ccb2f54d9f3f3c5b4ac092d62c846b02a47f8d5.tar.gz postgresql-7ccb2f54d9f3f3c5b4ac092d62c846b02a47f8d5.zip |
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/execReplication.c')
-rw-r--r-- | src/backend/executor/execReplication.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index 1418746eb8d..8f474faed06 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -57,7 +57,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); |