mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Fix > 9 PostgreSQL version numbering
This commit is contained in:
@@ -981,7 +981,7 @@ $$""".format(name, ' '.join(options)), name, password, password)
|
||||
>>> Postgresql.postgres_version_to_int('9.3.13')
|
||||
90313
|
||||
>>> Postgresql.postgres_version_to_int('10.1')
|
||||
100100
|
||||
100001
|
||||
>>> Postgresql.postgres_version_to_int('10')
|
||||
Traceback (most recent call last):
|
||||
...
|
||||
@@ -997,8 +997,8 @@ $$""".format(name, ' '.join(options)), name, password, password)
|
||||
if len(components) < 2 or len(components) > 3:
|
||||
raise Exception("Invalid PostgreSQL format: X.Y or X.Y.Z is accepted: {0}".format(pg_version))
|
||||
if len(components) == 2:
|
||||
# new style verion numbers, i.e. 10.1
|
||||
components.append('0')
|
||||
# new style verion numbers, i.e. 10.1 becomes 100001
|
||||
components.insert(1, '0')
|
||||
try:
|
||||
result = [c if int(c) > 10 else '0{0}'.format(c) for c in components]
|
||||
result = int(''.join(result))
|
||||
|
||||
Reference in New Issue
Block a user