Skip to content

Commit

Permalink
fix: Make it more robust to parse postgresql version string (#1415)
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol authored Jul 25, 2023
1 parent 78586d6 commit be16015
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions changes/1415.fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make the parsing routine of PostgreSQL version strings more robust with additional build tags
3 changes: 2 additions & 1 deletion src/ai/backend/manager/models/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ async def connect_database(
version_check_db = create_async_engine(url)
async with version_check_db.begin() as conn:
result = await conn.execute(sa.text("show server_version"))
major, minor, *_ = map(int, result.scalar().split("."))
version_str = result.scalar()
major, minor, *_ = map(int, version_str.partition(" ")[0].split("."))
if (major, minor) < (11, 0):
pgsql_connect_opts["server_settings"].pop("jit")
await version_check_db.dispose()
Expand Down

0 comments on commit be16015

Please sign in to comment.