From: Richard Guo <rguo@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Expand virtual generated columns for ALTER COLUMN TYPE
Date: Thu, 26 Jun 2025 03:18:32 +0000
Message-ID: <E1uUd8C-003NCp-0Q@gemulon.postgresql.org> (raw)
Expand virtual generated columns for ALTER COLUMN TYPE
For the subcommand ALTER COLUMN TYPE of the ALTER TABLE command, the
USING expression may reference virtual generated columns. These
columns must be expanded before the expression is fed through
expression_planner and the expression-execution machinery. Failing to
do so can result in incorrect rewrite decisions, and can also lead to
"ERROR: unexpected virtual generated column reference".
Reported-by: Alexander Lakhin <exclusion@gmail.com>
Reviewed-by: jian he <jian.universality@gmail.com>
Discussion: https://postgr.es/m/b5f96b24-ccac-47fd-9e20-14681b894f36@gmail.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5069fef1cfae271ca62e254b16dc831145bc5a4f
Modified Files
--------------
src/backend/commands/tablecmds.c | 3 +++
src/test/regress/expected/generated_virtual.out | 36 ++++++++++++++-----------
src/test/regress/sql/generated_virtual.sql | 10 ++++---
3 files changed, 30 insertions(+), 19 deletions(-)
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: pgsql-committers@postgresql.org
Cc: rguo@postgresql.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: Expand virtual generated columns for ALTER COLUMN TYPE
In-Reply-To: <E1uUd8C-003NCp-0Q@gemulon.postgresql.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox