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: vignesh C <vignesh21(at)gmail(dot)com>
Cc: "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: Re: Disallow UPDATE/DELETE on table with unpublished generated column as REPLICA IDENTITY
Date: 2024-11-18 19:06:25
Message-ID: CANhcyEWQmhfApSZ0p-xfg_nNZ+tcu1m3jtvX1+TNchNeN0TkYw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 18 Nov 2024 at 19:19, vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> On Mon, 18 Nov 2024 at 13:07, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> wrote:
> >
> > Thanks for providing the comments.
> >
> > On Sat, 16 Nov 2024 at 17:29, vignesh C <vignesh21(at)gmail(dot)com> wrote:
> >
> > I have attached the updated version of the patch.
>
> Few comments:
> 1) We have the following check for cols validation and rf validation:
> /*
> * If we know everything is replicated and the column list is invalid
> * for update and delete, there is no point to check for other
> * publications.
> */
> if (pubdesc->pubactions.pubinsert && pubdesc->pubactions.pubupdate &&
> pubdesc->pubactions.pubdelete && pubdesc->pubactions.pubtruncate &&
> !pubdesc->cols_valid_for_update && !pubdesc->cols_valid_for_delete)
> break;
>
> Should we do this for replident_valid_for_update and
> replident_valid_for_delete also?
>
Yes, we can add this check.

> 2) This variable is not required, there is a warning:
> publicationcmds.c: In function ‘replident_has_unpublished_gen_col’:
> publicationcmds.c:486:41: warning: unused variable ‘x’ [-Wunused-variable]
Fixed

I have fixed the comments and attached an updated patch.

Thanks and Regards,
Shlok Kyal

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message David E. Wheeler 2024-11-18 19:19:07 Re: RFC: Additional Directory for Extensions
Previous Message Ilia Evdokimov 2024-11-18 18:33:16 Sample rate added to pg_stat_statements