Re: deferred primary key and logical replication

From: Euler Taveira <euler(dot)taveira(at)2ndquadrant(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: deferred primary key and logical replication
Date: 2020-10-25 16:09:27
Message-ID: CAH503wD5ZAG1Ve5AqJ5bTERwCj=di4heT94qjJ9oGgem5f-_FA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 5 Oct 2020 at 08:34, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

> On Mon, May 11, 2020 at 2:41 AM Euler Taveira
> <euler(dot)taveira(at)2ndquadrant(dot)com> wrote:
> >
> > Hi,
> >
> > While looking at an old wal2json issue, I stumbled on a scenario that a
> table
> > with a deferred primary key is not updatable in logical replication.
> AFAICS it
> > has been like that since the beginning of logical decoding and seems to
> be an
> > oversight while designing logical decoding.
> >
>
> I am not sure if it is an oversight because we document that the index
> must be non-deferrable, see "USING INDEX records the old values of the
> columns covered by the named index, which must be unique, not partial,
> not deferrable, and include only columns marked NOT NULL." in docs
> [1].
>
>
Inspecting this patch again, I forgot to consider
that RelationGetIndexList()
is called by other backend modules. Since logical decoding deals with
finished
transactions, it is ok to use a deferrable primary key. However, this patch
is
probably wrong because it does not consider the other modules.

--
Euler Taveira http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2020-10-25 16:42:46 Re: pgstat_report_activity() and parallel CREATE INDEX (was: Parallel index creation & pg_stat_activity)
Previous Message Tom Lane 2020-10-25 14:52:50 Re: pgstat_report_activity() and parallel CREATE INDEX (was: Parallel index creation & pg_stat_activity)