github.com/lib/pq
v1.12.3
#413 most downloaded on Go modules
lib/pq
What this package is like to depend on
Last release 3 days ago
20 Aug 2026
Ships unpredictably
gaps range from 8 days to 3 months
Some releases are documented
notes for 10 of 31 stable releases
Nothing withdrawn
no release was ever pulled
14 years old
586 releases · first in 2012
180 releases in the last 12 months
see the full history below
Release timeline
586 releases · Mar 2012 to Aug 2026Releases
latest 60 of 586-
v1.12.4-0.20260820222753-451ac10e4e8520 Aug 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260818200449-4cd6ec55b31518 Aug 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260816161508-2835785690d516 Aug 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260803193607-f4654a41a62b03 Aug 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260803152524-727c63593b6403 Aug 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260727205347-10237a65609e27 Jul 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260726212313-c152f32e977b26 Jul 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260711203001-d70e69988c9f11 Jul 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260711194334-b125f757db3511 Jul 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260408231220-76df97d6b10508 Apr 2026 pre-releaseNothing published for this version
-
v1.12.4-0.20260408150540-004e5e8d262f08 Apr 2026 pre-releaseNothing published for this version
-
v1.12.303 Apr 2026Release notes
Open source →- Send datestyle startup parameter, improving compatbility with database engines that use a different default datestyle such as EnterpriseDB (#1312).
Release notes
Open source →- Send datestyle startup parameter, improving compatbility with database engines that use a different default datestyle such as EnterpriseDB (#1312).
-
v1.12.3-0.20260402111909-32ba56b8f9c002 Apr 2026 pre-releaseNothing published for this version
-
v1.12.202 Apr 2026Release notes
Open source →- Treat io.ErrUnexpectedEOF as driver.ErrBadConn so database/sql discards the connection. Since v1.12.0 this could result in permanently broken connections, especially with CockroachDB which frequently sends partial messages (#1299).
Release notes
Open source →- Treat io.ErrUnexpectedEOF as driver.ErrBadConn so database/sql discards the connection. Since v1.12.0 this could result in permanently broken connections, especially with CockroachDB which frequently sends partial messages (#1299).
-
v1.12.2-0.20260402094553-859f1049379902 Apr 2026 pre-releaseNothing published for this version
-
v1.12.2-0.20260401120409-6d77ced4171901 Apr 2026 pre-releaseNothing published for this version
-
v1.12.2-0.20260401102757-71daecbc452201 Apr 2026 pre-releaseNothing published for this version
-
v1.12.130 Mar 2026 -
v1.12.018 Mar 2026Release notes
Open source →-
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).
-
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(#1283).
Release notes
Open source →-
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).
-
-
v1.11.3-0.20260330125404-5a64c116462d30 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260318141442-6d40f13cfefe18 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260318010440-09624587cd3d18 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260317182133-620d6d50817f17 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260317141723-b36c912fcb9817 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260316120615-1e8ca8d7fb6716 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260316104545-cae0adb26cdd16 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260314210848-a2005c14515514 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260312213958-5e55bb7c2a7712 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260311235152-2a2614c3ca9d11 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260311225402-5db0f0d39a1d11 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260311160221-5d20cc3a948711 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260311035911-7517e07b322811 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260310152740-f3ef532aae5a10 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260310015834-59491bdcfc1710 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260309162715-c321a577676309 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260309134739-3b56ab470bab09 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260305160911-335685473c4605 Mar 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260218182013-89e7b23fe85918 Feb 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260212140111-262be4adbb8c12 Feb 2026 pre-releaseNothing published for this version
-
v1.11.3-0.20260212120307-91f52d151a8612 Feb 2026 pre-releaseNothing published for this version
-
v1.11.210 Feb 2026Release notes
Open source →This fixes two regressions:
-
Don't send startup parameters if there is no value, improving compatibility with Supavisor (#1260).
-
Don't send
dbnameas a startup parameter ifdatabase=[..]is used in the connection string. It's recommended to use dbname=, as database= is not a libpq option, and only worked by accident previously. (#1261)
Release notes
Open source →This fixes two regressions:
-
Don't send startup parameters if there is no value, improving compatibility with Supavisor (#1260).
-
Don't send
dbnameas a startup parameter ifdatabase=[..]is used in the connection string. It's recommended to use dbname=, as database= is not a libpq option, and only worked by accident previously. (#1261)
-
-
v1.11.129 Jan 2026 -
v1.11.028 Jan 2026Release notes
Open source →This version of pq requires Go 1.21 or newer.
pq now supports only maintained PostgreSQL releases, which is PostgreSQL 14 and newer. Previously PostgreSQL 8.4 and newer were supported.
Features
-
The
pq.Error.Error()text includes the position of the error (if reported by PostgreSQL) and SQLSTATE code (#1219, #1224):pq: column "columndoesntexist" does not exist at column 8 (42703) pq: syntax error at or near ")" at position 2:71 (42601) -
The
pq.Error.ErrorWithDetail()method prints a more detailed multiline message, with the Detail, Hint, and error position (if any) (#1219):ERROR: syntax error at or near ")" (42601) CONTEXT: line 12, column 1: 10 | name varchar, 11 | version varchar, 12 | ); ^ -
Add
Config,NewConfig(), andNewConnectorConfig()to supply connection details in a more structured way (#1240). -
Support
hostaddrand$PGHOSTADDR(#1243). -
Support multiple values in
host,port, andhostaddr, which are each tried in order, or randomly ifload_balance_hosts=randomis set (#1246). -
Support
target_session_attrsconnection parameter (#1246). -
Support
sslnegotiationto use SSL without negotiation (#1180). -
Allow using a custom
tls.Config, for example for encrypted keys (#1228). -
Add
PQGO_DEBUG=1print the communication with PostgreSQL to stderr, to aid in debugging, testing, and bug reports (#1223).
Fixes
-
Match HOME directory lookup logic with libpq: prefer $HOME over /etc/passwd, ignore ENOTDIR errors, and use APPDATA on Windows (#1214).
-
Fix
sslmode=verify-caverifying the hostname anyway when connecting to a DNS name (rather than IP) (#1226). -
Correctly detect pre-protocol errors such as the server not being able to fork or running out of memory (#1248).
-
Fix build with wasm (#1184), appengine (#745), and Plan 9 (#1133).
-
Deprecate and type alias
pq.NullTimetosql.NullTime(#1211). -
Enforce integer limits of the Postgres wire protocol (#1161).
-
Accept the
passfileconnection parameter to overridePGPASSFILE(#1129). -
Fix connecting to socket on Windows systems (#1179).
-
Don't perform a permission check on the .pgpass file on Windows (#595).
-
Warn about incorrect .pgpass permissions (#595).
-
Don't set extra_float_digits (#1212).
-
Decode bpchar into a string (#949).
-
Fix panic in Ping() by not requiring CommandComplete or EmptyQueryResponse in simpleQuery() (#1234)
-
Recognize bit/varbit (#743) and float types (#1166) in ColumnTypeScanType().
-
Accept
PGGSSLIBandPGKRBSRVNAMEenvironment variables (#1143). -
Handle ErrorResponse in readReadyForQuery and return proper error (#1136).
-
CopyIn() and CopyInSchema() now work if the list of columns is empty, in which case it will copy all columns (#1239).
-
Treat nil []byte in query parameters as nil/NULL rather than
""(#838). -
Accept multiple authentication methods before checking AuthOk, which improves compatibility with PgPool-II (#1188).
Release notes
Open source →This version of pq requires Go 1.21 or newer.
pq now supports only maintained PostgreSQL releases, which is PostgreSQL 14 and newer. Previously PostgreSQL 8.4 and newer were supported.
Features
-
The
pq.Error.Error()text includes the position of the error (if reported by PostgreSQL) and SQLSTATE code (#1219, #1224):pq: column "columndoesntexist" does not exist at column 8 (42703) pq: syntax error at or near ")" at position 2:71 (42601) -
The
pq.Error.ErrorWithDetail()method prints a more detailed multiline message, with the Detail, Hint, and error position (if any) (#1219):ERROR: syntax error at or near ")" (42601) CONTEXT: line 12, column 1: 10 | name varchar, 11 | version varchar, 12 | ); ^ -
Add
Config,NewConfig(), andNewConnectorConfig()to supply connection details in a more structured way (#1240). -
Support
hostaddrand$PGHOSTADDR(#1243). -
Support multiple values in
host,port, andhostaddr, which are each tried in order, or randomly ifload_balance_hosts=randomis set (#1246). -
Support
target_session_attrsconnection parameter (#1246). -
Support
sslnegotiationto use SSL without negotiation (#1180). -
Allow using a custom
tls.Config, for example for encrypted keys (#1228). -
Add
PQGO_DEBUG=1print the communication with PostgreSQL to stderr, to aid in debugging, testing, and bug reports (#1223).
Fixes
-
Match HOME directory lookup logic with libpq: prefer $HOME over /etc/passwd, ignore ENOTDIR errors, and use APPDATA on Windows (#1214).
-
Fix
sslmode=verify-caverifying the hostname anyway when connecting to a DNS name (rather than IP) (#1226). -
Correctly detect pre-protocol errors such as the server not being able to fork or running out of memory (#1248).
-
Fix build with wasm (#1184), appengine (#745), and Plan 9 (#1133).
-
Deprecate and type alias
pq.NullTimetosql.NullTime(#1211). -
Enforce integer limits of the Postgres wire protocol (#1161).
-
Accept the
passfileconnection parameter to overridePGPASSFILE(#1129). -
Fix connecting to socket on Windows systems (#1179).
-
Don't perform a permission check on the .pgpass file on Windows (#595).
-
Warn about incorrect .pgpass permissions (#595).
-
Don't set extra_float_digits (#1212).
-
Decode bpchar into a string (#949).
-
Fix panic in Ping() by not requiring CommandComplete or EmptyQueryResponse in simpleQuery() (#1234)
-
Recognize bit/varbit (#743) and float types (#1166) in ColumnTypeScanType().
-
Accept
PGGSSLIBandPGKRBSRVNAMEenvironment variables (#1143). -
Handle ErrorResponse in readReadyForQuery and return proper error (#1136).
-
Detect COPY even if the query starts with whitespace or comments (#1198).
-
CopyIn() and CopyInSchema() now work if the list of columns is empty, in which case it will copy all columns (#1239).
-
Treat nil []byte in query parameters as nil/NULL rather than
""(#838). -
Accept multiple authentication methods before checking AuthOk, which improves compatibility with PgPool-II (#1188).
-
-
v1.10.10-0.20260124225939-f1fae2ee382824 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260124163306-3815d03993a524 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260124145109-589ad43c7e1f24 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260122160210-dd34b7111be122 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260121132927-91312493ea5521 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260120205106-35ce81bceb2920 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260120192248-f1b4c41caf2720 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260120171330-7666f295e00e20 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260120165352-e5e969c2545320 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260119174321-e1fe05871beb19 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260119170123-fc449c66bdf619 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260119154117-9f5555d0b3b019 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260119141459-27a1c3ae5dcd19 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260119135242-dcaeb5e40f8919 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260118193048-13013dbb2e0018 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260113193107-cda033a1a46713 Jan 2026 pre-releaseNothing published for this version
-
v1.10.10-0.20260113130451-8a6eab49af6e13 Jan 2026 pre-releaseNothing published for this version