public inbox for [email protected]
help / color / mirror / Atom feedFrom: Peter Eisentraut <[email protected]>
To: [email protected]
Subject: pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK
Date: Tue, 24 Feb 2026 09:42:06 +0000
Message-ID: <[email protected]> (raw)
Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK constraints
Previously, changing the generation expression of a virtual column was
prohibited if the column was referenced by a CHECK constraint. This
lifts that restriction.
RememberAllDependentForRebuilding within ATExecSetExpression will
rebuild all the dependent constraints, later ATPostAlterTypeCleanup
queues the required AlterTableStmt operations for ALTER TABLE Phase 3
execution.
Overall, ALTER COLUMN SET EXPRESSION on virtual columns may require
scanning the table to re-verify any associated CHECK constraints, but
it does not require a table rewrite in ALTER TABLE Phase 3.
Author: jian he <[email protected]>
Reviewed-by: Matheus Alcantara <[email protected]>
Discussion: https://postgr.es/m/CACJufxH3VETr7orF5rW29GnDk3n1wWbOE3WdkHYd3iPGrQ9E_A@mail.gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/f80bedd52b1501de51b7180cd817e3e1fc31429d
Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 3 ++
src/backend/commands/tablecmds.c | 25 ++++------------
src/test/regress/expected/generated_virtual.out | 39 +++++++++++++++++++++----
src/test/regress/sql/generated_virtual.sql | 16 ++++++++--
4 files changed, 56 insertions(+), 27 deletions(-)
view thread (4+ 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]
Subject: Re: pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK
In-Reply-To: <[email protected]>
* 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