| From: | Kevin K Biju <kevinkbiju(at)gmail(dot)com> |
|---|---|
| To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
| Subject: | Allowing ALTER COLUMN TYPE for columns in publication column lists |
| Date: | 2025-12-22 02:30:00 |
| Message-ID: | CAM45KeFjkyQufdErZQpC5p+gfdn=MYDUvQJ+xPWLMULJ-mnx3A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi,
Currently, ALTER COLUMN TYPE is blocked for any column with a
pg_publication_rel dependency, even when the column is only in a
publication's column list and not referenced in a row filter. This is
because both column lists and row filters create identical entries in
pg_depend. The code that raises this error was added in commit 5f4a1a0a [1]
ALTER COLUMN TYPE should have no adverse effects on column lists, so it
makes sense to unblock that case. This is done by looking up the
corresponding pg_publication_rel entry and fetching prqual (containing the
serialized row filter expression). In case prqual is NULL, the pg_depend
entry corresponds only to a column list and ALTER COLUMN TYPE is therefore
safe to apply.
There is, however, an edge case when a publication contains both column
lists and row filters, and the column being ALTERed is only in the former
and not in the latter. In this case, we need to actually parse prqual and
check if the column in question is present in it.
I've attached a patch that does both these checks, along with regression
tests.
Thanks,
Kevin
| Attachment | Content-Type | Size |
|---|---|---|
| v1-0001-Allow-ALTER-COLUMN-TYPE-for-publication-column-li.patch | application/x-patch | 11.1 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Chao Li | 2025-12-22 02:41:44 | Re: Fix memory leak in gist_page_items() of pageinspect |
| Previous Message | Chao Li | 2025-12-22 00:47:14 | Re: [PATCH v1] Fixed a spelling error in the comments in gininsert.c |