SQLSTATE 428C9Severity lowLab verified

Incident brief

Cannot insert a non-DEFAULT value into a GENERATED ALWAYS column

An INSERT supplied an explicit value for a GENERATED ALWAYS AS IDENTITY column. PostgreSQL only accepts a user value there when the statement says OVERRIDING SYSTEM VALUE.

What lands in your log

ERROR: cannot insert a non-DEFAULT value into column "id"

Reproduced on PostgreSQL 16.14Verified 2026-07-19 (isolated lab, PostgreSQL 16.14)Verified against PostgreSQL 16.14 in an isolated lab environment

In 10 seconds

What triggers it
Create a table with an id column declared GENERATED ALWAYS AS IDENTITY.
Fix
Omit the identity column from the INSERT and let the sequence assign it.
Proof
Reproduced on PostgreSQL 16.14 → Inserting an explicit id into a GENERATED ALWAYS AS IDENTITY column was rejected with SQLSTATE 428C9. Omitting id and using OVERRIDING SYSTEM VALUE both worked.

Fix

What to do right now

Application-level steps for this error.

  • Omit the identity column from the INSERT and let the sequence assign it.
  • If you truly must supply the value (data migration, backfill), add OVERRIDING SYSTEM VALUE.
  • If the app should normally set the value, declare the column GENERATED BY DEFAULT AS IDENTITY instead of ALWAYS.
Fix SQL
-- Omit the GENERATED ALWAYS identity column.
INSERT INTO invoices(amount) VALUES (42.00)
RETURNING id, amount;

Connected

Everything this error touches

Every page this SQLSTATE connects to: the concept that explains it, the runbooks that fix it, the parameters you tune to prevent it, and the sibling errors it travels with. All real cross-references. Jump straight in, or open the full interactive map.

Open in the interactive map →

Verification

PG 16.14
Last verified
2026-07-19 (isolated lab, PostgreSQL 16.14)
Verification scope
Verified against PostgreSQL 16.14 in an isolated lab environment
Audit status
reviewed
ShareLinkedInX

Went further?

Pro unlocks the second lab proof

Free page stops the bleeding. Pro adds the operational test, SQLSTATE audit, and deeper evidence, same error, more certainty.

FollowSubstackLinkedInnew errors · lab notes · hiring loops