PostgreSQL error code
PostgreSQL error 428C9
428C9 is the SQLSTATE PostgreSQL reports for generated always, in class 42, Syntax Error or Access Rule Violation.
| SQLSTATE | 428C9 |
|---|---|
| Condition name | generated_always |
| Class | 42 — Syntax Error or Access Rule Violation |
Reproduce it, then fix it
A GENERATED ALWAYS identity column fills itself in and refuses supplied values. Leave the column out, or add OVERRIDING SYSTEM VALUE when you really do need a specific id, as when copying data over. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
INSERT INTO tags (id, name) VALUES (1, 'sql');
INSERT INTO tags (name) VALUES ('sql') RETURNING *;