diff --git a/django/db/backends/postgresql/base.py b/django/db/backends/postgresql/base.py index a7503ec5338..1aeaa8b437e 100644 --- a/django/db/backends/postgresql/base.py +++ b/django/db/backends/postgresql/base.py @@ -86,7 +86,7 @@ class DatabaseWrapper(local): global postgres_version if not postgres_version: cursor.execute("SELECT version()") - postgres_version = [int(val) for val in cursor.dictfetchone()['version'].split()[1].split('.')] + postgres_version = [int(val) for val in cursor.fetchone()[0].split()[1].split('.')] if settings.DEBUG: return util.CursorDebugWrapper(cursor, self) return cursor diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py index c1b8ae59163..46ae67779d1 100644 --- a/django/db/backends/postgresql_psycopg2/base.py +++ b/django/db/backends/postgresql_psycopg2/base.py @@ -54,7 +54,7 @@ class DatabaseWrapper(local): global postgres_version if not postgres_version: cursor.execute("SELECT version()") - postgres_version = [int(val) for val in cursor.dictfetchone()['version'].split()[1].split('.')] + postgres_version = [int(val) for val in cursor.fetchone()[0].split()[1].split('.')] if settings.DEBUG: return util.CursorDebugWrapper(cursor, self) return cursor