pgsql: Generated columns
Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.
You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:
docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t212845psql -h localhost -U postgresBuilt from patchset v2 (message #2), July 29, 2026 at 12:53 AM.
Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:
git clone --branch t212845_2 https://github.com/hackorum-dev/postgres.gitIn a checkout you already have, add the fork once:
git remote add hackorum https://github.com/hackorum-dev/postgres.gitthen, for this patchset and every later one:
git fetch hackorum t212845_2 && git checkout t212845_2Patchset v2 (message #2) is on t212845_2
Generated columns
This is an SQL-standard feature that allows creating columns that are
computed from expressions rather than assigned, similar to a view or
materialized view but on a column basis.
This implements one kind of generated column: stored (computed on
write). Another kind, virtual (computed on read), is planned for the
future, and some room is left for it.
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Pavel Stehule <pavel.stehule@gmail.com>
Discussion: /messages/by-id/b151f851-4019-bdb1-699e-ebab07d2f40a@2ndquadrant.com
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/fc22b6623b6b3bab3cb057ccd282c2bfad1a0b30
Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out | 25 +
contrib/postgres_fdw/postgres_fdw.c | 3 +-
contrib/postgres_fdw/sql/postgres_fdw.sql | 14 +
doc/src/sgml/catalogs.sgml | 19 +-
doc/src/sgml/ddl.sgml | 118 ++++
doc/src/sgml/information_schema.sgml | 66 +-
doc/src/sgml/protocol.sgml | 4 +-
doc/src/sgml/ref/copy.sgml | 3 +-
doc/src/sgml/ref/create_foreign_table.sgml | 27 +-
doc/src/sgml/ref/create_table.sgml | 45 +-
doc/src/sgml/ref/create_trigger.sgml | 4 +-
doc/src/sgml/textsearch.sgml | 26 +-
doc/src/sgml/trigger.sgml | 18 +
src/backend/access/common/tupdesc.c | 11 +
src/backend/catalog/heap.c | 108 +++-
src/backend/catalog/information_schema.sql | 30 +-
src/backend/commands/copy.c | 31 +-
src/backend/commands/tablecmds.c | 167 +++++-
src/backend/commands/trigger.c | 31 +-
src/backend/commands/typecmds.c | 6 +-
src/backend/executor/execMain.c | 8 +-
src/backend/executor/execReplication.c | 11 +
src/backend/executor/nodeModifyTable.c | 112 ++++
src/backend/nodes/copyfuncs.c | 2 +
src/backend/nodes/equalfuncs.c | 2 +
src/backend/nodes/outfuncs.c | 9 +
src/backend/nodes/readfuncs.c | 1 +
src/backend/optimizer/plan/createplan.c | 8 +-
src/backend/optimizer/util/inherit.c | 6 +
src/backend/optimizer/util/plancat.c | 19 +
src/backend/parser/analyze.c | 27 +
src/backend/parser/gram.y | 14 +-
src/backend/parser/parse_agg.c | 11 +
src/backend/parser/parse_expr.c | 6 +
src/backend/parser/parse_func.c | 3 +
src/backend/parser/parse_relation.c | 19 +
src/backend/parser/parse_utilcmd.c | 66 +-
src/backend/replication/logical/proto.c | 9 +-
src/backend/replication/logical/relation.c | 2 +-
src/backend/replication/logical/tablesync.c | 6 +-
src/backend/replication/logical/worker.c | 2 +-
src/backend/replication/pgoutput/pgoutput.c | 2 +-
src/backend/rewrite/rewriteHandler.c | 36 +-
src/backend/utils/cache/lsyscache.c | 33 +
src/backend/utils/cache/partcache.c | 1 +
src/backend/utils/cache/relcache.c | 4 +
src/bin/pg_dump/pg_dump.c | 40 +-
src/bin/pg_dump/pg_dump.h | 1 +
src/bin/pg_dump/pg_dump_sort.c | 10 +
src/bin/pg_dump/t/002_pg_dump.pl | 17 +
src/bin/psql/describe.c | 23 +-
src/include/access/tupdesc.h | 1 +
src/include/catalog/catversion.h | 2 +-
src/include/catalog/heap.h | 4 +-
src/include/catalog/pg_attribute.h | 5 +
src/include/catalog/pg_class.dat | 2 +-
src/include/executor/nodeModifyTable.h | 2 +
src/include/nodes/execnodes.h | 3 +
src/include/nodes/parsenodes.h | 24 +-
src/include/optimizer/plancat.h | 2 +
src/include/parser/kwlist.h | 1 +
src/include/parser/parse_node.h | 3 +-
src/include/utils/lsyscache.h | 1 +
src/pl/plperl/expected/plperl_trigger.out | 95 +++
src/pl/plperl/plperl.c | 40 +-
src/pl/plperl/sql/plperl_trigger.sql | 36 ++
src/pl/plpgsql/src/pl_exec.c | 20 +
src/pl/plpython/expected/plpython_trigger.out | 94 +++
src/pl/plpython/plpy_cursorobject.c | 5 +-
src/pl/plpython/plpy_exec.c | 23 +-
src/pl/plpython/plpy_spi.c | 3 +-
src/pl/plpython/plpy_typeio.c | 17 +-
src/pl/plpython/plpy_typeio.h | 2 +-
src/pl/plpython/sql/plpython_trigger.sql | 37 ++
src/pl/tcl/expected/pltcl_trigger.out | 99 +++
src/pl/tcl/pltcl.c | 50 +-
src/pl/tcl/sql/pltcl_trigger.sql | 36 ++
src/test/regress/expected/create_table_like.out | 46 ++
src/test/regress/expected/generated.out | 768 ++++++++++++++++++++++++
src/test/regress/parallel_schedule | 2 +-
src/test/regress/serial_schedule | 1 +
src/test/regress/sql/create_table_like.sql | 14 +
src/test/regress/sql/generated.sql | 451 ++++++++++++++
src/test/subscription/t/011_generated.pl | 65 ++
84 files changed, 3065 insertions(+), 155 deletions(-)
On Sat, 30 Mar 2019 at 20:25, Peter Eisentraut <peter@eisentraut.org> wrote:
src/backend/utils/cache/lsyscache.c | 33 +
This change has caused a new compiler warning for compilers that don't
understand that elog(ERROR) can't return.
The attached fixes.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
On 2019-04-05 03:47, David Rowley wrote:
On Sat, 30 Mar 2019 at 20:25, Peter Eisentraut <peter@eisentraut.org> wrote:
src/backend/utils/cache/lsyscache.c | 33 +
This change has caused a new compiler warning for compilers that don't
understand that elog(ERROR) can't return.The attached fixes.
Fixed, thanks.
(I rewrote it a bit differently, to match similar functions.)
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services