Opened 8 years ago

Closed 8 years ago

Last modified 5 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: UI/UX:

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@… 8 years ago.
EnterpriseDB patch

Download all attachments as: .zip

Change History (8)

comment:1 Changed 8 years ago by wgollino

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.

Changed 8 years ago by django@…

Attachment: enterprisedb.diff added

EnterpriseDB patch

comment:2 Changed 8 years ago by django@…

Has patch: set

comment:3 Changed 8 years ago by fawad

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 Changed 8 years ago by Karen Tracey

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

comment:5 Changed 8 years ago by Jacob

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 Changed 8 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

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

comment:7 Changed 5 years ago by Jacob

milestone: 1.1

Milestone 1.1 deleted

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