Re: Disallow UPDATE/DELETE on table with unpublished generated column as REPLICA IDENTITY

From: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, vignesh C <vignesh21(at)gmail(dot)com>
Subject: Re: Disallow UPDATE/DELETE on table with unpublished generated column as REPLICA IDENTITY
Date: 2024-12-06 05:40:26
Message-ID: CANhcyEWs=hH3-XmwudSzrQcG2ibiJvtMzcbPWYTXAOdLkNzK3A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, 6 Dec 2024 at 02:44, Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> On Thu, Dec 5, 2024 at 8:49 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> >
> > On Thu, Dec 5, 2024 at 9:32 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> > >
> > > On Thu, Dec 5, 2024 at 2:41 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
> > > >
> > > > On Thu, Dec 5, 2024 at 7:34 AM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
> > > > >
> > > > > IIUC, these errors are intended for when there is *any* unpublished
> > > > > generated column found in the RI, and the RI might also have other
> > > > > columns in it generated or otherwise. So, I think those error messages
> > > > > saying "consists of" should be reworded like below, or similar:
> > > > > * errdetail("Replica identity includes an unpublished generated column.")));
> > > > > * errdetail("Replica identity has one or more unpublished generated
> > > > > columns.")));
> > > > > * errdetail("One or more unpublished generated columns are in the
> > > > > Replica identity.")));
> > > > > * ...
> > > > >
> > > >
> > > > How about a bit clearer: "Replica identity must not contain any
> > > > unpublished generated column."?
> > > >
> > >
> > > Yes, that is better.
> > >
> > > Compare:
> > > Replica identity contains unpublished generated columns.
> > > Replica identity must not contain unpublished generated columns.
> > >
> > > Maybe it is just my imagination, but the "must not" version feels more
> > > like it implies the Replica Identify is in the wrong, whereas I think
> > > it is most likely that the Replica Identity is correct, and the real
> > > problem is that the user just forgot to publish the generated column.
> > >
> >
> > Either way is possible and I find the message "Replica identity must
> > not contain unpublished generated columns." clearer as compared to the
> > other option.
> >
>
> OK, let's go with that.
>

Thanks Peter, for pointing this out.
I also feel that the error message suggested by Amit would be better.
I have attached a patch for the same.

Thanks and Regards,
Shlok Kyal

Attachment Content-Type Size
v1-0001-Improve-error-message-introduced-in-commit-87ce27.patch application/octet-stream 3.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Devanga.Susmitha@fujitsu.com 2024-12-06 05:54:15 Popcount optimization using SVE for ARM
Previous Message Kirill Reshke 2024-12-06 05:40:18 Re: Use streaming read API in pgstattuple.