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: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Disallow UPDATE/DELETE on table with unpublished generated column as REPLICA IDENTITY
Date: 2024-11-08 11:06:03
Message-ID: CANhcyEVkDii8oSrzC2Ve8W5jM2n0On-tm4bowBqLVA5eVTUtdw@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Amit,

On Thu, 7 Nov 2024 at 11:37, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:
>
> On Tue, Nov 5, 2024 at 12:53 PM Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> wrote:
> >
> > To avoid the issue, we can disallow UPDATE/DELETE on table with
> > unpublished generated column as REPLICA IDENTITY. I have attached a
> > patch for the same.
> >
>
> +CREATE PUBLICATION pub_gencol FOR TABLE testpub_gencol;
> +UPDATE testpub_gencol SET a = 100 WHERE a = 1;
> +ERROR: cannot update table "testpub_gencol"
> +DETAIL: Column list used by the publication does not cover the
> replica identity.
>
> This is not a correct ERROR message as the publication doesn't have
> any column list associated with it. You have added the code to detect
> this in the column list code path which I think is not required. BTW,
> you also need to consider the latest commit 7054186c4e for this. I
> guess you need to keep another flag in PublicationDesc to detect this
> and then give an appropriate ERROR.

I have addressed the comments and provided an updated patch. Also, I
am currently working to fix this issue in back branches.

Thanks and Regards,
Shlok Kyal

Attachment Content-Type Size
v2-0001-Disallow-UPDATE-DELETE-on-table-with-generated-co.patch application/octet-stream 12.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Aleksander Alekseev 2024-11-08 11:18:00 Re: New "single" COPY format
Previous Message Alvaro Herrera 2024-11-08 11:00:40 Re: Fix small typo, use InvalidRelFileNumber instead of InvalidOid