Generated columns
Stored generated columns (GENERATED ALWAYS AS ... STORED) computed on write, and their restrictions and bugs. Introduced in PostgreSQL 12.
Versions
- PostgreSQL 20 · worked-on · improved · moderate
- PostgreSQL 19 · worked-on · improved · moderate
- PostgreSQL 17 · shipped · improved · moderate · 3 commits · +704 / -300 lines
Threads
- Adding a stored generated column without long-lived locks
- BUG #19947: Rules see parent generated expression instead of routed partition's expression
- ALTER COLUMN SET EXPRESSION on partitions not work in case of constraint dependencies
- [PATCH v1] Fix for bug #19773 : pg_dump differing generation expressions of inherited columns
- BUG #19907: INSERT through partitioned table fails with domain-typed generated column
- Fix exclude generated columns in COPY TO with RLS
- BUG #19773: pg_dump omits a different generation expression of an inherited column in a child table
- bug, ALTER TABLE call ATPostAlterTypeCleanup twice for the same relation
- Fix inherited constraint loss in ALTER COLUMN SET EXPRESSION
- Fix ALTER COLUMN ... DROP EXPRESSSION with subpartitions
- Bug: Rule actions see wrong values for generated columns (NEW.gen reads OLD value)
- [BUG] Excessive memory usage with update on STORED generated columns.
- Fix ALTER TABLE DROP EXPRESSION with inheritance hierarchy
- Why cannot alter a column's type when it's used by a generated column
- BUG #19084: dump/restore table doesn't work with GENARETED column and custom type and cast in function
- Error in example
- Doc: Add note for running ANALYZE after ALTER TABLE ... SET EXPRESSION
- wrong comments in rewriteTargetListIU
- ALTER COLUMN SET DATA TYPE does not change the generation expression's collation
- bug in stored generated column over domain with constraints.
- disallow ALTER VIEW SET DEFAULT when the corresponding base relation column is a generated column
- BUG #18097: Immutable expression not allowed in generated at
- updatable view set default interact with base rel generated stored columns
- Disallow USING clause when altering type of generated column
- A generated column cannot be part of a partition key
- BUG #18464: Replacing a SQL function silently drops the generated columns that use this function
- BUG #18392: Can't restore database (using pg_restore) after latest Feb 8 update
- BUG #18346: pg restore issue with generated cloumn in Postgres v13.14
- ALTER COLUMN ... SET EXPRESSION to alter stored generated column's expression
- BUG #18067: Droping function that was used to generate column drops the column, even after `DROP EXPRESSION`
- memory leak in trigger handling (since PG12)
- BUG #17970: FEATURE REQUEST-allow re-adding GENERATED ALWAYS AS constraint to existing columns after removing it
- BUG #17960: pg_dump does not backup generated columns correctly.
- BUG #17823: Generated columns not always updated correctly
- ATTACH PARTITION seems to ignore column generation status
- UPDATE operation terminates logical replication receiver process due to an assertion
- moving extraUpdatedCols out of RangeTblEntry (into ModifyTable)
- generated columns bug, see inconsistent data
- Generated column using function
- Bug / Unintentional Feature: non-immutable functions can be used for generated columns.
- GENERATED ALWAYS AS - Not Consistent with MD5
- BUG #17439: DROP FUNCTION functionName(); drops associated generated column without using CASCADE
- Generated column and partitioning bug
- Note that ALTER TABLE cannot alter generated stored columns
- BUG #17036: generated column cann't modifyed auto when update
- Generated column is not updated (Postgres 13)
- pg_restore - generated column - not populating
- Dumping/restoring fails on inherited generated column
- Multiple Values Inserts for Generated Columns Erroring Out
- BUG #16924: Backup and Restore fails for Generated Columns in Declarative Partitioning
- Bug: Cannot insert multiple records using DEFAULT keyword for generated column
- BUG #16743: psql doesn't show whole expression in stored column
- [bug+patch] Inserting DEFAULT into generated columns from VALUES RTE
- generated columns in MergeAttributesIntoExisting
- BUG #16671: "generated always as" is ignored when updating table through view
- BUG #16622: pg_dump produces erroneus ALTER TABLE statement for a table with an inherited generated column
- Stored columns: Unexpected varattno in expression to be mapped
- BUG #16441: Cannot multi-insert into generated column with DEFAULT value
- fill_extraUpdatedCols is done in completely the wrong place
- BUG #16395: error when selecting generated column in a foreign table
- While restoring -getting error if dump contain sql statements generated from generated.sql file
- BUG #16369: Segmentation Faults and Data Corruption with Generated Columns
- BUG #16342: CREATE TABLE LIKE INCLUDING GENERATED column order issue
- BUG #16328: Generated column and inheritance: strange default error
- Generated column and inheritance: strange default error
- Optimize update of tables with generated columns
- relcache sometimes initially ignores has_generated_stored
- Brokenness in dump/restore for GENERATED expressions
- ALTER TABLE support for dropping generation expression
- ERROR: attribute number 6 exceeds number of columns 5
- doc correction
- identity column behavior in WHEN condition for BEFORE EACH ROW trigger
- Generated column and string concatenation issue
- Changing GENERATED ALWAYS AS expression
- BUG #15849: (Document) Generated Columns sample code has a strange expression
- Missing generated column in ALTER TABLE ADD COLUMN doc
- Docs for Generated Columns
- Generated columns and indexes
- Why does ExecComputeStoredGenerated() form a heap tuple
- generated columns