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

Shlok Kyal <shlok.kyal.oss@gmail.com>

From: Shlok Kyal <shlok.kyal.oss@gmail.com>
To: "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>, Amit Kapila <amit.kapila16@gmail.com>, vignesh C <vignesh21@gmail.com>
Date: 2024-11-19T07:11:46Z
Lists: pgsql-hackers

Attachments

On Tue, 19 Nov 2024 at 09:50, Zhijie Hou (Fujitsu)
<houzj.fnst@fujitsu.com> wrote:
>
> On Tuesday, November 19, 2024 3:06 AM Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:
> >
> > I have fixed the comments and attached an updated patch.
>
> Thanks for the patch.
>
> I slightly refactored the codes a bit:
>
> * make the codes in replident_has_unpublished_gen_col()
> consistent with other similar functions.
>
> * Avoid unnecessary operations when there are no generated columns
> In the table.
>
> * Improve the loop by traversing the replica identity columns instead. I think
> it looks clearer this way and better aligns with the purpose of the
> replident_has_unpublished_gen_col function.
>
> * Some cosmetic changes in the comments.
>
>
> Please check the attached diff. Feel free to merge if it looks
> acceptable to you.
>

It looks good to me. I have added it to the latest patch.

Thanks and Regards,
Shlok Kyal

Commits

  1. Improve the error message introduced in commit 87ce27de696.

  2. Ensure stored generated columns must be published when required.

  3. Replicate generated columns when 'publish_generated_columns' is set.

  4. Ignore generated columns during apply of update/delete.

  5. Ignore dropped columns during apply of update/delete.