-
The next release may change the default sslmode from
requiretoprefer. See #1271 for details. -
CopyIn()andCopyInToSchema()have been marked as deprecated. These are simple query builders and not needed forCOPY [..] FROM STDINsupport (which is not deprecated). (#1279)// Old tx.Prepare(CopyIn("temp", "num", "text", "blob", "nothing")) // Replacement tx.Prepare(`copy temp (num, text, blob, nothing) from stdin`)
Features
-
Support protocol 3.2, and the
min_protocol_versionandmax_protocol_versionDSN parameters (#1258). -
Support
sslmode=preferandsslmode=allow(#1270). -
Support
ssl_min_protocol_versionandssl_max_protocol_version(#1277). -
Support connection service file to load connection details (#1285).
-
Support
sslrootcert=systemand use~/.postgresql/root.crtas the default value of sslrootcert (#1280, #1281). -
Add a new
pqerrorpackage with PostgreSQL error codes (#1275).For example, to test if an error is a UNIQUE constraint violation:
if pqErr, ok := errors.AsType[*pq.Error](err); ok && pqErr.Code == pqerror.UniqueViolation { log.Fatalf("email %q already exsts", email) }To make this a bit more convenient, it also adds a
pq.As()function:pqErr := pq.As(err, pqerror.UniqueViolation) if pqErr != nil { log.Fatalf("email %q already exsts", email) }
Fixes
-
Fix SSL key permission check to allow modes stricter than 0600/0640#1265 (#1265).
-
Fix Hstore to work with binary parameters (#1278).
-
Clearer error when starting a new query while pq is still processing another query (#1272).
-
Send intermediate CAs with client certificates, so they can be signed by an intermediate CA (#1267).
-
Use
time.UTCfor UTC aliases such asEtc/UTC(#1282).