#15117: get_or_create() raises "DatabaseError: no such savepoint" instead of
IntegrityError (PostgreSQL)
-------------------------------------+-------------------------------------
               Reporter:  akaihola   |          Owner:  nobody
                   Type:  Bug        |         Status:  new
              Milestone:             |      Component:  Database layer
                Version:  SVN        |  (models, ORM)
             Resolution:             |       Severity:  Normal
           Triage Stage:  Accepted   |       Keywords:
    Needs documentation:  0          |      Has patch:  0
Patch needs improvement:  0          |    Needs tests:  0
                                     |  Easy pickings:  0
-------------------------------------+-------------------------------------

Comment (by d0ugal):

 Another observation while I worked on this ticket: get_or_create has the
 following lines.

 {{{
             except IntegrityError, e:
                 transaction.savepoint_rollback(sid, using=self.db)
                 try:
                     return self.get(**lookup), False
                 except self.model.DoesNotExist:
                     raise e
 }}}

 Would it not be preferable to do the following to preserve the full
 original traceback?

 {{{
             except IntegrityError, e:
                 transaction.savepoint_rollback(sid, using=self.db)
                 try:
                     return self.get(**lookup), False
                 except self.model.DoesNotExist:
                     pass
                 raise
 }}}

 This is not directly related to the tickets issue, but to the more general
 problem of improving get_or_creates error reporting.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/15117#comment:6>
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 post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to