189 Commits

Author SHA1 Message Date
Jack Christensen
5d2be99c25 Fix panic when closing conn during cancellable query
fixes #29
2020-04-07 19:38:21 -05:00
Jack Christensen
e4f3224f4c Update changelog for v1.5.0 2020-03-30 11:15:08 -05:00
Jack Christensen
11d9f4e54f Update golang.org/x/crypto for security fix 2020-03-30 11:09:29 -05:00
Jack Christensen
87c8ddd0d1
Merge pull request #32 from gcurtis/verify-ca
Implement "verify-ca" SSL mode
2020-03-21 11:13:55 -05:00
Greg Curtis
4ed48d05d2 Implement "verify-ca" SSL mode
ParseConfig currently treats the libpq "verify-ca" SSL mode as
"verify-full". This is okay from a security standpoint because
"verify-full" performs certificate verification and hostname
verification, whereas "verify-ca" only performs certificate
verification.

The downside to this approach is that checking the hostname is
unnecessary when the server's certificate has been signed by a private
CA. It can also cause the SSL handshake to fail when connecting to an
instance by IP. For example, a Google Cloud SQL instance typically
doesn't have a hostname and uses its own private CA to sign its
server and client certs.

This change uses the tls.Config.VerifyPeerCertificate function to
perform certificate verification without checking the hostname when the
"verify-ca" SSL mode is set. This brings pgconn's behavior closer to
that of libpq.

See https://github.com/golang/go/issues/21971#issuecomment-332693931
and https://pkg.go.dev/crypto/tls?tab=doc#example-Config-VerifyPeerCertificate
for more details on how this is implemented.
2020-03-17 23:36:06 -07:00
Jack Christensen
ccf634cf2e Release 1.4.0 2020-03-07 13:21:51 -06:00
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
6db848c6fc Update chunkreader to v2.0.1 2020-02-14 17:56:59 -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
406afa0eb7 Release v1.3.1 2020-02-05 11:06:09 -06: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
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
a4375eb53f Add test that Hijack'ed conn is no longer usable. 2020-01-17 17:42:20 -06:00
Jack Christensen
5952524511 Add Hijack and Construct
fixes #9
2020-01-17 17:38:56 -06:00
Jack Christensen
8be01d690f Make Host comment more precise 2020-01-17 17:38:07 -06:00
Jack Christensen
e7dd01e064 Update changelog 2020-01-13 08:48:32 -06:00
Jack Christensen
2582879459 Fix typo - rename ayncClose to asyncClose 2020-01-12 16:28:56 -06:00
Jack Christensen
0df97353b8 Fix racy usage of pgConn.contextWatcher in ayncClose 2020-01-12 16:27:46 -06:00
Jack Christensen
a48e9bf63c Update changelog 2020-01-11 19:07:39 -06:00
Jack Christensen
fd2093cef8 Add statement type convenience methods to CommandTag and optimize
Added convenient way to check whether a statement was a select, insert,
update, or delete. These methods do not allocate.

RowsAffected now does not allocate even when a large number of rows are
affected. It also is multiple times faster, though the absolute change
is inconsequential.
2020-01-11 18:42:31 -06:00
Jack Christensen
b6669ae6dd Add PgError.SQLState method
fixes #15
2020-01-11 18:23:41 -06:00
Jack Christensen
70bb7ab6cb Merge branch 'bakape-master' 2020-01-11 18:10:33 -06:00
Jack Christensen
ed1391568c Merge branch 'master' of git://github.com/bakape/pgconn into bakape-master 2020-01-11 18:08:34 -06:00
bakape
9decdbc2ec Revert nil context support 2020-01-11 16:53:50 +02:00
Jack Christensen
98b3c57584 Try to cancel any in-progress query when a conn is closed by ctx cancel
See https://github.com/jackc/pgx/issues/659
2020-01-08 10:03:54 -06:00
bakape
9372218107 Don't synchronize with context.Background() 2020-01-01 19:34:56 +02:00
bakape
4d345164f1 Branch tests for nil context 2020-01-01 14:36:38 +02:00
bakape
7196234521 Benchmark nil context execution 2020-01-01 14:01:30 +02:00
bakape
89416dd805 Enable passing nil context 2020-01-01 13:09:50 +02:00
Jack Christensen
3e503b7b1a Add PostgreSQL 11 and 12 to the Travis build matrix 2019-12-21 14:41:09 -06:00
Jack Christensen
5fc867a833 Remove unused travis environment variable 2019-12-21 14:40:30 -06:00
Jack Christensen
18d1ed5ee5 Remove PostgreSQL 9.3 from Travis build matrix
PostgreSQL 9.3 is EOL so it doesn't make sense for pgconn to
specifically support. There are no known incompatibilities but it will
not longer be tested.
2019-12-21 14:37:09 -06:00
Jack Christensen
dd53b7488d Restart signalMessage when receiving non-error message in CopyFrom
fixes #21
2019-12-21 11:52:45 -06:00
Jack Christensen
bd0ce203e9 CopyFrom not table test was failing with syntax error 2019-12-21 10:31:27 -06:00
Jack Christensen
32350bd1dc TestConnectCustomLookup must test with TCP connection
Test (correctly) fails if run on a Unix domain socket.
2019-11-18 07:29:57 -06:00
Jack Christensen
eb81d2926b Ignore errors sending Terminate message while closing connection
This mimics the behavior of libpq PGfinish.

refs #637
2019-11-18 07:29:57 -06:00
Jack Christensen
9449f4b081
Merge pull request #17 from skipcloud/sgibson/fix-comment
config: fix ValidateConnect comment
2019-10-16 09:21:38 -05:00
Skip Gibson
81b6ad72f6 config: fix ValidateConnect comment 2019-10-16 10:01:16 +01:00
Jack Christensen
4df62cf3d0 Release v1.1.0 2019-10-12 11:23:48 -05:00
Jack Christensen
fcfd7d09a9 Add PgConn.IsBusy() method 2019-10-12 10:21:46 -05:00
Jack Christensen
0077ff0474
Merge pull request #16 from F21/patch-1
Fix minor errors and reword some sentences for readability
2019-10-07 13:37:34 -05:00
Francis Chuang
6c195c17b2
Fix minor errors and reword some sentences for readability 2019-10-03 09:49:12 +10:00
Jack Christensen
3f377acc1e
Merge pull request #14 from furdarius/resolve-hostnames-into-addrs
Validate all addresses resolved from hostname
2019-09-20 08:51:22 -05:00
Jack Christensen
d6b0287fcd Release v1.0.1 2019-09-19 21:41:20 -05:00
Jack Christensen
f5eead90fc Fix statement cache reuse bug 2019-09-19 21:04:14 -05:00