Diagnostic Queries
Symptoms
An UPDATE tried to set a new value on a GENERATED ALWAYS stored column. Such columns can only be set to DEFAULT (to recompute), so PostgreSQL raises SQLSTATE 428C9 (generated_always).
- The target is a stored generated column.
- You may only assign
DEFAULTto it. - Common when updating a computed column directly.
What the server log shows
ERROR: column "full_name" can only be updated to DEFAULT
DETAIL: Column "full_name" is a generated column.
Why PostgreSQL raises this — what the manual says
Section 5.5 Generated Columns:
“In INSERT or UPDATE commands, a value cannot be specified for a generated column, but the keyword DEFAULT may be specified.”
A stored generated column’s value is always derived from its expression. Writing an arbitrary value would break that invariant, so PostgreSQL only allows assigning DEFAULT (recompute) and otherwise reports 428C9.
Common causes
- Updating a generated column with a literal/expression.
- An ORM including the generated column in the SET list.
- Expecting to override a computed value directly.
How to fix it
- Remove the generated column from the UPDATE SET list.
- Assign
DEFAULTto force recomputation if needed. - Change the source columns that feed the generation expression instead.
Related & next steps
Reference: PostgreSQL 18 Section 5.4 “Generated Columns”.
Thanks — noted. This helps keep the database accurate.