On Sat, 2009-05-02 at 06:57 -0700, Charlie DeTar wrote: > Karen Tracey wrote: > > Thing is, a side-effect of dealing with a test that raises an > > IntegrityError, using PostgreSQL, is you need a working rollback in > > order to recover. So, even though you may not be interested in actually > > testing rollback itself, you need it to work for this test to run > > properly. You need the call to actually get processed by the database, > > so that it will allow subsequent commands. And to get a working > > rollback, you need to use TransactionTestCase, not TestCase. > > Thanks Karen, that makes sense, and clears things up a lot, even > though I'm a bit surprised that the same code won't work for both > SQLite and PostgresSQL when there is nothing fundamentally different > happening to the data or logic in each case. > > After doing some digging, I see a lot of prior discussion and tickets > about postgres and connections after errors: > http://code.djangoproject.com/ticket/852 > http://code.djangoproject.com/changeset/8314 > http://code.djangoproject.com/ticket/8739 > http://code.djangoproject.com/ticket/10813 > http://code.djangoproject.com/changeset/10657 > > I expect a lot of the difficulty might arise from the fact that > postgres behaves differently from the other backends with regard to > how active one must be in transaction management. Perhaps postgres is > doing it the right way and the other backends let you get away with > being sloppy.
That last sentence is correct. > > It seems that Django could do something like automatically issue a > savepoint before each save operation and roll back to the savepoint if > the save operation fails; though this may be overhead and > automagicness that others would object to. That problem is also the big issue. Adding overhead for error cases at the expense of non-error cases (which are by far the majority situation) isn't acceptable. Also, savepoints simply aren't supported in all the versions of PostgreSQL we support (we still support 7.3). Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---