-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Closed
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.release-blocker
Milestone
Description
Go version
go version go1.26-devel_8aa1efa223 Sat Oct 11 08:51:54 2025 -0700 darwin/arm64
Output of go env in your module/workspace:
AR='ar'
CC='clang'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='1'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='clang++'
GCCGO='gccgo'
GO111MODULE=''
GOARCH='arm64'
GOARM64='v8.0'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/Users/jack/Library/Caches/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/Users/jack/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/f_/ys54bt8s5v54k1rqhs6jt92m0000gn/T/go-build2137266325=/tmp/go-build -gno-record-gcc-switches -fno-common'
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMOD='/Users/jack/dev/pgx/go.mod'
GOMODCACHE='/Users/jack/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='darwin'
GOPATH='/Users/jack/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/Users/jack/dev/vendor/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/Users/jack/Library/Application Support/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/Users/jack/dev/vendor/go/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.26-devel_8aa1efa223 Sat Oct 11 08:51:54 2025 -0700'
GOWORK=''
PKG_CONFIG='pkg-config'What did you do?
https://github.com/jackc/pgx/ uses url.Parse to parse PostgreSQL URL connection strings. PostgreSQL URL connection strings allow comma separated host:port pairs. e.g. postgres://jack:secret@foo:1,bar:2,baz:3/mydb?sslmode=disable for high availability connections.
What did you see happen?
As of e3be2d1 I get an error. I've reduced the differing behavior to the following test:
package pgx_test
import (
"net/url"
"testing"
)
func TestParseURL(t *testing.T) {
u, err := url.Parse("postgres://jack:secret@foo:1,bar:2,baz:3/mydb?sslmode=disable")
if err != nil {
t.Fatal(err)
}
if u.Host != "foo:1,bar:2,baz:3" {
t.Errorf("unexpected host: %s", u.Host)
}
}I get this error:
jack@glados ~/dev/pgx ±master⚡ » got -run=TestParseURL
--- FAIL: TestParseURL (0.00s)
url_test.go:11: parse "postgres://jack:secret@foo:1,bar:2,baz:3/mydb?sslmode=disable": invalid port ":1,bar:2,baz:3" after host
FAIL
exit status 1
FAIL github.com/jackc/pgx/v5 0.198s
What did you expect to see?
This may be an example of Hyrum's Law. Perhaps it never should have worked. But it used to work and now it doesn't.
If the new behavior stays it will mean pgx will need its own URL parser to preserve existing behavior and compatibility with PostgreSQL URLs.
Metadata
Metadata
Assignees
Labels
BugReportIssues describing a possible bug in the Go implementation.Issues describing a possible bug in the Go implementation.release-blocker