Обсуждение: Allowing ALTER COLUMN TYPE for columns in publication column lists
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
Вложения
Hi, I tested this patch on my current branch. The patch applied cleanly and all relevant regression tests got passed, including publication, subscription, dependency, and ALTER TABLE coverage. The behavior matches the intended semantics: ALTER COLUMN TYPE is allowed for columns used only in publication column lists, while remaining blocked when the column is referenced in a row filter. I see a failure in the rules regression test in my environment, but this also occurs without the patch and this appears unrelated. From my testing, the patch looks correct and ready for further review. Please let me know if any further testing or clarification would be helpful. Regards Soumya
Hi Soumya,
Thanks for testing. I had a look at the test failures, and after commit 67c20979 [1], a warning for creating a publication is only issued when the wal_level is set to minimal. I've updated the test output to reflect this and attached v2 of the patch.Regards,
Kevin[1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=67c20979ce72b8c236622e5603f9775968ff501c
On Mon, Jan 5, 2026 at 4:53 PM Soumya S Murali <soumyamurali.work@gmail.com> wrote:
Hi,
I tested this patch on my current branch.
The patch applied cleanly and all relevant regression tests got
passed, including publication, subscription, dependency, and ALTER
TABLE coverage. The behavior matches the intended semantics: ALTER
COLUMN TYPE is allowed for columns used only in publication column
lists, while remaining blocked when the column is referenced in a row
filter.
I see a failure in the rules regression test in my environment, but
this also occurs without the patch and this appears unrelated.
From my testing, the patch looks correct and ready for further review.
Please let me know if any further testing or clarification would be
helpful.
Regards
Soumya
Вложения
Hi all, Thank you for the updated patch. > Thanks for testing. I had a look at the test failures, and after commit 67c20979 [1], a warning for creating a publicationis only issued when the wal_level is set to minimal. I've updated the test output to reflect this and attachedv2 of the patch. > > Regards, > Kevin > > [1] https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=67c20979ce72b8c236622e5603f9775968ff501c > I have tested v2 of the patch on the current upstream master. The patch applied cleanly and all regression tests now got passed as expected. Regards, Soumya