Opened 7 years ago

Closed 6 years ago

Last modified 3 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@… 6 years ago.
EnterpriseDB patch

Download all attachments as: .zip

Change History (8)

comment:1 Changed 6 years ago by wgollino

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Version changed from SVN to 1.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 6 years ago by django@…

EnterpriseDB patch

comment:2 Changed 6 years ago by django@…

  • Has patch set

comment:3 Changed 6 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 6 years ago by kmtracey

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

comment:5 Changed 6 years ago by jacob

  • milestone set to 1.1
  • Summary changed from PostgreSQL version detection no longer works for EnterpriseDB to PostgreSQL version detection is fragile; no longer works for EnterpriseDB
  • Triage Stage changed from Unreviewed to Accepted

comment:6 Changed 6 years ago by mtredinnick

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:7 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

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