diff --git a/conn.go b/conn.go index 9ba1e87c..9cb325fe 100644 --- a/conn.go +++ b/conn.go @@ -809,7 +809,7 @@ func ParseDSN(s string) (ConnConfig, error) { // ParseConnectionString parses either a URI or a DSN connection string. // see ParseURI and ParseDSN for details. func ParseConnectionString(s string) (ConnConfig, error) { - if strings.HasPrefix(s, "postgres://") || strings.HasPrefix(s, "postgresql://") { + if u, err := url.Parse(s); err == nil && u.Scheme != "" { return ParseURI(s) } return ParseDSN(s)