Skip to content

Commit

Permalink
Merge pull request dalibo#65 from fabriziomello/issue_64_add_support_…
Browse files Browse the repository at this point in the history
…to_version_10

Issue 64 add support to version 10
  • Loading branch information
julmon authored Jun 21, 2017
2 parents 5dac20c + 4d402bf commit 919e1cb
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions pgactivity/Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,16 +212,19 @@ def pg_get_num_version(self, text_version):
a string (SELECT version()).
"""
res = re.match(
r"^(PostgreSQL|EnterpriseDB) ([0-9]+)\.([0-9]+)\.([0-9]+)",
r"^(PostgreSQL|EnterpriseDB) ([0-9]+)\.([0-9]+)(?:\.([0-9]+))?",
text_version)
if res is not None:
rmatch = res.group(2)
if int(res.group(3)) < 10:
rmatch += '0'
rmatch += res.group(3)
if int(res.group(4)) < 10:
rmatch += '0'
rmatch += res.group(4)
if res.group(4) is not None:
if int(res.group(4)) < 10:
rmatch += '0'
rmatch += res.group(4)
else:
rmatch += '00'
self.pg_version = str(res.group(0))
self.pg_num_version = int(rmatch)
return
Expand All @@ -233,13 +236,16 @@ def pg_get_num_dev_version(self, text_version):
from a string (SELECT version()).
"""
res = re.match(
r"^(PostgreSQL|EnterpriseDB) ([0-9]+)\.([0-9]+)(devel|beta[0-9]+|rc[0-9]+)",
r"^(PostgreSQL|EnterpriseDB) ([0-9]+)(?:\.([0-9]+))?(devel|beta[0-9]+|rc[0-9]+)",
text_version)
if res is not None:
rmatch = res.group(2)
if int(res.group(3)) < 10:
rmatch += '0'
rmatch += res.group(3)
if res.group(3) is not None:
if int(res.group(3)) < 10:
rmatch += '0'
rmatch += res.group(3)
else:
rmatch += '00'
rmatch += '00'
self.pg_version = str(res.group(0))
self.pg_num_version = int(rmatch)
Expand Down

0 comments on commit 919e1cb

Please sign in to comment.