Postgres shouldn’t feel like a black box: Watch our product webinar to see the latest features.

V101: Foreign key constraint violation

Work in Progress

This documentation page is currently being worked on. We apologize for the page being incomplete or not available yet.

Category: Constraint Violations
SQLSTATE: 23503 (Class 23 — Integrity Constraint Violation: foreign_key_violation)
Urgency: low

Example Postgres Log Output:

ERROR: insert or update on table "weather" violates foreign key constraint "weather_city_fkey"
DETAIL: Key (city)=(Berkeley) is not present in table "cities".
STATEMENT: INSERT INTO weather VALUES ('Berkeley', 45, 53, 0.0, '1994-11-28');
ERROR: update or delete on table "test" violates foreign key constraint "test_fkey" on table "othertest"
DETAIL: Key (id)=(123) is still referenced from table "othertest".
STATEMENT: DELETE FROM test WHERE id = 123

Explanation:

...

Recommended Action:

...

Learn More:

No additional resources available.


Download Free eBook: The Top 6 Postgres Log Events
Couldn't find what you were looking for or want to talk about something specific?
Start a conversation with us →