Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: minor change (#8727)

Danny Xuee7893750a7e
diff --git a/backend/resources/README.md b/backend/resources/README.md
index e6075aaf20..5c966564ea 100644
--- a/backend/resources/README.md
+++ b/backend/resources/README.md
@@ -16,6 +16,14 @@ darwin/amd64 used for MacOS amd64: https://repo1.maven.org/maven2/io/zonky/test/
darwin/arm64v8 used for MacOS arm64v8: https://repo1.maven.org/maven2/io/zonky/test/postgres/embedded-postgres-binaries-darwin-arm64v8/14.2.0/embedded-postgres-binaries-darwin-arm64v8-14.2.0.jar
+### Embeded Postgres binary
+
+https://github.com/zonkyio/embedded-postgres-binaries
+
+./gradlew clean install -Pversion=16.0.0 -PpgVersion=16.0 -ParchName=amd64
+./gradlew clean install -Pversion=16.0.0 -PpgVersion=16.0 -ParchName=arm64v8
+
+Darwin should bring in "lib/libpq*".
## MySQL/mysqlutil
diff --git a/backend/resources/postgres/meta_instance.go b/backend/resources/postgres/meta_instance.go
index c416ace8c7..8374eb59b4 100644
--- a/backend/resources/postgres/meta_instance.go
+++ b/backend/resources/postgres/meta_instance.go
@@ -57,7 +57,7 @@ func upgradePostgres(dataDir, resourceDir, pgBinDir, pgDataDir, pgUser string, p
if version == "" {
return nil
}
- if version == currentPGVersion {
+ if version == currentVersion {
return nil
}
diff --git a/backend/resources/postgres/postgres.go b/backend/resources/postgres/postgres.go
index 9ee252a431..a6caac6870 100644
--- a/backend/resources/postgres/postgres.go
+++ b/backend/resources/postgres/postgres.go
@@ -21,7 +21,7 @@ import (
)
const (
- currentPGVersion = "14"
+ currentVersion = "14"
)
// Install will extract the postgres and utility tar in resourceDir.
@@ -34,10 +34,10 @@ func Install(resourceDir string) (string, error) {
tarName := pkgNamePrefix + ".txz"
var pgBaseDir string
- if currentPGVersion == "14" {
+ if currentVersion == "14" {
pgBaseDir = path.Join(resourceDir, pkgNamePrefix)
} else {
- pgBaseDir = path.Join(resourceDir, fmt.Sprintf("%s%s", pkgNamePrefix, currentPGVersion))
+ pgBaseDir = path.Join(resourceDir, fmt.Sprintf("%s-%s", pkgNamePrefix, currentVersion))
}
needInstall := false
if _, err := os.Stat(pgBaseDir); err != nil {
@@ -50,7 +50,7 @@ func Install(resourceDir string) (string, error) {
if needInstall {
slog.Info("Installing PostgreSQL utilities...")
// The ordering below made Postgres installation atomic.
- tmpDir := path.Join(resourceDir, fmt.Sprintf("tmp-%s%s", pkgNamePrefix, currentPGVersion))
+ tmpDir := path.Join(resourceDir, fmt.Sprintf("tmp-%s%s", pkgNamePrefix, currentVersion))
if err := installInDir(tarName, tmpDir); err != nil {
return "", err
}
diff --git a/backend/resources/postgres/sample_instance.go b/backend/resources/postgres/sample_instance.go
index c2d4091a0a..de91a9d2d3 100644
--- a/backend/resources/postgres/sample_instance.go
+++ b/backend/resources/postgres/sample_instance.go
@@ -12,7 +12,6 @@ import (
"regexp"
"sort"
"strconv"
- "strings"
"github.com/pkg/errors"
"golang.org/x/exp/slog"
@@ -47,8 +46,8 @@ func StartSampleInstance(ctx context.Context, pgBinDir, dataDir, sampleName stri
if err != nil {
return nil, err
}
- if !strings.HasPrefix(v, currentPGVersion) {
- slog.Warn("delete sample postgres with different version", slog.String("old", v), slog.String("new", currentPGVersion))
+ if v != currentVersion {
+ slog.Warn("delete sample postgres with different version", slog.String("old", v), slog.String("new", currentVersion))
err := os.RemoveAll(pgDataDir)
if err != nil {
return nil, err