3085 Commits

Author SHA1 Message Date
Jack Christensen
cfbd2519e3 Add PGSERVICE and PGSERVICEFILE support 2020-03-07 13:17:39 -06:00
Jack Christensen
911e727d78 ExecParams and ExecPrepared handle empty query
An empty query does not return CommandComplete. Instead it returns
EmptyQueryResponse.
2020-03-07 10:55:29 -06:00
Jack Christensen
8117205a75 Range types Set method supports its own type, string, and nil
Previously Set would always return an error when called on a range type.
Now it will accept an instance of itself, a pointer to an instance of
itself, a string, or nil. Strings are parsed with the same logic as
DecodeText.
2020-03-03 15:25:57 -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
Jack Christensen
55a56add23 Set will call Get on src if possible 2020-02-19 11:58:49 -06:00
Jack Christensen
666bd514e2 Add standard nil test to gofrs-uuid.UUID.Set 2020-02-19 10:50:58 -06:00
Jack Christensen
f3816bd1c0 Get implemented on T instead of *T
Methods defined on T are also available on *T. Thought this technically
changes the interface, because *T will be automatically dereferenced as
needed it shouldn't be a breaking change.

See a8802b16cc593842f5c69b0f7cfb0de11d5cd3a8 for similar change.
2020-02-19 10:48:09 -06: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 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
6db848c6fc Update chunkreader to v2.0.1 2020-02-14 17:56:59 -06:00
Jack Christensen
3c4a99247c
Merge pull request #1 from furdarius/increase-buffer
Increase buffer size to 8KB
2020-02-14 17:52:59 -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
ac364e7a43 Use writeError for Write error 2020-02-07 15:40:50 -06:00
Jack Christensen
06c4e181b1 go mod tidy 2020-02-05 11:49:40 -06:00
Jack Christensen
ea0eacc0b6 Release v4.4.0 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
282b7936a2 Release 1.2.0 2020-02-05 11:10:17 -06:00
Jack Christensen
406afa0eb7 Release v1.3.1 2020-02-05 11:06:09 -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
Jack Christensen
0ab69ce885 Merge branch 'freb-json_marshaling' 2020-01-29 09:26:45 -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
Jeffrey Stiles
5f363cb1f0 Add JSON marshalling for Bool, Date, JSON/B, Timestamptz 2020-01-27 16:19:43 -08:00
Jack Christensen
c9abb86f21 Ensure write failure in CopyFrom closes connection 2020-01-25 20:40:21 -06:00
Jack Christensen
67f2418279 Make copyErrChan buffered so goroutine can always terminate
It is possible the goroutine that is reading from copyErrChan will not
read in case of error.
2020-01-25 20:39:18 -06:00
Jack Christensen
139342081e Fix CopyFrom deadlock when multiple NoticeResponse received during copy
fixes #21
2020-01-25 20:32:42 -06:00
Jack Christensen
53a5c14d50
Merge pull request #17 from freb/null_unmarshaljson
Support Null Status in UnmarshalJSON
2020-01-25 14:13:00 -06: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
Jeffrey Stiles
06942241c4 Support Null Status in UnmarshalJSON 2020-01-24 16:38:15 -08:00
Jack Christensen
cf87e34792 Add JSON to shopspring-numeric extension 2020-01-24 17:07:41 -06:00
Jack Christensen
b01b35f466 Fix typo in docs 2020-01-24 14:58:59 -06:00
Jack Christensen
0bbaad1348 Add zeronull package for easier NULL <-> zero conversion 2020-01-24 11:23:28 -06:00
Jack Christensen
1059288751 Update changelog v4.3.0 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
6124b07bb1 Update changelog 2020-01-23 20:57:13 -06:00
Jack Christensen
f909a64ff5 Update pgproto3 to v2.0.1 2020-01-23 20:55:52 -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