From 704f2dfb7f9eca3b0890dd2df83f23f92f0a9849 Mon Sep 17 00:00:00 2001 From: Dmitry Nikitin Date: Sun, 28 Jan 2024 14:51:22 +0200 Subject: [PATCH] BugFix: Fixed dbname parameter - now it correctly works with PostgreSQL connection string in URI format postgresql:/// --- internal/db/postgres/pgdump/pgdump.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/db/postgres/pgdump/pgdump.go b/internal/db/postgres/pgdump/pgdump.go index 817dd9eb..d511c3e5 100644 --- a/internal/db/postgres/pgdump/pgdump.go +++ b/internal/db/postgres/pgdump/pgdump.go @@ -104,10 +104,11 @@ type Options struct { } func (o *Options) GetPgDSN() (string, error) { - //return "host=localhost port=5432 user=postgres dbname=postgres", nil - if strings.Contains(o.DbName, "=") { + // URI or Standard format + if strings.HasPrefix(o.DbName, "postgresql://") || strings.Contains(o.DbName, "=") { return o.DbName, nil } + return fmt.Sprintf("host=%s port=%d user=%s dbname=%s", o.Host, o.Port, o.UserName, o.DbName), nil }