pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix partition table's REPLICA IDENTITY checking on the subscribe
Date: Tue, 21 Jun 2022 02:50:13 +0000
Message-ID: <E1o3Ty1-00133S-5K@gemulon.postgresql.org> (raw)

Fix partition table's REPLICA IDENTITY checking on the subscriber.

In logical replication, we will check if the target table on the
subscriber is updatable by comparing the replica identity of the table on
the publisher with the table on the subscriber. When the target table is a
partitioned table, we only check its replica identity but not for the
partition tables. This leads to assertion failure while applying changes
for update/delete as we expect those to succeed only when the
corresponding partition table has a primary key or has a replica
identity defined.

Fix it by checking the replica identity of the partition table while
applying changes.

Reported-by: Shi Yu
Author: Shi Yu, Hou Zhijie
Reviewed-by: Amit Langote, Amit Kapila
Backpatch-through: 13, where it was introduced
Discussion: https://postgr.es/m/OSZPR01MB6310F46CD425A967E4AEF736FDA49@OSZPR01MB6310.jpnprd01.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/26b3455afaa968fb48d0e468528d79de56624559

Modified Files
--------------
src/backend/replication/logical/relation.c | 115 +++++++++++++++++------------
src/backend/replication/logical/worker.c   |  27 +++++--
src/test/subscription/t/013_partition.pl   |  14 ++++
3 files changed, 101 insertions(+), 55 deletions(-)



view thread (6+ messages)  latest in thread

Message-ID: <E1o3Ty1-00133S-5K@gemulon.postgresql.org>
Permalink:  ../E1o3Ty1-00133S-5K@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1o3Ty1-00133S-5K@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org
  Subject: Re: pgsql: Fix partition table's REPLICA IDENTITY checking on the subscribe
  In-Reply-To: <E1o3Ty1-00133S-5K@gemulon.postgresql.org>
  References: <E1o3Ty1-00133S-5K@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox