﻿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
10842	Django 1.0.2 generates AttributeError with PostgreSql 8.4beta1	Horacio G. de Oro	nobody	"I get this exception with Django 1.0.2 + PostgrsSql 8.4 beta1 (compiled from source):
{{{
  File ""/path/to/project/Django-1.0.2/django/db/backends/__init__.py"", line 56, in cursor
    cursor = self._cursor(settings)
  File ""/path/to/project/Django-1.0.2/django/db/backends/postgresql_psycopg2/base.py"", line 92, in _cursor
    self.__class__._version = get_version(cursor)
  File ""/path/to/project/Django-1.0.2/django/db/backends/postgresql/version.py"", line 16, in get_version
    major, minor = VERSION_RE.search(version).groups()
AttributeError: 'NoneType' object has no attribute 'groups'
}}}

The problem is the RE used on django/db/backends/postgresql/version.py (django-1.0.2):
{{{
VERSION_RE = re.compile(r'PostgreSQL (\d+)\.(\d+)\.')
}}}

When asked for the version, PostgreSql 8.4beta1 returns:
'''PostgreSQL 8.4beta1 on i686-pc-linux-gnu, compiled by GCC gcc (Ubuntu 4.3.2-1ubuntu12) 4.3.2, 32-bit'''

The RE used in Django 1.1 works OK:
{{{
VERSION_RE = re.compile(r'\S+ (\d+)\.(\d+)')
}}}

(the '\S+' is used to support EnterpriseDB, see ticket #8737).

I think django/db/backends/postgresql/operations.py (django-1.0.2) should be modifyed too to make it compatible with EnterpriseDB.

Both files (version.py and operations.py) could be patched with fix_re_django-1.0.2.diff.
I've also attached fix_re_django-1.1-dev.diff that changes operations.py to support EnterpriseDB.

Other tickets (already closed) related to this are: #6433 #9931 #9953

I've tested that the patches are working against PostgreSQL 8.3 (Ubuntu 8.10) and PostgreSQL 8.4beta1 (from sources) but haven't check that those changes works well with EnterpriseDB.

Thanks!

Horacio

Related post: http://groups.google.com/group/django-developers/browse_thread/thread/7826f83429487a07
"		closed	Database layer (models, ORM)	1.0		fixed	postgresql	hgdeoro@…	Accepted	1	0	0	1	0	0
