Re: Question about behavior of deletes with REPLICA IDENTITY NOTHING

From: Robert Treat <rob(at)xzilla(dot)net>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Peter Smith <smithpb2250(at)gmail(dot)com>, James Coleman <jtc331(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Question about behavior of deletes with REPLICA IDENTITY NOTHING
Date: 2025-01-03 17:23:17
Message-ID: CABV9wwPTygqdjRUA+tKieRdjJ2XJbwb7hEB=tgM90HQyYoigbw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Dec 18, 2024 at 5:56 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Thu, Feb 8, 2024 at 9:57 AM Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at> wrote:
> >
> > On Thu, 2024-02-08 at 13:40 +1100, Peter Smith wrote:
> > > - how to set the replica identity. If a table without a replica identity is
> > > + how to set the replica identity. If a table without a replica identity
> > > + (or with replica identity behavior the same as <literal>NOTHING</literal>) is
> > > added to a publication that replicates <command>UPDATE</command>
> > > or <command>DELETE</command> operations then
> > > subsequent <command>UPDATE</command> or <command>DELETE</command>
> >
> > I had the impression that the root of the confusion was the perceived difference
> > between "REPLICA IDENTITY NOTHING" and "no replica identity", and that change
> > doesn't improve that.
> >
> > How about:
> >
> > If a table without a replica identity (explicitly set to <literal>NOTHING</literal>,
> > or set to a primary key or index that doesn't exist) is added ...
> >
>
> Is it correct to say "set to a primary key or index that doesn't
> exist"? Because when it is set to the primary key then it should work.
>
> I think Peter's proposal along with Ashutosh's proposal is the simpler
> approach to clarify things in this area but I am fine if others find
> some other way of updating docs better.
>

After reading this thread, I think part of the confusion here is that
technically speaking there is no such thing as having "no replica
identity"; when a table is created, by default it's "replica identity"
is set to DEFAULT, and how it behaves at that point will be dependent
on the structure of the table (PK or no PK), not whether it is being
replicated/published. To that end, I've taken the above suggestions
and re-worked them to remove that language, as well as add some
additional clarity.

Patch attached for this, I am going to update the commitfest with
myself as author and will work this further if needed. Thanks all.

Robert Treat
https://xzilla.net

Attachment Content-Type Size
0001-Replica-Identity-clarifications.patch application/octet-stream 2.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2025-01-03 17:31:37 Re: Fwd: Re: A new look at old NFS readdir() problems?
Previous Message Bernd Helmle 2025-01-03 16:55:26 Re: Modern SHA2- based password hashes for pgcrypto