pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Ilya Gladyshev <ilya.v.gladyshev@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Segfault on logical replication to partitioned table with foreign children
Date: Tue, 01 Nov 2022 01:52:19 +0400
Message-ID: <7a2673fad058365b7583fbabcaca61fa3a36d40c.camel@gmail.com> (raw)
In-Reply-To: <20221030155239.55zehfskzdppokox@alvherre.pgsql>
References: <20221030155239.55zehfskzdppokox@alvherre.pgsql>

On Sun, 2022-10-30 at 16:52 +0100, Alvaro Herrera wrote:
> On 2022-Oct-28, ilya.v.gladyshev@gmail.com wrote:
> 
> > This will cause a segfault or raise an assert, because inserting
> > into
> > foreign tables via logical replication is not possible. The
> > solution I
> > propose is to add recursive checks of relkind for children of a
> > target,
> > if the target is a partitioned table.
> 
> However, I imagine that the only reason we don't support this is that
> the code hasn't been written yet. I think it would be better to write
> that code, so that we don't have to raise any error at all (unless
> the
> foreign table is something that doesn't support DML, in which case we
> would have to raise an error).  Of course, we still have to fix it in
> backbranches, but we can just do it as a targeted check at the moment
> of
> insert/update, not at the moment of subscription create/alter.
> 

Sure, this patch is just a quick fix. A proper implementation of
logical replication into foreign tables would be a much more difficult
undertaking. I think this patch is simple enough, the checks in the
patch are performed both on subscription DDL and when the relation is
opened for logical replication, so it gives both early feedback and
last-minute checks as well. All the code infrastructure for these kinds
of checks is already in place, so I think it's a good idea to use it.

P.S. sorry, duplicating the message, forgot to cc the mailing list the
first time






view thread (12+ messages)  latest in thread

Message-ID: <7a2673fad058365b7583fbabcaca61fa3a36d40c.camel@gmail.com>
Permalink:  ../7a2673fad058365b7583fbabcaca61fa3a36d40c.camel@gmail.com/
Also on:    postgresql.org/message-id/7a2673fad058365b7583fbabcaca61fa3a36d40c.camel@gmail.com

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: ilya.v.gladyshev@gmail.com, alvherre@alvh.no-ip.org, pgsql-hackers@lists.postgresql.org
  Subject: Re: Segfault on logical replication to partitioned table with foreign children
  In-Reply-To: <7a2673fad058365b7583fbabcaca61fa3a36d40c.camel@gmail.com>

* 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