Skip to content

Commit 08db387

Browse files
committed
Adjust pgAdmin version comparision logic
Now that the current version of pgAdmin is greater than 9.9, the version comparison logic has to be updated to properly compare the values (i.e. we can no longer use a simple x < y to compare floats). This update makes the necessary adjustments so our code works as expected for newer versions of pgAdmin. Issue: PGO-2838
1 parent 5084bfe commit 08db387

File tree

1 file changed

+12
-4
lines changed
  • internal/controller/standalone_pgadmin

1 file changed

+12
-4
lines changed

internal/controller/standalone_pgadmin/users.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,19 @@ cd $PGADMIN_DIR
179179
}
180180

181181
var olderThan9_3 bool
182-
versionFloat, err := strconv.ParseFloat(pgadmin.Status.MinorVersion, 64)
183-
if err != nil {
184-
return err
182+
183+
// Validate the pgAdmin minor version is in the format "X.Y"
184+
parts := strings.Split(pgadmin.Status.MinorVersion, ".")
185+
if len(parts) != 2 {
186+
return errors.New("invalid pgAdmin minor version: " + pgadmin.Status.MinorVersion)
185187
}
186-
if versionFloat < 9.3 {
188+
189+
// Parse the major and minor versions
190+
major, _ := strconv.Atoi(parts[0])
191+
minor, _ := strconv.Atoi(parts[1])
192+
193+
// Check if the pgAdmin version is older than 9.3
194+
if major < 9 || (major == 9 && minor < 3) {
187195
olderThan9_3 = true
188196
}
189197

0 commit comments

Comments
 (0)