Commit Graph

2711 Commits (fcc9dcc960ce72b86c050008c1be9d8c99a66adb)

Author SHA1 Message Date
Michael Darr 9a9830c00d Always double-wrap contextAlreadyDoneError
Signed-off-by: Michael Darr <michael.e.darr@gmail.com>
2021-07-07 18:14:36 -05:00
Michael Darr b3e64d3cdb Simplify SafeToRetry for ErrTimeout
Signed-off-by: Michael Darr <michael.e.darr@gmail.com>
2021-07-07 18:14:36 -05:00
Michael Darr c0b4d3bc05 Implement timeout error
Signed-off-by: Michael Darr <michael.e.darr@gmail.com>
2021-07-07 18:14:36 -05:00
Nicholas Wilson aafa04c156 Use zap.Any for handling interface{} -> zap.Field conversion
zap.Any falls back to zap.Reflect, but is better for this case, because
it first checks for the types that zap handles specially.  For example,
time.Duration, or error, which zap.Reflect will just treat as untyped
int64 or struct objects, but zap.Any is able to detect these types and
print them properly.
2021-07-06 20:18:16 -05:00
Cameron Daniel 3eceab0f38 Maintain host bits for inet types 2021-07-06 19:59:41 -05:00
Joshua Brindle a123e5b4e5 Add defaults for sslcert, sslkey, and sslrootcert
per https://www.postgresql.org/docs/current/libpq-ssl.html
psql will use client certs located in ~/.postgresql on posix systems
or %APPDATA%\postgresql on Windows systems.
2021-06-26 11:25:41 -05:00
Aliaksandr Mianzhynski 4a2209a1b4 Don't allocate buffer when tx opts are empty 2021-06-26 10:52:09 -05:00
Jack Christensen 2ca304d461 pgtype.Inet preserves masked address portion
fixes #111
2021-06-26 10:49:56 -05:00
mgoddard bf76d1ed51 Solve issue with 'sslmode=verify-full' when there are multiple hosts 2021-06-19 10:14:17 -05:00
Sivabalan Thirunavukkarasu bacf81fb4e Bumping versions for other dependencies 2021-06-19 10:06:47 -05:00
Sivabalan Thirunavukkarasu cfcd61d0cb Updating dependency versions 2021-06-19 10:06:47 -05:00
Sivabalan Thirunavukkarasu 2c22da0155 Bumping versions for other dependencies 2021-06-19 10:06:24 -05:00
Sivabalan Thirunavukkarasu 821e0521e4 Updating dependency versions 2021-06-19 10:06:24 -05:00
Dmytro Haranzha cabb58cc40 ResetSession hook is called before a connection is reused from pool for another query. 2021-06-12 13:48:31 -05:00
Ivan Daunis 5bca076182 Refactor to interface convert 2021-05-22 11:33:42 -05:00
Ivan Daunis 0977e29341 Support pointers of wrapping structs 2021-05-22 11:33:42 -05:00
Jack Christensen fb42201c18 Fix default host when parsing URL without host but with port
fixes https://github.com/jackc/pgconn/issues/72
2021-05-14 18:39:31 -05:00
dkinder 00feeaa5c9 stdlib: style nit in RandomizeHostOrderFunc 2021-05-10 08:17:53 -05:00
dkinder a8020a21e8 stdlib: add OptionBeforeConnect and randomizer
Fixes https://github.com/jackc/pgconn/issues/71
2021-05-10 08:17:53 -05:00
Rueian cae98b5e45
Register JSONBArray at NewConnInfo() 2021-05-03 22:20:58 +08:00
Jack Christensen 4380e23ae1 CompositeTextScanner handles backslash escapes
fixes https://github.com/jackc/pgx/issues/874
2021-04-24 08:08:34 -05:00
alex e722ca608c added url connection example 2021-04-17 09:56:17 -05:00
Jack Christensen 3f76b98073 Allow dbname query parameter in URL conn string
fixes #69
2021-04-09 18:20:06 -05:00
Andrew Kimball 3ab8941921 stdlib: Do not reuse ConnConfig strings
Previously, stdlib.RegisterConnConfig would sometimes reuse the same connection
string for different ConnConfig options (specifically, it happened when a connection
was open and then closed, and then a new, different connection was opened). This
behavior interferes with callers that expect that two connections with the same data
source name are connecting to the same backend database in the same way.

This fix updates stdlib.RegisterConnConfig to use an incrementing sequence
counter to uniquify all returned connection strings.

Fixes #947
2021-04-03 10:52:37 -05:00
Jonathan Amsterdam 88ede6efb5 stdlib: implement Conn.ResetSession
This prevents closed connections from being returned
by `database.sql.DB.Conn`.

Fixes #974.
2021-03-26 10:25:07 -05:00
Jack Christensen 909b81a163 Release v4.11.0 2021-03-25 10:21:28 -04:00
Jack Christensen 799cf1f04b Update copyright date 2021-03-25 10:08:09 -04:00
Jack Christensen 096f8ca754 Fix test in other time zones 2021-03-25 10:07:34 -04:00
Jack Christensen 2114ca9458 Update pgconn and pgtype 2021-03-25 09:59:38 -04:00
Jack Christensen a49f4bb135 Use errors instead of golang.org/x/xerrors 2021-03-25 09:55:12 -04:00
Jack Christensen 4a3a424dff Release v1.7.0 2021-03-25 09:16:43 -04:00
Jack Christensen 464a7d88d9 Release v1.8.1 2021-03-25 09:15:45 -04:00
Jack Christensen cdb667b5b0 Update copyright date 2021-03-25 09:15:45 -04:00
Jack Christensen 63e2dbefaf Update copyright date 2021-03-25 09:08:27 -04:00
Jack Christensen dd160540c4 Use Go 1.13 errors instead of xerrors 2021-03-25 09:08:27 -04:00
Ethan Pailes e8f75629d0 upgrade x/crypto to avoid CVE-2020-9283
I found this when scanning for security issues in some
dependencies. I doubt that this CVE will impact pgconn
since I don't think it uses the ssh cropto module, but
I think it is worth being fairly agressive about upgrading
security sensative libraries and this doesn't seem to be
a breaking change.
2021-03-23 07:44:35 -05:00
Jack Christensen 80147fd7cc Use sync.Once to guard pool.Close
This avoids the small possibility of 2 concurrent Close calls still
double closing the channel.
2021-03-19 08:58:56 -05:00
Matt Schultz fe366b2cf3 Prevent panics caused by attempting to close an already closed pgxpool.Pool. 2021-03-19 08:58:56 -05:00
Matt Schultz a0028cbd0d Handle SendBatch calls on closed transactions with null connections. This was previously panicking due to a null pointer exception as exposed in the provided unit test. 2021-03-19 08:38:19 -05:00
Jack Christensen 495d482f20 Fix PG version extraction in tests 2021-03-13 07:55:53 -06:00
Jack Christensen 1fcefdc73f Fix BeginTxFunc not passing txOptions
fixes #961
2021-03-13 07:43:08 -06:00
Rusakow Andrew 292539a590 Add comment support when sanitizing SQL queries 2021-03-13 07:31:56 -06:00
drewdogg aa89720576 go 1.13 2021-03-13 07:23:29 -06:00
Jack Christensen 00704ce8b7 Skip test on too old PostgreSQL 2021-03-13 07:18:26 -06:00
Jack Christensen e93da6c744 Fix ignored deferred error with database/sql QueryRow
fixes #958
2021-03-13 06:52:58 -06:00
Andrey Borodin 8990c125cf Stop fallback on ERRCODE_INVALID_AUTHORIZATION_SPECIFICATION 2021-03-12 08:31:29 -06:00
Andrey Borodin b6027e37f4 Stop fallback in case of invalid password 2021-03-12 08:31:29 -06:00
Andrey Borodin 70be4b4a02 Fix incoherent type assignment 2021-03-12 08:31:29 -06:00
Andrey Borodin 26ccb4ee08 Resume fallback on server error
When server responds with "TLS required" or too "many connections for role" fallbacks are not traversed any further. This could be OK, but fallbacks without TLS are added autoatically so that if we have multiple hosts requiring TLS we never traverse beyond first one.
2021-03-12 08:31:29 -06:00
Jack Christensen 0f1bda20b0 Fix numeric NaN support
fixes #93
2021-03-11 19:49:03 -06:00