Re: deferred primary key and logical replication

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

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].

Now sure this constraint is when we use USING INDEX for REPLICA
IDENTITY but why it has to be different for PRIMARY KEY especially
when UNIQUE constraint will have similar behavior and the same is
documented?

[1] - https://www.postgresql.org/docs/devel/sql-altertable.html

--
With Regards,
Amit Kapila.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2020-10-05 11:36:39 Re: Parallel INSERT (INTO ... SELECT ...)
Previous Message Bharath Rupireddy 2020-10-05 11:32:25 Re: Retry Cached Remote Connections for postgres_fdw in case remote backend gets killed/goes away