Hi, After looking through this mailing list I've seen many threads discussing issues relating to transaction issues with postgresql, but none like the one I'm facing. If I've missed any relevant thread, please let me know.
I've got a Profile model which is instantiated each time a new user is created: from models import Profile def create_profile_for_user(sender, instance, signal, created, *args, **kwargs): if kwargs['raw'] == False: # Test if we're not loading fixtures if created: profile = Profile(user=instance) profile.save() signals.post_save.connect(create_profile_for_user, sender=User) But when I try to create a new user from the admin, it crashes with the following traceback: File "/home/myuser/.virtualenvs/mysite/src/django/django/core/handlers/ base.py" in get_response 101. response = callback(request, *callback_args, **callback_kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/contrib/admin/ options.py" in wrapper 240. return self.admin_site.admin_view(view)(*args, **kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/utils/ decorators.py" in _wrapped_view 68. response = view_func(request, *args, **kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/views/ decorators/cache.py" in _wrapped_view_func 69. response = view_func(request, *args, **kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/contrib/admin/ sites.py" in inner 194. return view(request, *args, **kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/utils/ decorators.py" in _wrapper 21. return decorator(bound_func)(*args, **kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/utils/ decorators.py" in _wrapped_view 68. response = view_func(request, *args, **kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/utils/ decorators.py" in bound_func 17. return func(self, *args2, **kwargs2) File "/home/myuser/.virtualenvs/mysite/src/django/django/db/ transaction.py" in _commit_on_success 295. res = func(*args, **kw) File "/home/myuser/.virtualenvs/mysite/src/django/django/contrib/auth/ admin.py" in add_view 104. return super(UserAdmin, self).add_view(request, form_url, extra_context) File "/home/myuser/.virtualenvs/mysite/src/django/django/utils/ decorators.py" in _wrapper 21. return decorator(bound_func)(*args, **kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/utils/ decorators.py" in _wrapped_view 68. response = view_func(request, *args, **kwargs) File "/home/myuser/.virtualenvs/mysite/src/django/django/utils/ decorators.py" in bound_func 17. return func(self, *args2, **kwargs2) File "/home/myuser/.virtualenvs/mysite/src/django/django/db/ transaction.py" in _commit_on_success 306. leave_transaction_management(using=using) File "/home/myuser/.virtualenvs/mysite/src/django/django/db/ transaction.py" in leave_transaction_management 87. raise TransactionManagementError("Transaction managed block ended with pending COMMIT/ROLLBACK") Exception Type: TransactionManagementError at /admin/auth/user/add/ Exception Value: Transaction managed block ended with pending COMMIT/ ROLLBACK My database settings are as follows: DATABASES = { 'default': { 'NAME': 'mydb', 'ENGINE': 'django.db.backends.postgresql_psycopg2', 'USER': 'myuser', 'PASSWORD': 'secret', } } I've also tried to add 'OPTIONS': { "autocommit": True, } (following the recommendation in http://docs.djangoproject.com/en/dev/ref/databases/#autocommit-mode) but I still get the same error. Disconnecting the create_profile_for_user signal makes it work (but obviously no Profile object is instantiated). The weird thing is that everything works fine with Sqlite. So it's typically a postgresql issue. I'm using psql version 8.3.1 and a recent checkout of Django trunk. Any help would be very welcome, as I'm really baffled here. Many thanks! Regards, Julien -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.