1
0
mirror of https://github.com/django/django.git synced 2025-10-25 22:56:12 +00:00

Changed postgresql and postgresql_psycopg2 backends NOT to do a SELECT version() for every connection, which was ludicrous. Now the version is only retrieved if it needs to be, via a lazy loader.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@6012 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2007-08-25 19:24:47 +00:00
parent de2881f9f2
commit 8b8a36c7d0
3 changed files with 12 additions and 9 deletions

View File

@@ -64,7 +64,4 @@ class DatabaseWrapper(BaseDatabaseWrapper):
cursor.tzinfo_factory = None
if set_tz:
cursor.execute("SET TIME ZONE %s", [settings.TIME_ZONE])
if self.ops.postgres_version is None:
cursor.execute("SELECT version()")
self.ops.postgres_version = [int(val) for val in cursor.fetchone()[0].split()[1].split('.')]
return cursor