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: Amit Kapila <amit.kapila16@gmail.com>
Cc: PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2024-11-08T11:06:03Z
Lists: pgsql-hackers
Attachments
- v2-0001-Disallow-UPDATE-DELETE-on-table-with-generated-co.patch (application/octet-stream) patch v2-0001
Hi Amit, On Thu, 7 Nov 2024 at 11:37, Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Tue, Nov 5, 2024 at 12:53 PM Shlok Kyal <shlok.kyal.oss@gmail.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
Commits
-
Improve the error message introduced in commit 87ce27de696.
- 2d0152d6147b 18.0 landed
-
Ensure stored generated columns must be published when required.
- 87ce27de6963 18.0 landed
-
Replicate generated columns when 'publish_generated_columns' is set.
- 7054186c4ebe 18.0 cited
-
Ignore generated columns during apply of update/delete.
- adedf54e659e 16.0 cited
-
Ignore dropped columns during apply of update/delete.
- b797def5951f 16.0 cited