Common SQL Errors

PostgreSQL 428C9 generated_always Error

August 4, 2025

Raised when an INSERT, COPY, or UPDATE supplies a value to a column defined as GENERATED ALWAYS (identity or stored generated).

Sign up for the latest in common SQL errors from the Galaxy Team!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

What is PostgreSQL error 428C9 (generated_always)?

PostgreSQL error 428C9 generated_always appears when you insert or update a column defined as GENERATED ALWAYS. Remove the column from the statement, or switch it to GENERATED BY DEFAULT, to resolve the issue.

Error Highlights

Typical Error Message

PostgreSQL Error 428C9

Error Type

Data Integrity Error

Language

PostgreSQL

Symbol

generated_always

Error Code

428C9

SQL State

Explanation

Table of Contents

What is PostgreSQL error 428C9 generated_always?

PostgreSQL raises error code 428C9 with the condition name generated_always when a statement tries to assign a value to a column declared as GENERATED ALWAYS. This category includes identity columns created with GENERATED ALWAYS AS IDENTITY and stored generated columns created with GENERATED ALWAYS AS (expression) STORED.

The server blocks manual writes to these columns to preserve data integrity because their values are supplied automatically by the database engine.

The error surfaces during INSERT, COPY, or UPDATE operations that explicitly reference the protected column.

When does it occur?

The failure appears immediately after the query planner detects the prohibited column assignment. Typical touchpoints include application ORM layers, bulk-load scripts, legacy migrations, and ad-hoc SQL run from an editor like Galaxy.

Why should you fix it promptly?

Ignoring the error leaves tables without fresh data, breaks CI pipelines, and can stall deployments.

Correcting the statement or the column definition ensures automated sequences and expressions continue to populate reliable primary keys and derived values.

.

Common Causes

Explicit INSERT list includes generated column

Specifying the generated column in the INSERT column list and providing a value forces PostgreSQL to raise 428C9.

UPDATE sets a value on generated column

Any UPDATE that changes a GENERATED ALWAYS column violates its read-only contract and triggers the error.

COPY FROM with header that names generated column

Bulk loads that map CSV columns to the generated field result in the same rejection.

Mistaken column definition

Developers sometimes intend GENERATED BY DEFAULT but choose GENERATED ALWAYS, making later data loads fail.

.

Related Errors

FAQs

Can I ever insert into a GENERATED ALWAYS column?

Yes. Use the OVERRIDING SYSTEM VALUE clause in the INSERT statement to bypass the automatic generation when absolutely necessary.

Does the error affect GENERATED BY DEFAULT columns?

No. BY DEFAULT columns accept manual values without raising 428C9 unless identity constraints like PRIMARY KEY are violated.

How do I bulk load legacy data?

Temporarily switch the column to GENERATED BY DEFAULT or use OVERRIDING SYSTEM VALUE during COPY or INSERT operations.

How does Galaxy help?

Galaxy highlights generated columns in the schema panel and its linter warns if you include them in an INSERT, preventing 428C9 before execution.

Start Querying with the Modern SQL Editor Today!
Welcome to the Galaxy, Guardian!
You'll be receiving a confirmation email

Follow us on twitter :)
Oops! Something went wrong while submitting the form.

Check out some other errors

Trusted by top engineers on high-velocity teams
Aryeo Logo
Assort Health
Curri
Rubie Logo
Bauhealth Logo
Truvideo Logo