From: | Robert Treat <rob(at)xzilla(dot)net> |
---|---|
To: | Peter Smith <smithpb2250(at)gmail(dot)com> |
Cc: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, 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-14 13:41:29 |
Message-ID: | CAJSLCQ2MbCgG3tjQamWiy3wQWztvvUF9F1FzGmUp1VJ8kvdVrg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Tue, Jan 14, 2025 at 1:24 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> On Tue, Jan 14, 2025 at 4:46 PM Robert Treat <rob(at)xzilla(dot)net> wrote:
> > On Mon, Jan 13, 2025 at 8:07 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> > > On Tue, Jan 14, 2025 at 8:22 AM Robert Treat <rob(at)xzilla(dot)net> wrote:
> > > > On Mon, Jan 13, 2025 at 3:55 AM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > > > > On Mon, Jan 13, 2025 at 10:22 AM Robert Treat <rob(at)xzilla(dot)net> wrote:
> > > > > > On Sun, Jan 12, 2025 at 11:00 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > > > > > > On Sat, Jan 11, 2025 at 7:28 PM Robert Treat <rob(at)xzilla(dot)net> wrote:
> > > > > > > + If a table with replica identity set to <literal>NOTHING</literal>
> > > > > > > + (or set <command>DEFAULT</command> but with no primary key, or set
> > > > > > > + <command>USING INDEX</command> but the index has been dropped) is
> > > > > > > + added to a publication that replicates <command>UPDATE</command>
> > > > > > > + or <command>DELETE</command> operations,
> > > > > > > + subsequent <command>UPDATE</command> or <command>DELETE</command>
> > > > > > > + operations will cause an error on the publisher.
> > > > > > >
> > > > > > > In the above change, we missed the existing "a table without a replica
> > > > > > > identity" part. A slightly different way to write the above change
> > > > > > > could be: "Tables lacking a replica identity or with an insufficiently
> > > > > > > defined replica identity (e.g., set to NOTHING, set to DEFAULT but
> > > > > > > with no primary key, or set USING INDEX but the index has been
> > > > > > > dropped) cannot be updated or deleted when added to a publication that
> > > > > > > replicates these operations. Attempting to do so will result in an
> > > > > > > error on the publisher."
> > > > > > >
> > > > <snip>
> > > > > > Aside from that, your above language is a little more compact with the
> > > > > > trade-off of being less explicit in talking about publication
> > > > > > properties; I didn't change that part because it didn't seem like an
> > > > > > issue, but we could update that second part if you feel strongly about
> > > > > > it. LMK.
> > > > >
> > > > > One of the reasons I tried to rephrase the sentence was it appears to
> > > > > be long. I agree that the way you proposed is more explicit but the
> > > > > way I phrased also conveys the information in a bit succinct form. I
> > > > > think you can once propose with the wording on those lines then let us
> > > > > what Peter or others think about it.
> > > >
> > > > Splitting the difference would look like this?
> > > >
> > > > "Tables with replica identity set <literal>NOTHING</literal>,
> > > > set <literal>DEFAULT</literal> but with no primary key, or set
> > > > <literal>USING INDEX</literal> but the index has been
> > > > dropped, cannot be updated or deleted when added to a publication that
> > > > replicates these operations. Attempting to do so will result in an
> > > > error on the publisher."
> > >
> > > I thought Amit's proposed text was mostly OK; it only needed the
> > > "lacking a replica identity" part to be removed. (I've also changed
> > > the e.g. to i.e.)
> > >
> > > Like this:
> > >
> > > "Tables with an insufficiently defined replica identity (i.e., set to
> > > NOTHING, set to DEFAULT but with no primary key, or set USING INDEX
> > > but the index has been dropped) cannot be updated or ...".
> > >
> >
> > The term "insufficiently defined" feels off to me. If replica identity
> > is set DEFAULT, but the table has no primary key, is the replica
> > identity insufficiently defined, or is the table insufficiently
> > defined... especially in cases where the "solution" would be to add a
> > primary key, not change the replica identity. Similarly, I wouldn't
> > consider setting replica identity NOTHING as insufficiently defined
> > when it is actually intentionally defined.
> >
>
> Fair enough. At this point, I'm happy to agree to any wording provided
> it is correct and not misleading. I'll try to step back from quibbling
> about wording it unless I think it is saying something wrong because
> otherwise, this thread will be going in circles. I think in all
> likelihood Amit will be the committer who pushes this, so it is him
> you need to get on board.
>
> FYI, I fed your "split the difference" version into Chat-GPT and it
> came up with the following suggestion, which I thought was perhaps the
> best wording yet. (I added the <command> markup back to the
> UPDATE/DELETE.... somehow those got lost along the way and I don't
> know if that was deliberate)
>
> ------
> Tables with a replica identity defined as <literal>NOTHING</literal>,
> <literal>DEFAULT</literal> without a primary key, or <literal>USING
> INDEX</literal> with a dropped index cannot support
> <command>UPDATE</command> or <command>DELETE</command> operations when
> included in a publication replicating these actions. Attempting such
> operations will result in an error on the publisher.
> ------
Apologies, I think my late-night email missed cc-ing back to the list,
which I've added back in. I thought Peter's version above was good
enough to warrant an updated patch, which I'll (hopefully) leave to
Amit to be the final arbiter of :-)
Robert Treat
https://xzilla.net
Attachment | Content-Type | Size |
---|---|---|
v4-0001-Expand-and-clarify-Replica-Identity-information.patch | application/octet-stream | 6.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Nazir Bilal Yavuz | 2025-01-14 13:43:28 | Re: Make pg_stat_io view count IOs as bytes instead of blocks |
Previous Message | Robert Haas | 2025-01-14 13:40:46 | Re: AIO v2.2 |