Skip to content

Commit 8ae47bd

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 b19d410 commit 8ae47bd

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

  • internal/controller/standalone_pgadmin

internal/controller/standalone_pgadmin/users.go

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

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

0 commit comments

Comments
 (0)