Re: deferred primary key and logical replication - Mailing list pgsql-hackers

From Amit Kapila
Subject Re: deferred primary key and logical replication
Date
Msg-id CAA4eK1K8Yofek4UzFCkO6YPHvnrFjZLyD7EXypZOSu4-jBkLSA@mail.gmail.com
Whole thread Raw
In response to deferred primary key and logical replication  (Euler Taveira <euler.taveira@2ndquadrant.com>)
Responses Re: deferred primary key and logical replication  (Euler Taveira <euler.taveira@2ndquadrant.com>)
List pgsql-hackers
On Mon, May 11, 2020 at 2:41 AM Euler Taveira
<euler.taveira@2ndquadrant.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.



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Retry Cached Remote Connections for postgres_fdw in case remote backend gets killed/goes away
Next
From: Heikki Linnakangas
Date:
Subject: Re: Online checksums patch - once again