summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql_psycopg2/creation.py
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2011-11-19 14:18:44 +0000
committerAymeric Augustin <aymeric.augustin@m4x.org>2011-11-19 14:18:44 +0000
commit549c495875d279c17fbd418238a305bcc51cdad6 (patch)
tree2763a1e13a0d49dce325f8d923d3c2abda54412a /django/db/backends/postgresql_psycopg2/creation.py
parente41e3a543e3397e7bdd1409b58f5f17cb1f541b7 (diff)
downloaddjango-549c495875d279c17fbd418238a305bcc51cdad6.tar.gz
Used symbolic constants for psycopg2 isolation levels.
Django used the value 1 = ISOLATION_LEVEL_READ_UNCOMMITTED in some places, but PostgreSQL doesn't provide "read uncommited", it uses "read committed" instead: http://www.postgresql.org/docs/9.1/static/transaction-iso.html. For clarity, this commit uses ISOLATION_LEVEL_READ_COMMITTED = 2 where 1 was previously used. git-svn-id: http://code.djangoproject.com/svn/django/trunk@17112 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/postgresql_psycopg2/creation.py')
-rw-r--r--django/db/backends/postgresql_psycopg2/creation.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/django/db/backends/postgresql_psycopg2/creation.py b/django/db/backends/postgresql_psycopg2/creation.py
index e4e7428ea7..ca389b9046 100644
--- a/django/db/backends/postgresql_psycopg2/creation.py
+++ b/django/db/backends/postgresql_psycopg2/creation.py
@@ -1,3 +1,5 @@
+import psycopg2.extensions
+
from django.db.backends.creation import BaseDatabaseCreation
from django.db.backends.util import truncate_name
@@ -81,4 +83,5 @@ class DatabaseCreation(BaseDatabaseCreation):
def _prepare_for_test_db_ddl(self):
"""Rollback and close the active transaction."""
self.connection.connection.rollback()
- self.connection.connection.set_isolation_level(0)
+ self.connection.connection.set_isolation_level(
+ psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)