> I don't agree the current savepoint use within Django is inconsistent. As > far as I can tell, savepoints are used internally in the one case where > Django itself catches and suppresses an IntegrityError. ... > Right now it is pretty simple: if your app code catches a database error it > must > do something to restore the DB connection to a usable state. With the patch > for #9205 would we be able to switch that to state that the app code will > never have to worry about clearing the error on the DB connection when it > catches a database error? If not then we would have less consistency than > before.
Thanks Karen - that's an interesting take on the #9205 situation. I agree that our current situation is that "if your app code catches a database error it must do something to restore the DB connection to a usable state" and that is a consistent position. However, this need to "do something" is specific to PostgreSQL - on all other databases which I'm aware of the problem does not arise and the DB connection always returns in a usable state (someone please correct me if I'm wrong here...). That doesn't strike me as nice - effectively we end up with PostgreSQL- specific code in the app code. You can see many examples of this in the current test suite where various calls to create(), save(), etc. are wrapped in savepoints for the benefit of PostgreSQL only. This also makes it easy to write a Django app (or Django core code!) which tests and runs fine on other databases, but is buggy on PostgreSQL since these savepoint wrappers were omitted. I'd much prefer to move towards a uniform position of "the Django framework will always return a usable DB connection". We're already there on all non-PostgreSQL databases. We're already there on PostgreSQL for some calls (like get_or_create). I think that we can easily get there in the remainder (like create, save). Does this fix ALL cases where an IntegrityError results in an unusable PostgreSQL db connection? I'd need more work here to really believe this. Certainly I believe that we can get ALL wrapping uses of savepoints out of the test suite, which would be a practical demonstration of getting to or very close to this goal! 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 -~----------~----~----~----~------~----~------~--~---