Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint - Mailing list pgsql-hackers

From Matheus Alcantara
Subject Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint
Date
Msg-id DFP9Q7B4R7TC.2YTXG1MRFDRFT@gmail.com
Whole thread Raw
In response to Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On Thu Jan 15, 2026 at 1:31 AM -03, jian he wrote:
> On Thu, Jan 15, 2026 at 5:02 AM Matheus Alcantara
> <matheusssilv97@gmail.com> wrote:
>>
>> Please see the attached diff for reference.
>
> hi.
> Your patch made the test more simple.
> so i added a ``\d gtest20``
>
> I aslo polished the commit message.
>
Thanks for the new version. The commit message seems better. Just a few
comments:

+    /*
+     * Find everything that depends on the column (constraints, indexes, etc),
+     * and record enough information to let us recreate the objects after
+     * rewrite.
+     */
+    RememberAllDependentForRebuilding(tab, AT_SetExpression, rel, attnum, colName);
+
Perhaps this comments should be updated since we are now collecting
these dependencies for virtual generated columns too that it not require
a table rewrite.

---

I think that it would be good to update the SET EXPRESSION AS
documentation on doc/src/sgml/ref/alter_table.sgml to mention that for
virtual columns the table is not rewritten but a full table scan may
still be needed if the column has check constraints.

--
Matheus Alcantara
EDB: https://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: remove the unneeded header file math.h in binaryheap.c
Next
From: Andres Freund
Date:
Subject: io_uring: Fix danger of completion getting reused before being read