Skip to content

Glossary: PostgreSQL for Developers

constraint violation exceptions

Also written: psycopg.errors, UniqueViolation, CheckViolation, ForeignKeyViolation, NotNullViolation

In psycopg, each constraint error from Postgres arrives as its own Python exception in psycopg.errors, so your code can catch it with try/except.

Where the book teaches it

Related terms

constraintpsycopg