Skip to content

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

fix: if external pg meta store port is missing, then use 5432 (#6163)

Tianzhou (天舟)6bfb77f38883
diff --git a/backend/plugin/db/pg/pg.go b/backend/plugin/db/pg/pg.go
index ed22de233d..38226b0416 100644
--- a/backend/plugin/db/pg/pg.go
+++ b/backend/plugin/db/pg/pg.go
@@ -86,7 +86,11 @@ func (driver *Driver) Open(_ context.Context, _ db.Type, config db.ConnectionCon
return nil, errors.Errorf("ssl-cert and ssl-key must be both set or unset")
}
- connConfig, err := pgx.ParseConfig(fmt.Sprintf("host=%s port=%s", config.Host, config.Port))
+ port := config.Port
+ if port == "" {
+ port = "5432"
+ }
+ connConfig, err := pgx.ParseConfig(fmt.Sprintf("host=%s port=%s", config.Host, port))
if err != nil {
return nil, err
}