public inbox for [email protected]
help / color / mirror / Atom feedFrom: jian he <[email protected]>
To: Chao Li <[email protected]>
Cc: Postgres hackers <[email protected]>
Cc: Peter Eisentraut <[email protected]>
Subject: Re: Fix SET EXPRESSION for virtual columns with whole-row dependencies
Date: Tue, 9 Jun 2026 15:23:24 +0800
Message-ID: <CACJufxHTK0Qk7AwdrHK=y8OtK--zEVY-Ossxx4UUgxaE2NCAXA@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
On Tue, Jun 9, 2026 at 2:23 PM Chao Li <[email protected]> wrote:
>
> Hi,
>
> While testing “[f80bedd52] Allow ALTER COLUMN SET EXPRESSION on virtual columns”, I found that the feature missed handling whole-row check constraints.
>
> Here is a repro:
> ```
> evantest=# create table t(
> evantest(# a int,
> evantest(# b int generated always as (a*2) virtual,
> evantest(# constraint row_c check (t is not null)
> evantest(# );
> CREATE TABLE
> evantest=# insert into t(a) values(1);
> INSERT 0 1
> evantest=# alter table t alter b set expression as (nullif(a, 1));
> ALTER TABLE
> evantest=# select * from t;
> a | b
> ---+---
> 1 |
> (1 row)
> ```
>
> The ALTER TABLE should fail, because it makes b become NULL, which breaks the constraint row_c.
>
Hi.
In case you are wondering whole-row objects:
ALTER TABLE DROP COLUMN and ALTER COLUMN SET DATA TYPE are covered by
https://commitfest.postgresql.org/patch/5988 and
https://commitfest.postgresql.org/patch/6055.
Meanwhile, ALTER TABLE SET EXPRESSION is being handled over in
https://commitfest.postgresql.org/patch/6755
view thread (9+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Fix SET EXPRESSION for virtual columns with whole-row dependencies
In-Reply-To: <CACJufxHTK0Qk7AwdrHK=y8OtK--zEVY-Ossxx4UUgxaE2NCAXA@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox