Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>, jian he <jian(dot)universality(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint
Date: 2026-02-24 09:44:21
Message-ID: b907a640-4b34-4f4a-9fa8-a2c60e27058f@eisentraut.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21.01.26 20:26, Matheus Alcantara wrote:
> On 21/01/26 02:10, jian he wrote:
>>> +      Replacing the expression of a virtual generated columns do not
>>> require a
>>> +      table rewrite, however if the column is part of a
>>> <literal>CHECK</literal>
>>> +      constraint expression, the constraint will be rebuilt,
>>> requiring a table
>>> +      scan to ensure that existing rows meet the constraint.
>>>
>>> I think that it sounds better with: "Replacing the expression of a
>>> virtual generated column does not require a table rewrite..."
>>
>> sure. please check the attached.
>>
>
> Thanks. The patch is in a good shape for me, I don't have any other
> comments. Perhaps we could move the CF status for "Ready for Committer"?

(As a matter of process, if you, as the reviewer, feel like you have
reviewed all you could, then it is appropriate for you to change the
status to "Ready for Committer".)

I have committed this.

I changed the wording in the documentation a bit, mentioning just
"constraints" in general, since this also applies to the existing
support for not-null constraints, and it would presumably apply to other
kinds of constraints as well, if we want to support those.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Anthonin Bonnefoy 2026-02-24 09:46:51 Re: Shutdown indefinitely stuck due to unflushed FPI_FOR_HINT record
Previous Message Peter Eisentraut 2026-02-24 09:42:06 pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK