#2655·pgx

Mismatch with libpq when hostaddr is specified in connection strings

Author: ur4tCreated Sep 17, 2026Updated Sep 17, 2026
Labelsbug

Describe the bug

Excited to see pgx's efforts to improve compatibility with libpq connection strings!

But there are still some vital mismatches.

Expected behavior

See https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-HOSTADDR

bash
$ psql "postgresql://[email protected]:54320/somedb?sslmode=require&host=hostname.for.sni&hostaddr=192.168.1.100"
Password for user someuser:
psql (18.4)
SSL connection (protocol: TLSv1.3, cipher: TLS_AES_128_GCM_SHA256, compression: off, ALPN: postgresql)
Type "help" for help.

somedb=>

Actual behavior

When specified, hostaddr is not obeyed and treated as unrecognized configuration parameter.

Version

  • Go: go version go1.26.8 linux/amd64
  • PostgreSQL: PostgreSQL 18.4 on x86_64-pc-linux-musl, compiled by gcc (Alpine 15.2.0) 15.2.0, 64-bit
  • pgx: v5.11.0

Additional context

I have digged a bit in pgconn/config.go. It seems to take some time to add new functionalities around hostaddr.