Hi all,

I've got two open tickets against database savepoints (#11156 and
#9205) and think this is an area which we should take a look at for
1.2 - it is currently inconsistent, IMHO.


Savepoints are described here:
http://docs.djangoproject.com/en/dev/topics/db/transactions/#savepoints

There are two reasons that they exist:

1) As a feature in their own right.

2) To work around database exceptions invalidating PostgreSQL
transactions:
http://docs.djangoproject.com/en/dev/topics/db/transactions/#handling-exceptions-within-postgresql-transactions


At present, Django sometimes automatically uses savepoints in case 2,
and sometimes expects the user to do so. I'd like to improve the
consistency of this behaviour:


2a) Django already automatically uses savepoints inside some methods
(e.g. QuerySet.get_or_create). This means that a database exception
can never break the PostgreSQL transaction.

Here there's an efficiency issue on Oracle - this use of savepoints
should be PostgreSQL-specific, and isn't (see #11156).


2b) There are other similar methods, in which Django does not
automatically use savepoints (e.g. QuerySet.create, Model.save) but in
which database exceptions can easily occur and break the PostgreSQL
transaction - for instance when saving a model with a conflict on a
unique field.

Here it's a consistency issue. To make things easy for the end users,
I believe that Django should automatically add PostgreSQL-specific
savepoints in these cases too, just like in QuerySet.get_or_create
(see #9205).


Cheers,

Richard.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to