From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: ALTER TABLE command to change generation expression
Date: Thu, 04 Jan 2024 15:46:04 +0000
Message-ID: <E1rLPv1-00DTYu-M8@gemulon.postgresql.org> (raw)
ALTER TABLE command to change generation expression
This adds a new ALTER TABLE subcommand ALTER COLUMN ... SET EXPRESSION
that changes the generation expression of a generated column.
The syntax is not standard but was adapted from other SQL
implementations.
This command causes a table rewrite, using the usual ALTER TABLE
mechanisms. The implementation is similar to and makes use of some of
the infrastructure of the SET DATA TYPE subcommand (for example,
rebuilding constraints and indexes afterwards). The new command
requires a new pass in AlterTablePass, and the ADD COLUMN pass had to
be moved earlier so that combinations of ADD COLUMN and SET EXPRESSION
can work.
Author: Amul Sul <sulamul@gmail.com>
Discussion: https://www.postgresql.org/message-id/flat/CAAJ_b94yyJeGA-5M951_Lr+KfZokOp-2kXicpmEhi5FXhBeTog@mail....
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/5d06e99a3cfc23bbc217b4d78b8c070ad52f720e
Modified Files
--------------
doc/src/sgml/ref/alter_table.sgml | 12 ++
src/backend/commands/tablecmds.c | 235 ++++++++++++++++-----
src/backend/parser/gram.y | 10 +
src/bin/psql/tab-complete.c | 10 +-
src/include/nodes/parsenodes.h | 1 +
.../modules/test_ddl_deparse/test_ddl_deparse.c | 3 +
src/test/regress/expected/generated.out | 217 ++++++++++++++++---
src/test/regress/sql/generated.sql | 52 ++++-
8 files changed, 460 insertions(+), 80 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: peter@eisentraut.org, pgsql-committers@lists.postgresql.org
Subject: Re: pgsql: ALTER TABLE command to change generation expression
In-Reply-To: <E1rLPv1-00DTYu-M8@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