Opened 16 years ago

Closed 15 years ago

Last modified 12 years ago

#8737 closed (fixed)

PostgreSQL version detection is fragile; no longer works for EnterpriseDB

Reported by: django@… Owned by: nobody
Component: Database layer (models, ORM) Version: 1.0
Severity: Keywords: postgresql, enterprisedb, version
Cc: fawad@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

It appears that line 16 in /db/backends/postgresql/versions.py breaks the PostgreSQL version detection for EnterpriseDB. The error returned is

File "/usr/lib/python2.5/site-packages/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'

Changing

VERSION_RE = re.compile(r'PostgreSQL (\d+)\.(\d+)\.')

to

VERSION_RE = re.compile(r'\S+ (\d+)\.(\d+)\.')

makes it work for both PostgreSQL and EnterpriseDB.

Attachments (1)

enterprisedb.diff (413 bytes ) - added by django@… 15 years ago.
EnterpriseDB patch

Download all attachments as: .zip

Change History (8)

comment:1 by wgollino, 15 years ago

Version: SVN1.0

I have the same issue with Django 1.0 + Postgresql 7.4. My app was working with a spring 2008 SVN checkout, and broke with the same error message as the original poster when upgrading to 1.0. The suggested RE change fixes it for me.

by django@…, 15 years ago

Attachment: enterprisedb.diff added

EnterpriseDB patch

comment:2 by django@…, 15 years ago

Has patch: set

comment:3 by fawad, 15 years ago

Cc: fawad@… added
Patch needs improvement: set

I'm running PostgreSQL 8.3 beta4, so had to modify the regular expression above to

VERSION_RE = re.compile(r'\S+ (\d+)\.(\d+)(?:\.|beta(?:\d+))')

comment:4 by Karen Tracey, 15 years ago

#9953 reports problem with release candidate version strings as well.

comment:5 by Jacob, 15 years ago

milestone: 1.1
Summary: PostgreSQL version detection no longer works for EnterpriseDBPostgreSQL version detection is fragile; no longer works for EnterpriseDB
Triage Stage: UnreviewedAccepted

comment:6 by Malcolm Tredinnick, 15 years ago

Resolution: fixed
Status: newclosed

(In [9931]) Fixed #8737 -- Made the PostgreSQL version number detection more flexible.

comment:7 by Jacob, 12 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top