Opened 4 years ago

Closed 3 years ago

#19507 closed Bug (duplicate)

django.db doesn't wrap / replace psycopg2.InterfaceError

Reported by: pitrou Owned by: nobody
Component: Database layer (models, ORM) Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


django.db currently only wraps the backend's DatabaseError and IntegrityError. However, psycopg2 can raise a "psycopg2.InterfaceError: connection already closed" when trying to run a query more than once against an unavailable (e.g. stopped) database. This means catching django.db.DatabaseError isn't enough to catch all possible runtime errors (other than programming errors).

It would be nice if Django also replaced psycopg2's InterfaceError with a generic Django exception.

(note: slightly related with issue #15802)

Change History (4)

comment:1 Changed 4 years ago by ramiro

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

See also #15901.

comment:2 Changed 4 years ago by aaugustin

  • Triage Stage changed from Unreviewed to Accepted

comment:3 Changed 4 years ago by akaariai

  • Type changed from Uncategorized to Bug

comment:4 Changed 3 years ago by aaugustin

  • Resolution set to duplicate
  • Status changed from new to closed

Closing as a duplicate of #15901.

Note: See TracTickets for help on using tickets.
Back to Top