diff options
author | Amit Kapila <akapila@postgresql.org> | 2022-08-16 15:14:27 +0530 |
---|---|---|
committer | Amit Kapila <akapila@postgresql.org> | 2022-08-16 15:14:27 +0530 |
commit | 76d257925994556bb49a7ce13dcb4785fbe7f395 (patch) | |
tree | a8c0caf02678f6de196a51dc54bfc8bf9e699d01 /src/backend/executor/execReplication.c | |
parent | 16c68567b58e328e97a00c7f273ee26cee6bbf01 (diff) |
Fix replica identity check for a partitioned table.
The current publisher code checks if UPDATE or DELETE can be executed with
the replica identity of the table even if it's a partitioned table. We can
skip checking the replica identity for partitioned tables because the
operations are actually performed on the leaf partitions (not the
partitioned table).
Reported-by: Brad Nicholson
Author: Hou Zhijie
Reviewed-by: Peter Smith, Amit Kapila
Backpatch-through: 13
Discussion: https://postgr.es/m/CAMMnM%3D8i5DohH%3DYKzV0_wYuYSYvuOJoL9F5nzXTc%2ByzsG1f6rg%40mail.gmail.com
Diffstat (limited to 'src/backend/executor/execReplication.c')
-rw-r--r-- | src/backend/executor/execReplication.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c index b000645d48b..6014f2e2482 100644 --- a/src/backend/executor/execReplication.c +++ b/src/backend/executor/execReplication.c @@ -569,6 +569,13 @@ CheckCmdReplicaIdentity(Relation rel, CmdType cmd) { PublicationDesc pubdesc; + /* + * Skip checking the replica identity for partitioned tables, because the + * operations are actually performed on the leaf partitions. + */ + if (rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE) + return; + /* We only need to do checks for UPDATE and DELETE. */ if (cmd != CMD_UPDATE && cmd != CMD_DELETE) return; |