Skip to content

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

chore: update pg_dump version (#7191)

Danny Xu737b26ccb901
diff --git a/backend/resources/postgres/postgres.go b/backend/resources/postgres/postgres.go
index be687f0ee6..7ad34aa37c 100644
--- a/backend/resources/postgres/postgres.go
+++ b/backend/resources/postgres/postgres.go
@@ -8,7 +8,6 @@ import (
"regexp"
"sort"
- "bytes"
"context"
"fmt"
"os"
@@ -47,20 +46,6 @@ const (
SampleDatabase = "employee"
)
-// isPgDump15 returns true if the pg_dump binary is version 15.
-func isPgDump15(pgDumpPath string) (bool, error) {
- var cmd *exec.Cmd
- var version bytes.Buffer
- cmd = exec.Command(pgDumpPath, "-V")
- cmd.Stdout = &version
- cmd.Stderr = os.Stderr
- if err := cmd.Run(); err != nil {
- return false, err
- }
- pgDump15 := "pg_dump (PostgreSQL) 15.1\n"
- return pgDump15 == version.String(), nil
-}
-
// Install will extract the postgres and utility tar in resourceDir.
// Returns the bin directory on success.
func Install(resourceDir string) (string, error) {
@@ -81,7 +66,6 @@ func Install(resourceDir string) (string, error) {
version := strings.TrimSuffix(tarName, ".txz")
pgBaseDir := path.Join(resourceDir, version)
pgBinDir := path.Join(pgBaseDir, "bin")
- pgDumpPath := path.Join(pgBinDir, "pg_dump")
needInstall := false
if _, err := os.Stat(pgBaseDir); err != nil {
@@ -90,23 +74,6 @@ func Install(resourceDir string) (string, error) {
}
// Install if not exist yet.
needInstall = true
- } else {
- // TODO(zp): remove this when pg_dump 15 is populated to all users.
- // Bytebase bump the pg_dump version to 15 to support PostgreSQL 15.
- // We need to reinstall the PostgreSQL resources if md5sum of pg_dump is different.
- // Check if pg_dump is version 15.
- isPgDump15, err := isPgDump15(pgDumpPath)
- if err != nil {
- return "", err
- }
- if !isPgDump15 {
- needInstall = true
- // Reinstall if pg_dump is not version 15.
- log.Info("Remove old postgres binary before installing new pg_dump...")
- if err := os.RemoveAll(pgBaseDir); err != nil {
- return "", errors.Wrapf(err, "failed to remove postgres binary base directory %q", pgBaseDir)
- }
- }
}
if needInstall {
log.Info("Installing PostgreSQL utilities...")