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

From jian he
Subject Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint
Date
Msg-id CACJufxFefRWT6wTkShcMoZ+enEXpyEb7if+GziFMSoMUZN_Csw@mail.gmail.com
Whole thread Raw
In response to Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint  (Matheus Alcantara <matheusssilv97@gmail.com>)
Responses Re: support ALTER COLUMN SET EXPRESSION over virtual generated column with check constraint
List pgsql-hackers
On Sat, Jan 17, 2026 at 12:07 AM Matheus Alcantara
<matheusssilv97@gmail.com> wrote:
>
> >
> >     <varlistentry id="sql-altertable-desc-set-expression">
> >      <term><literal>SET EXPRESSION AS</literal></term>
> >      <listitem>
> >       <para>
> >        This form replaces the expression of a generated column.  Existing data
> >        in a stored generated column is rewritten and all the future changes
> >        will apply the new generation expression.
> > +      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.
> >       </para>
>
> Sounds good.
>

hi.

I ultimately settled on the following:
+      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.



--
jian
https://www.enterprisedb.com

Attachment

pgsql-hackers by date:

Previous
From: Ashutosh Bapat
Date:
Subject: Re: tablecmds: clarify recurse vs recusing
Next
From: Tom Lane
Date:
Subject: Re: tablecmds: clarify recurse vs recusing