CHANGELOG.md (9331B)
1 unreleased 2 ---------- 3 4 5 v1.12.3 (2026-04-03) 6 -------------------- 7 - Send datestyle startup parameter, improving compatbility with database engines 8 that use a different default datestyle such as EnterpriseDB ([#1312]). 9 10 [#1312]: https://github.com/lib/pq/pull/1312 11 12 v1.12.2 (2026-04-02) 13 -------------------- 14 15 - Treat io.ErrUnexpectedEOF as driver.ErrBadConn so database/sql discards the 16 connection. Since v1.12.0 this could result in permanently broken connections, 17 especially with CockroachDB which frequently sends partial messages ([#1299]). 18 19 [#1299]: https://github.com/lib/pq/pull/1299 20 21 v1.12.1 (2026-03-30) 22 -------------------- 23 24 - Look for pgpass file in ~/.pgpass instead of ~/.postgresql/pgpass ([#1300]). 25 26 - Don't clear password if directly set on pq.Config ([#1302]). 27 28 [#1300]: https://github.com/lib/pq/pull/1300 29 [#1302]: https://github.com/lib/pq/pull/1302 30 31 v1.12.0 (2026-03-18) 32 -------------------- 33 34 - The next release may change the default sslmode from `require` to `prefer`. 35 See [#1271] for details. 36 37 - `CopyIn()` and `CopyInToSchema()` have been marked as deprecated. These are 38 simple query builders and not needed for `COPY [..] FROM STDIN` support (which 39 is *not* deprecated). ([#1279]) 40 41 // Old 42 tx.Prepare(CopyIn("temp", "num", "text", "blob", "nothing")) 43 44 // Replacement 45 tx.Prepare(`copy temp (num, text, blob, nothing) from stdin`) 46 47 ### Features 48 49 - Support protocol 3.2, and the `min_protocol_version` and 50 `max_protocol_version` DSN parameters ([#1258]). 51 52 - Support `sslmode=prefer` and `sslmode=allow` ([#1270]). 53 54 - Support `ssl_min_protocol_version` and `ssl_max_protocol_version` ([#1277]). 55 56 - Support connection service file to load connection details ([#1285]). 57 58 - Support `sslrootcert=system` and use `~/.postgresql/root.crt` as the default 59 value of sslrootcert ([#1280], [#1281]). 60 61 - Add a new `pqerror` package with PostgreSQL error codes ([#1275]). 62 63 For example, to test if an error is a UNIQUE constraint violation: 64 65 if pqErr, ok := errors.AsType[*pq.Error](err); ok && pqErr.Code == pqerror.UniqueViolation { 66 log.Fatalf("email %q already exsts", email) 67 } 68 69 To make this a bit more convenient, it also adds a `pq.As()` function: 70 71 pqErr := pq.As(err, pqerror.UniqueViolation) 72 if pqErr != nil { 73 log.Fatalf("email %q already exsts", email) 74 } 75 76 ### Fixes 77 78 - Fix SSL key permission check to allow modes stricter than 0600/0640#1265 ([#1265]). 79 80 - Fix Hstore to work with binary parameters ([#1278]). 81 82 - Clearer error when starting a new query while pq is still processing another 83 query ([#1272]). 84 85 - Send intermediate CAs with client certificates, so they can be signed by an 86 intermediate CA ([#1267]). 87 88 - Use `time.UTC` for UTC aliases such as `Etc/UTC` ([#1282]). 89 90 [#1258]: https://github.com/lib/pq/pull/1258 91 [#1265]: https://github.com/lib/pq/pull/1265 92 [#1267]: https://github.com/lib/pq/pull/1267 93 [#1270]: https://github.com/lib/pq/pull/1270 94 [#1271]: https://github.com/lib/pq/pull/1271 95 [#1272]: https://github.com/lib/pq/pull/1272 96 [#1275]: https://github.com/lib/pq/pull/1275 97 [#1277]: https://github.com/lib/pq/pull/1277 98 [#1278]: https://github.com/lib/pq/pull/1278 99 [#1279]: https://github.com/lib/pq/pull/1279 100 [#1280]: https://github.com/lib/pq/pull/1280 101 [#1281]: https://github.com/lib/pq/pull/1281 102 [#1282]: https://github.com/lib/pq/pull/1282 103 [#1283]: https://github.com/lib/pq/pull/1283 104 [#1285]: https://github.com/lib/pq/pull/1285 105 106 v1.11.2 (2026-02-10) 107 -------------------- 108 This fixes two regressions: 109 110 - Don't send startup parameters if there is no value, improving compatibility 111 with Supavisor ([#1260]). 112 113 - Don't send `dbname` as a startup parameter if `database=[..]` is used in the 114 connection string. It's recommended to use dbname=, as database= is not a 115 libpq option, and only worked by accident previously. ([#1261]) 116 117 [#1260]: https://github.com/lib/pq/pull/1260 118 [#1261]: https://github.com/lib/pq/pull/1261 119 120 v1.11.1 (2026-01-29) 121 -------------------- 122 This fixes two regressions present in the v1.11.0 release: 123 124 - Fix build on 32bit systems, Windows, and Plan 9 ([#1253]). 125 126 - Named []byte types and pointers to []byte (e.g. `*[]byte`, `json.RawMessage`) 127 would be treated as an array instead of bytea ([#1252]). 128 129 [#1252]: https://github.com/lib/pq/pull/1252 130 [#1253]: https://github.com/lib/pq/pull/1253 131 132 v1.11.0 (2026-01-28) 133 -------------------- 134 This version of pq requires Go 1.21 or newer. 135 136 pq now supports only maintained PostgreSQL releases, which is PostgreSQL 14 and 137 newer. Previously PostgreSQL 8.4 and newer were supported. 138 139 ### Features 140 141 - The `pq.Error.Error()` text includes the position of the error (if reported 142 by PostgreSQL) and SQLSTATE code ([#1219], [#1224]): 143 144 pq: column "columndoesntexist" does not exist at column 8 (42703) 145 pq: syntax error at or near ")" at position 2:71 (42601) 146 147 - The `pq.Error.ErrorWithDetail()` method prints a more detailed multiline 148 message, with the Detail, Hint, and error position (if any) ([#1219]): 149 150 ERROR: syntax error at or near ")" (42601) 151 CONTEXT: line 12, column 1: 152 153 10 | name varchar, 154 11 | version varchar, 155 12 | ); 156 ^ 157 158 - Add `Config`, `NewConfig()`, and `NewConnectorConfig()` to supply connection 159 details in a more structured way ([#1240]). 160 161 - Support `hostaddr` and `$PGHOSTADDR` ([#1243]). 162 163 - Support multiple values in `host`, `port`, and `hostaddr`, which are each 164 tried in order, or randomly if `load_balance_hosts=random` is set ([#1246]). 165 166 - Support `target_session_attrs` connection parameter ([#1246]). 167 168 - Support [`sslnegotiation`] to use SSL without negotiation ([#1180]). 169 170 - Allow using a custom `tls.Config`, for example for encrypted keys ([#1228]). 171 172 - Add `PQGO_DEBUG=1` print the communication with PostgreSQL to stderr, to aid 173 in debugging, testing, and bug reports ([#1223]). 174 175 - Add support for NamedValueChecker interface ([#1125], [#1238]). 176 177 178 ### Fixes 179 180 - Match HOME directory lookup logic with libpq: prefer $HOME over /etc/passwd, 181 ignore ENOTDIR errors, and use APPDATA on Windows ([#1214]). 182 183 - Fix `sslmode=verify-ca` verifying the hostname anyway when connecting to a DNS 184 name (rather than IP) ([#1226]). 185 186 - Correctly detect pre-protocol errors such as the server not being able to fork 187 or running out of memory ([#1248]). 188 189 - Fix build with wasm ([#1184]), appengine ([#745]), and Plan 9 ([#1133]). 190 191 - Deprecate and type alias `pq.NullTime` to `sql.NullTime` ([#1211]). 192 193 - Enforce integer limits of the Postgres wire protocol ([#1161]). 194 195 - Accept the `passfile` connection parameter to override `PGPASSFILE` ([#1129]). 196 197 - Fix connecting to socket on Windows systems ([#1179]). 198 199 - Don't perform a permission check on the .pgpass file on Windows ([#595]). 200 201 - Warn about incorrect .pgpass permissions ([#595]). 202 203 - Don't set extra_float_digits ([#1212]). 204 205 - Decode bpchar into a string ([#949]). 206 207 - Fix panic in Ping() by not requiring CommandComplete or EmptyQueryResponse in 208 simpleQuery() ([#1234]) 209 210 - Recognize bit/varbit ([#743]) and float types ([#1166]) in ColumnTypeScanType(). 211 212 - Accept `PGGSSLIB` and `PGKRBSRVNAME` environment variables ([#1143]). 213 214 - Handle ErrorResponse in readReadyForQuery and return proper error ([#1136]). 215 216 - Detect COPY even if the query starts with whitespace or comments ([#1198]). 217 218 - CopyIn() and CopyInSchema() now work if the list of columns is empty, in which 219 case it will copy all columns ([#1239]). 220 221 - Treat nil []byte in query parameters as nil/NULL rather than `""` ([#838]). 222 223 - Accept multiple authentication methods before checking AuthOk, which improves 224 compatibility with PgPool-II ([#1188]). 225 226 [`sslnegotiation`]: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNECT-SSLNEGOTIATION 227 [#595]: https://github.com/lib/pq/pull/595 228 [#745]: https://github.com/lib/pq/pull/745 229 [#743]: https://github.com/lib/pq/pull/743 230 [#838]: https://github.com/lib/pq/pull/838 231 [#949]: https://github.com/lib/pq/pull/949 232 [#1125]: https://github.com/lib/pq/pull/1125 233 [#1129]: https://github.com/lib/pq/pull/1129 234 [#1133]: https://github.com/lib/pq/pull/1133 235 [#1136]: https://github.com/lib/pq/pull/1136 236 [#1143]: https://github.com/lib/pq/pull/1143 237 [#1161]: https://github.com/lib/pq/pull/1161 238 [#1166]: https://github.com/lib/pq/pull/1166 239 [#1179]: https://github.com/lib/pq/pull/1179 240 [#1180]: https://github.com/lib/pq/pull/1180 241 [#1184]: https://github.com/lib/pq/pull/1184 242 [#1188]: https://github.com/lib/pq/pull/1188 243 [#1198]: https://github.com/lib/pq/pull/1198 244 [#1211]: https://github.com/lib/pq/pull/1211 245 [#1212]: https://github.com/lib/pq/pull/1212 246 [#1214]: https://github.com/lib/pq/pull/1214 247 [#1219]: https://github.com/lib/pq/pull/1219 248 [#1223]: https://github.com/lib/pq/pull/1223 249 [#1224]: https://github.com/lib/pq/pull/1224 250 [#1226]: https://github.com/lib/pq/pull/1226 251 [#1228]: https://github.com/lib/pq/pull/1228 252 [#1234]: https://github.com/lib/pq/pull/1234 253 [#1238]: https://github.com/lib/pq/pull/1238 254 [#1239]: https://github.com/lib/pq/pull/1239 255 [#1240]: https://github.com/lib/pq/pull/1240 256 [#1243]: https://github.com/lib/pq/pull/1243 257 [#1246]: https://github.com/lib/pq/pull/1246 258 [#1248]: https://github.com/lib/pq/pull/1248 259 260 261 v1.10.9 (2023-04-26) 262 -------------------- 263 - Fixes backwards incompat bug with 1.13. 264 265 - Fixes pgpass issue