ALTER TABLE command to change generation expression
Peter Eisentraut <peter@eisentraut.org>
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.gmail.com
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/ref/alter_table.sgml | modified | +12 −0 |
| src/backend/commands/tablecmds.c | modified | +186 −49 |
| src/backend/parser/gram.y | modified | +10 −0 |
| src/bin/psql/tab-complete.c | modified | +9 −1 |
| src/include/nodes/parsenodes.h | modified | +1 −0 |
| src/test/modules/test_ddl_deparse/test_ddl_deparse.c | modified | +3 −0 |
| src/test/regress/expected/generated.out | modified | +193 −24 |
| src/test/regress/sql/generated.sql | modified | +46 −6 |
Documentation touched
Discussion
- ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression 40 messages · 2023-08-02 → 2024-01-08