Commit Graph

1899 Commits (a0028cbd0de2eb3c332aefff381bc7a852abb62c)

Author SHA1 Message Date
Jack Christensen 95907c29ce Update pgconn and pull in fix for QueryRow with empty SQL 2020-03-07 13:27:01 -06:00
Jack Christensen 9e495df1d5 Add test for rollback failure 2020-02-29 09:48:16 -06:00
Jack Christensen 710ddf7134
Merge pull request #682 from WGH-/batch-len
Add Len() method to *pgx.Batch
2020-02-22 09:21:21 -06:00
Jack Christensen edf1229fba
Merge pull request #681 from benjamin-bader/log_batched_queries
Add query logging for individual batch items
2020-02-22 09:19:34 -06:00
WGH c01721e3ba Add Len() method to *pgx.Batch
This makes the API slightly easier to use when number of calls to
Queue() cannot be trivially computed.

For example, if the program contains the loop like the following,
a separate variable counting the iterations is needed:

    numHeaders := 0
    for _, header := range prepareHeadersForInsert(*res.Headers) {
        headerBatch.Queue("INSERT ...", ...)
        numHeaders++
    }

    headerBatchResult := tx.SendBatch(ctx, headerBatch)

    for i := 0; i < numHeaders; i++ {
        _, err := headerBatchResult.Exec()
        // ...
    }

With method Len(), this extra variable can be eliminated.
2020-02-21 22:28:34 +03:00
Ben Bader a10b89ebc0 Add query logging for individual batch items 2020-02-18 16:22:29 -08:00
Jack Christensen 542c9a97f1 Release v4.4.1 2020-02-14 17:59:33 -06:00
Jack Christensen 8848816c13 Update pgconn to v1.3.2 for better default buffer size 2020-02-14 17:58:38 -06:00
Jack Christensen 3b9f79e2f3 Fix race condition in CopyFrom
In case of an error it was possible for the goroutine that builds the
copy stream to still be running after CopyFrom returned. Since that
goroutine uses the connections ConnInfo data types to encode the copy
data it was possible for those types to be concurrently used in an
unsafe fashion.

CopyFrom will no longer return until that goroutine has completed.
2020-02-14 17:30:44 -06:00
Jack Christensen 8c9d1cc15b Add test case for #677 2020-02-07 16:07:43 -06:00
Jack Christensen ea0eacc0b6 Release v4.4.0 2020-02-05 11:31:22 -06:00
Jack Christensen 22ad987698 Add a timeout to pgxpool min connection creation
Ensure that CreateResource can't hang.
2020-02-05 11:25:15 -06:00
Jack Christensen cb1a1ebefa Update pgconn, pgtype, and puddle 2020-02-05 11:16:59 -06:00
Jack Christensen efe9315b5b
Merge pull request #674 from ellulpatrick/min-connections
Implements MinConns, the minimum size of the connection pool
2020-02-03 17:07:04 -06:00
Patrick Ellul a01827732f Implements MinConns, the minimum size of the connection pool.
The health check will increase the number of connections to this amount if it had dropped below.
2020-02-04 08:17:53 +11:00
Jack Christensen 77c1076d39 stdlib.ReleaseConn closes connections left in invalid state
If a connection is in a transaction or has an open result set then
close the connection when returning it to database/sql. When next
database/sql attempts to use it the connection will return
driver.ErrBadConn and database/sql will remove it from the pool.

fixes #673
2020-02-01 12:00:26 -06:00
Jack Christensen 06c3181836 Merge branch 'ellulpatrick-max-conn-idle-time' 2020-02-01 09:45:37 -06:00
Jack Christensen 2d20ba7ba4 Add doc for pool_max_conn_idle_time option 2020-02-01 09:45:20 -06:00
Patrick Ellul 5082e30c4c Implement maximum connection idle time (MaxConnIdleTime) for pgxpool.
If a connection has been idle for longer than maxConnIdleTime, the health check will destroy it.
2020-01-28 16:36:34 +11:00
Jack Christensen 366c926137
Merge pull request #668 from HowJMay/fix_typo
fix: Fix typo
2020-01-25 14:11:59 -06:00
HowJMay 8e88d70eb3 fix: Fix typo
Fix some typos in codebase
2020-01-25 15:36:19 +08:00
Jack Christensen 1059288751 Update changelog 2020-01-23 21:05:53 -06:00
Jack Christensen 3a1f0bafbe Update pgconn to 1.3.0 2020-01-23 21:00:24 -06:00
Jack Christensen fd4e692323 Add Rows.Values support for unknown types 2020-01-23 20:50:21 -06:00
Jack Christensen f6feb39655 Fix Rows.Values() fallback to generic decoder
fixes #666
2020-01-23 20:41:22 -06:00
Jack Christensen 07b32353a4
Merge pull request #665 from alex/driver-context
Fixes #664 -- implement DriverContext for stdlib
2020-01-23 20:08:21 -06:00
Alex Gaynor efbbde0487 Fixes #664 -- implement DriverContext for stdlib 2020-01-23 14:19:40 -06:00
Jack Christensen 69048c281c Update changelog 2020-01-13 08:51:08 -06:00
Jack Christensen 4ec6ee76fe Update to pgconn v1.2.1 2020-01-13 08:50:28 -06:00
Jack Christensen 7a394d5c78 Update changelog 2020-01-11 19:25:23 -06:00
Jack Christensen fce41c0b24 Update pgconn and pgtype 2020-01-11 19:23:53 -06:00
Jack Christensen be13c7ac54
Merge pull request #657 from malstoun/panicfix
Add arguments count check to execParamsAndPreparedPrefix
2020-01-04 08:29:19 -06:00
malstoun 8dc8431ef9 Add arguments count check to execParamsAndPreparedPrefix 2020-01-04 12:41:49 +03:00
Jack Christensen 9cb58fc969 Fix large objects functionality when PreferSimpleProtocol = true
fixes #651
2019-12-27 11:17:12 -06:00
Jack Christensen be1a8e51bc Add PG 12 to Travis test matrix 2019-12-23 11:08:21 -06:00
Jack Christensen eb360b07be Tweak test for PG 12 compatibility 2019-12-23 11:08:21 -06:00
Jack Christensen 2f2e01b9fc
Merge pull request #646 from johanbrandhorst/expose-default-driver
Add back GetDefaultDriver
2019-12-07 09:36:26 -06:00
Johan Brandhorst d75362f396 Add back GetDefaultDriver
This method is useful when it is necessary
to wrap the pgx stdlib driver, for example to
add tracing and metrics.

Fixes #645
2019-12-07 10:19:51 +00:00
Jack Christensen 3dc25d5b9c
Merge pull request #640 from apantel/cockroach-test-cleanup
Clean up two test cases
2019-11-23 09:40:44 -06:00
Adam Pantel 167442e66b Add a couple error checks 2019-11-22 11:51:58 -05:00
Adam Pantel f989008ad5 Clarify error reporting in TestConnQueryErrorWhileReturningRows 2019-11-22 11:03:46 -05:00
Adam Pantel 0a3cfab73e Eliminate race condition in TestListenNotifyWhileBusyIsSafe 2019-11-22 11:03:33 -05:00
Jack Christensen 693ba65a4a Update pgtype to v1.0.3 2019-11-16 11:11:15 -06:00
Jack Christensen 69e9c33daf Add RegisterConnConfig to stdlib
This restored functionality lost in the v3 to v4 transition when
RegisterDriverConfig was removed.

fixes #617
2019-11-16 11:06:57 -06:00
Jack Christensen f3a3ee1a0e Release v4.1.2 2019-10-22 20:51:52 -05:00
Jack Christensen e7c61d382e Upgrade to pgtype v1.0.2
Pull in pointer to pointer scan fix
2019-10-22 20:46:30 -05:00
Jack Christensen 78a83eba6a Fix dbSavepoint.Begin recursive self call
It needed to call the inner tx.

fixes #633
2019-10-22 20:38:12 -05:00
Jack Christensen 3da4ea1a97 Release 4.1.1 2019-10-21 13:57:39 -05:00
Jack Christensen 0d8dcd87b0 Fix pgxpool Rows.CommandTag() 2019-10-21 13:57:39 -05:00
Jack Christensen aed55f0dee
Merge pull request #626 from tbutts/patch-1
Readme: update pkg paths for pgtype & pgmock
2019-10-14 10:00:58 -05:00