pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Defend against unsupported partition relkind in logical replicat
Date: Wed, 02 Nov 2022 16:29:59 +0000
Message-ID: <E1oqGcp-0007y1-K8@gemulon.postgresql.org> (raw)

Defend against unsupported partition relkind in logical replication worker.

Since partitions can be foreign tables not only plain tables, but
logical replication only supports plain tables, we'd better check the
relkind of a partition after we find it.  (There was some discussion
of checking this when adding a partitioned table to a subscription;
but that would be inadequate since the troublesome partition could be
added later.)  Without this, the situation leads to a segfault or
assertion failure.

In passing, add a separate variable for the target Relation of
a cross-partition UPDATE; reusing partrel seemed mighty confusing
and error-prone.

Shi Yu and Tom Lane, per report from Ilya Gladyshev.  Back-patch
to v13 where logical replication into partitioned tables became
a thing.

Discussion: https://postgr.es/m/6b93e3748ba43298694f376ca8797279d7945e29.camel@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/be541efbfd11c4339222935899989d9c65737ac6

Modified Files
--------------
src/backend/replication/logical/worker.c | 20 +++++++++++++++++---
1 file changed, 17 insertions(+), 3 deletions(-)



view thread (4+ messages)

Message-ID: <E1oqGcp-0007y1-K8@gemulon.postgresql.org>
Permalink:  ../E1oqGcp-0007y1-K8@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1oqGcp-0007y1-K8@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: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Defend against unsupported partition relkind in logical replicat
  In-Reply-To: <E1oqGcp-0007y1-K8@gemulon.postgresql.org>
  References: <E1oqGcp-0007y1-K8@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