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

Zhijie Hou (Fujitsu) <houzj.fnst@fujitsu.com>

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

Attachments

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.

Best Regards,
Hou zj

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.