﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
12171	transaction.savepoint_rollback fails with postgresql DATABASE_ENGINE	Andrew Badr	nobody	"Calls to transaction.rollback_savepoint fail because they try to create a new cursor, which executes ""SET client_encoding to 'UNICODE'"" inside the already failed transaction. This is in 1.1 and trunk (r11724).

To repro: create a project w/the ""postgresql"" database backend, and do `python runtests.py get_or_create`.

Example traceback:
{{{	
 File ""/var/www/yourworld/ywot/views.py"", line 136, in send_edits
   tile, _ = Tile.objects.get_or_create(world=world, tileY=tileY, tileX=tileX)

 File ""/usr/local/lib/python2.6/dist-packages/django/db/models/manager.py"", line 123, in get_or_create
   return self.get_query_set().get_or_create(**kwargs)

 File ""/usr/local/lib/python2.6/dist-packages/django/db/models/query.py"", line 339, in get_or_create
   transaction.savepoint_rollback(sid)

 File ""/usr/local/lib/python2.6/dist-packages/django/db/transaction.py"", line 199, in savepoint_rollback
   connection._savepoint_rollback(sid)

 File ""/usr/local/lib/python2.6/dist-packages/django/db/backends/__init__.py"", line 67, in _savepoint_rollback
   self.cursor().execute(self.ops.savepoint_rollback_sql(sid))

 File ""/usr/local/lib/python2.6/dist-packages/django/db/backends/__init__.py"", line 81, in cursor
   cursor = self._cursor()

 File ""/usr/local/lib/python2.6/dist-packages/django/db/backends/postgresql/base.py"", line 127, in _cursor
   cursor.execute(""SET client_encoding to 'UNICODE'"")

ProgrammingError: ERROR:  current transaction is aborted, commands ignored until end of transaction block

SET client_encoding to 'UNICODE'
}}}"		closed	Database layer (models, ORM)	1.1		fixed		andrewbadr.etc@…	Accepted	0	0	0	0	0	0
