diff --git a/pq_driver.go b/pq_driver.go index d86c97bb..a4e26975 100644 --- a/pq_driver.go +++ b/pq_driver.go @@ -41,7 +41,7 @@ func parseURL(connstr string) (string, error) { return "", err } - if u.Scheme != "postgres" { + if u.Scheme != "postgresql" && u.Scheme != "postgres" { return "", fmt.Errorf("invalid connection protocol: %s", u.Scheme) } @@ -103,7 +103,7 @@ func (p *pqDriver) Parse(driverName, dataSourceName string) (*core.Uri, error) { db := &core.Uri{DbType: core.POSTGRES} o := make(values) var err error - if strings.HasPrefix(dataSourceName, "postgres://") { + if strings.HasPrefix(dataSourceName, "postgresql://") || strings.HasPrefix(dataSourceName, "postgres://") { dataSourceName, err = parseURL(dataSourceName) if err != nil { return nil, err