public inbox for [email protected]help / color / mirror / Atom feed
pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK 4+ messages / 4 participants [nested] [flat]
* pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK @ 2026-02-24 09:42 Peter Eisentraut <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Peter Eisentraut @ 2026-02-24 09:42 UTC (permalink / raw) To: [email protected] 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(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* typo in alter_table.sgml (was: Re: pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK) @ 2026-02-26 14:16 Erik Rijkers <[email protected]> parent: Peter Eisentraut <[email protected]> 0 siblings, 2 replies; 4+ messages in thread From: Erik Rijkers @ 2026-02-26 14:16 UTC (permalink / raw) To: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]> Op 2/24/26 om 10:42 schreef Peter Eisentraut: > Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK constraints > [...] > > Branch > ------ > master > > Details > ------- > https://git.postgresql.org/pg/commitdiff/f80bedd52b1501de51b7180cd817e3e1fc31429d > > Modified Files > -------------- > doc/src/sgml/ref/alter_table.sgml | 3 ++ Hi, Typo in doc/src/sgml/ref/alter_table.sgml: - Replacing the expression of a virtual generated column do not require a + Replacing the expression of a virtual generated column does not require a Thanks, Erik Attachments: [text/x-patch] alter_table.sgml.20260226.diff (698B, 2-alter_table.sgml.20260226.diff) download | inline diff: --- doc/src/sgml/ref/alter_table.sgml.orig 2026-02-26 15:04:21.054592120 +0100 +++ doc/src/sgml/ref/alter_table.sgml 2026-02-26 15:05:24.878594162 +0100 @@ -278,7 +278,7 @@ 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. - Replacing the expression of a virtual generated column do not require a + Replacing the expression of a virtual generated column does not require a table rewrite, but if the column is used in a constraint, the table will be scanned to check that existing rows meet the constraint. </para> ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: typo in alter_table.sgml (was: Re: pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK) @ 2026-02-26 23:21 Chao Li <[email protected]> parent: Erik Rijkers <[email protected]> 1 sibling, 0 replies; 4+ messages in thread From: Chao Li @ 2026-02-26 23:21 UTC (permalink / raw) To: Erik Rijkers <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]> > On Feb 26, 2026, at 22:16, Erik Rijkers <[email protected]> wrote: > > Op 2/24/26 om 10:42 schreef Peter Eisentraut: >> Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK constraints >> [...] >> Branch >> ------ >> master >> Details >> ------- >> https://git.postgresql.org/pg/commitdiff/f80bedd52b1501de51b7180cd817e3e1fc31429d >> Modified Files >> -------------- >> doc/src/sgml/ref/alter_table.sgml | 3 ++ > > Hi, > > Typo in doc/src/sgml/ref/alter_table.sgml: > > > - Replacing the expression of a virtual generated column do not require a > + Replacing the expression of a virtual generated column does not require a > > Thanks, > > Erik > > <alter_table.sgml.20260226.diff> “Do” -> “does”, looks like a correct grammar fix to me. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/ ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: typo in alter_table.sgml (was: Re: pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK) @ 2026-03-02 02:35 Michael Paquier <[email protected]> parent: Erik Rijkers <[email protected]> 1 sibling, 0 replies; 4+ messages in thread From: Michael Paquier @ 2026-03-02 02:35 UTC (permalink / raw) To: Erik Rijkers <[email protected]>; +Cc: Peter Eisentraut <[email protected]>; PostgreSQL Hackers <[email protected]> On Thu, Feb 26, 2026 at 03:16:22PM +0100, Erik Rijkers wrote: > - Replacing the expression of a virtual generated column do not require > a > + Replacing the expression of a virtual generated column does not > require a Thanks. This applies only to HEAD. Grabbed that for later. -- Michael Attachments: [application/pgp-signature] signature.asc (833B, 2-signature.asc) download ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-03-02 02:35 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-02-24 09:42 pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK Peter Eisentraut <[email protected]> 2026-02-26 14:16 ` typo in alter_table.sgml (was: Re: pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK) Erik Rijkers <[email protected]> 2026-02-26 23:21 ` Re: typo in alter_table.sgml (was: Re: pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK) Chao Li <[email protected]> 2026-03-02 02:35 ` Re: typo in alter_table.sgml (was: Re: pgsql: Allow ALTER COLUMN SET EXPRESSION on virtual columns with CHECK) Michael Paquier <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox