From a3e2e73b6597ec6b2a35d50fb3a6afc02a542146 Mon Sep 17 00:00:00 2001 From: TossPig Date: Wed, 2 Sep 2015 04:16:03 +0800 Subject: [PATCH] PG connection URIs http://www.postgresql.org/docs/current/static/libpq-connect.html#LIBPQ-CONNSTRING --- pq_driver.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pq_driver.go b/pq_driver.go index d86c97bb..f665bed5 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" { 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://") { dataSourceName, err = parseURL(dataSourceName) if err != nil { return nil, err