pgsql: Defend against unsupported partition relkind in logical replicat

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Defend against unsupported partition relkind in logical replicat
Date: 2022-11-02 16:29:59
Message-ID: E1oqGcp-0007y2-KY@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

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
------
REL_15_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/414d29a826f3a63fabae5e9ac2eb5b17f03787d8

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

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2022-11-02 21:29:33 pgsql: pg_dump: Refactor code that constructs ALTER ... OWNER TO comman
Previous Message Tom Lane 2022-11-02 15:30:11 pgsql: pg_dump: fix failure to dump comments on constraints in some cas