#32588: Exception handling in contrib.postgres
--------------------------------------------+------------------------
               Reporter:  janholas          |          Owner:  (none)
                   Type:  Bug               |         Status:  new
              Component:  contrib.postgres  |        Version:
               Severity:  Normal            |       Keywords:
           Triage Stage:  Unreviewed        |      Has patch:  0
    Needs documentation:  0                 |    Needs tests:  0
Patch needs improvement:  0                 |  Easy pickings:  0
                  UI/UX:  0                 |
--------------------------------------------+------------------------
 When using contrib.postgres extension, this extension registers handlers
 that run Postgres-specific queries (feature discovery)
 
https://github.com/django/django/blob/main/django/contrib/postgres/signals.py#L16

 If you create a connection via psycopg2 to non-Postgres database (Redshift
 for example), the ProgrammingError exception should be ignored.
 
https://github.com/django/django/blob/main/django/contrib/postgres/signals.py#L44

 The problem is that this is catching psycopg2.ProgrammingError while when
 you make a new connection the exception is wrapped to
 django.db.utils.ProgrammingError in
 https://github.com/django/django/blob/main/django/db/utils.py#L90

 so the exceptions don't match and it's propagated to whatever caller
 created a connection.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32588>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.8f14ae36471ac1e9e0e57d1c0ca602ae%40djangoproject.com.

Reply via email to