Skip to content

Commit

Permalink
autotest: ogr_pg.py: make it work with PostgreSQL release candidates
Browse files Browse the repository at this point in the history
With that, successfully passes test with PostgreSQL 17.0rc1 + PostGIS 3.4.3
  • Loading branch information
rouault committed Sep 5, 2024
1 parent 62dc186 commit a4db504
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 a4db504

Please sign in to comment.