Skip to content

Commit

Permalink
Merge pull request #10736 from rouault/autotest_pg_postgresql_rc
Browse files Browse the repository at this point in the history
autotest: ogr_pg.py: make it work with PostgreSQL release candidates
  • Loading branch information
rouault committed Sep 7, 2024
2 parents 9fab616 + a4db504 commit 8a94525
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions autotest/ogr/ogr_pg.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,17 +247,21 @@ def pg_version(pg_autotest_ds):
feat = sql_lyr.GetNextFeature()
v = feat.GetFieldAsString("version")

pos = v.find(" ") # "PostgreSQL 12.0beta1" or "PostgreSQL 12.2 ...."
# return of version() is something like "PostgreSQL 12.0[rcX|betaX] ...otherstuff..."

tokens = v.split(" ")
assert len(tokens) >= 2
# First token is "PostgreSQL" (or some enterprise DB alternative name)
v = tokens[1]
pos = v.find("beta")
if pos > 0:
v = v[pos + 1 :]
pos = v.find("beta")
if pos > 0:
v = v[0:pos]
pos = v.find(" ")
v = v[0:pos]
else:
pos = v.find("rc")
if pos > 0:
v = v[0:pos]

return tuple([int(x) for x in v.split(".")])
return tuple([int(x) for x in v.split(".")])


@pytest.fixture(scope="module")
Expand Down

0 comments on commit 8a94525

Please sign in to comment.