PostgreSQL error code
PostgreSQL error 23502
23502 is the SQLSTATE PostgreSQL reports for not null violation, in class 23, Integrity Constraint Violation.
| SQLSTATE | 23502 |
|---|---|
| Condition name | not_null_violation |
| Class | 23 — Integrity Constraint Violation |
Reproduce it, then fix it
email is NOT NULL and the INSERT doesn’t give it a value, so it would be NULL. Supply one, or give the column a default. Run the broken query to see the error, then switch to the fixed one. Edit either freely; every run is rolled back.
INSERT INTO customers (id, first_name) VALUES (11, 'Kim') RETURNING *;
INSERT INTO customers (id, email, first_name) VALUES (11, 'kim@example.com', 'Kim') RETURNING *;