aboutsummaryrefslogtreecommitdiff
path: root/pgruntime
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2026-08-05 19:16:05 +0200
committerStefan Majewsky <majewsky@gmx.net>2026-08-05 19:16:10 +0200
commit277411655ee3f7753433376af8bbefa1a98380ab (patch)
tree9393b695430b07874b529d7b78914e3e2a1bcc35 /pgruntime
parent197c01ef7119c4a9bfec4cf3793d90496ea5868f (diff)
downloadgo-gg-277411655ee3f7753433376af8bbefa1a98380ab.tar.gz
pgruntime: fix `psql --version` parsing on Ubuntu
This currently breaks all repeated calls to WithTestDB (i.e., all users where more than two packages call WithTestDB) within GH Actions.
Diffstat (limited to 'pgruntime')
-rw-r--r--pgruntime/testdb.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/pgruntime/testdb.go b/pgruntime/testdb.go
index 808784c..aa10c66 100644
--- a/pgruntime/testdb.go
+++ b/pgruntime/testdb.go
@@ -181,10 +181,13 @@ func wipeDBIfMajorUpgrade(testdbPath string) error {
return fmt.Errorf("could not run `psql --version`: %w", err)
}
- // output from `psql --version` should look like e.g. "psql (PostgreSQL) 18.4" -> we want just the version number part
+ // output from `psql --version` should look like e.g.
+ // "psql (PostgreSQL) 18.4" (seen on Arch Linux)
+ // "psql (PostgreSQL) 18.4 (Ubuntu 18.4-0ubuntu0.26.04.1)" (seen on Ubuntu)
+ // -> we want just the version number part
clientOutput := strings.TrimSpace(string(buf))
fields := strings.Fields(clientOutput)
- if len(fields) != 3 || fields[0] != "psql" || fields[1] != "(PostgreSQL)" {
+ if len(fields) < 3 || fields[0] != "psql" || fields[1] != "(PostgreSQL)" {
return fmt.Errorf("unexpected output from `psql --version`: %q", clientOutput)
}
clientVersion := fields[2]