Commit Graph

200 Commits (4e7aa59d64ffbf2559b5960757b95a245a74401c)

Author SHA1 Message Date
Lev Zakharov b301530a5f add doc for OpenDBFromPool 2023-09-09 08:13:56 -05:00
Lev Zakharov f42824cab3 update docs 2023-09-09 08:13:56 -05:00
Lev Zakharov 18856482c4 remove before/after acquire hooks 2023-09-09 08:13:56 -05:00
Lev Zakharov 639691c0ab add test for stdlib.OpenDBFromPool 2023-09-09 08:13:56 -05:00
Lev Zakharov 3e716c4b06 add example to the doc 2023-09-09 08:13:56 -05:00
Lev Zakharov 51ade172e5 refactor to use the same connection implementation 2023-09-09 08:13:56 -05:00
Lev Zakharov 3d4540aa1b add *sql.DB construction from *pgxpool.Pool 2023-09-09 08:13:56 -05:00
Jack Christensen d626dfe94e TestConnConcurrency has been failing on CI
This probably won't fix it, but at the very least we should not be
running assertions in a goroutine.
2023-07-28 18:13:31 -05:00
Jack Christensen 05440f9d3f Drastically increase allowed test times for potato CI
The context timeouts for tests are designed to give a better error
message when something hangs rather than the test just timing out.
Unfortunately, the potato CI frequently has some test or another
randomly take a long time. While the increased times are somewhat less
than optimal on a real computer, hopefully this will solve the
flickering CI.
2023-07-11 21:16:08 -05:00
Dan McGee 0328d314ea Use bytes.Equal rather than bytes.Compare ==/!= 0
As recommended by go-staticcheck, but also might be a bit more efficient
for the compiler to implement, since we don't care about which slice of
bytes is greater than the other one.
2023-07-08 12:08:05 -05:00
Nicola Murino 7fccc604af stdlib: add a concurrency test 2023-06-19 17:06:21 -05:00
Tomáš Procházka c2e278e5d4 simplify duplicate `pgx` registration guard
The binary search is overkill here.
Readability first.
2023-02-13 21:08:42 -06:00
Vitalii Solodilov 255f16b00f Register pgx driver using major version
Fixed: #1480
2023-02-10 19:18:45 -06:00
Alexey Palazhchenko f839d501a7 Apply `gofmt -s`
And add CI check for that.
2023-01-24 07:55:00 -06:00
Jack Christensen 335c8621ff Fix sqlScannerWrapper NULL handling
https://github.com/jackc/pgx/issues/1312
2022-09-24 10:30:12 -05:00
Jack Christensen 3595561d9a More doc improvements 2022-07-23 09:29:25 -05:00
Jack Christensen 78875bb95a Add tracing support
Replaces existing logging support. Package tracelog provides adapter for
old style logging.

https://github.com/jackc/pgx/issues/1061
2022-07-16 12:27:10 -05:00
Jack Christensen 03da9fcec6 Check conn liveness before using when idle for more than 1 second
Implemented in pgxpool.Pool and database/sql.

https://github.com/jackc/pgx/issues/672
2022-06-25 17:58:53 -05:00
Jack Christensen 468b793282 Skip tests with unsupported types on CockroachDB 2022-04-23 10:34:53 -05:00
Jack Christensen e94cf1fbaa Remove AcquireConn and ReleaseConn
Superseded by (*sql.Conn) Raw()
2022-04-16 14:07:59 -05:00
Jack Christensen a01a9ee6df Automatically register Array and FlatArray 2022-04-16 14:04:25 -05:00
Jack Christensen fccaebc93d Add pgtype.Map.SQLScanner
This enables compatibility with database/sql for types that cannot
implement Scan themselves.
2022-04-16 13:38:27 -05:00
Jack Christensen f14fb3d692 Replace interface{} with any 2022-04-09 09:12:55 -05:00
Jack Christensen 0d8e109c21 Test every QueryExecMode 2022-03-05 14:04:51 -06:00
Jack Christensen aad3d65e16 Initial restructure of simple protocol to query exec mode 2022-03-05 10:27:15 -06:00
Jack Christensen 1f2f239d09 Renamed pgtype.ConnInfo to pgtype.Map 2022-02-21 09:13:09 -06:00
Jack Christensen bda10b2ec9 Rename pgtype.DataType to pgtype.Type 2022-02-21 09:01:48 -06:00
Jack Christensen 4b6d527b0b Merge branch 'master' into v5-dev 2022-02-12 09:22:37 -06:00
Isabel Jimenez 71da600c3a exposing stdlib DB connector 2022-02-12 09:11:56 -06:00
Jack Christensen 5ed95dcd1c Expose wrap functions on ConnInfo
- Remove rarely used ScanPlan.Scan arguments
- Plus other refactorings and fixes that fell out of this change.
- Plus rows Scan now handles checking for changed type.
2022-01-22 17:50:19 -06:00
Jack Christensen 8b27725f5b Convert json and jsonb to Codec 2022-01-18 16:04:25 -06:00
Jack Christensen eec82c9433 Replace CID, OID, OIDValue, and XID with Uint32 2022-01-09 00:35:49 -06:00
Jack Christensen 9ab821620f Remove github.com/Masterminds/semver/v3 test dependency 2021-12-11 14:27:00 -06:00
Jack Christensen 72cc95e4dd Bump module version to v5 2021-12-11 13:29:03 -06:00
Jack Christensen 0e293b966c Finish import of pgconn 2021-12-04 14:06:57 -06:00
Jack Christensen 7e13db4538 Finish import of pgtype repo
Fix some tests that broke by merging repos
Tweak readme wording
2021-12-04 13:45:57 -06: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
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
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 a49f4bb135 Use errors instead of golang.org/x/xerrors 2021-03-25 09:55:12 -04:00
Jack Christensen 495d482f20 Fix PG version extraction in tests 2021-03-13 07:55:53 -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
Jack Christensen 09371f21d0 Use JSON format compat with PG and CockroachDB 2021-02-27 10:28:45 -06:00
Jack Christensen fea4bc4318 Use bigint in tests for compat. with CockroachDB 2021-02-27 10:26:14 -06:00
Jack Christensen fb60d0780e Skip unsupported testing functionality on CockroachDB 2021-02-27 10:25:45 -06:00
Jack Christensen 82bac82213 stdlib: consider any Ping failure as fatal
refs #672
2020-12-03 19:41:03 -06:00
Jack Christensen 4ebf1d2e0b Passthrough all parameters directly to pgx 2020-07-18 08:44:57 -05:00