210 Commits

Author SHA1 Message Date
Jack Christensen
59a0074b0a Release v1.6.0 2020-06-06 10:52:55 -05:00
Jack Christensen
6cd2127b96 Update pgproto3 dependency 2020-06-06 10:52:07 -05:00
Jack Christensen
fa742c5248
Merge pull request #41 from georgysavva/add-config-copy
Add Config.Copy() method that returns a smart copy of the config.
2020-06-01 13:11:01 -05:00
georgysavva
a6d9265506 Implement deep copy manually, stop using an external deep copy library. Add comment to the Config.Copy() method. 2020-06-01 20:52:08 +03:00
georgysavva
8d541d0004 Add Config.Copy() method that return a smart copy of the config. 2020-06-01 19:20:17 +03:00
Jack Christensen
2647eff567 Fix ValidateConnect with cancelable context
fixes #40
2020-05-25 11:49:37 -05:00
Jack Christensen
8c33aa2443 Remove CPU wasting empty default statement
fixes #39
2020-05-23 11:47:42 -05:00
Jack Christensen
2ccb66fe21 Doc fix 2020-05-16 18:48:05 -05:00
Jack Christensen
18d2604119
Merge pull request #38 from lukedirtwalker/fixIPv6
Handle IPv6 in connection URLs
2020-05-13 08:50:38 -05:00
Jack Christensen
39f9d6079c Merge branch 'georgysavva-improve-connect-timeout' 2020-05-13 07:43:45 -05:00
Jack Christensen
fafefa6063 Merge branch 'improve-connect-timeout' of git://github.com/georgysavva/pgconn into georgysavva-improve-connect-timeout 2020-05-13 07:43:15 -05:00
Jack Christensen
fb54a80edf
Merge pull request #36 from Eun/patch-1
concludeCommand should not throw away fieldDescriptions
2020-05-13 07:38:08 -05:00
Lukas Vogel
08d071c094 Handle IPv6 in connection URLs
Previously IPv6 addresses were wrongly split and lead to a parse error.
This commit fixes the behavior.
2020-05-12 10:39:35 +02:00
Jack Christensen
c4e6445cc7 Explicitly test supported Go and PostgreSQL versions 2020-05-09 10:19:39 -05:00
georgysavva
01a7510ae9 Reformat imports 2020-05-02 16:43:02 +03:00
georgysavva
2d5a17beab Add comment. 2020-05-02 16:39:51 +03:00
georgysavva
391e1ef2ce Parse connect timeout setting into Config. Restrict context timeout via Config.ConnectTimeout on .Connect() call. 2020-05-02 16:35:22 +03:00
Tobias Salzmann
8d9293e1e7
Update pgconn.go 2020-04-30 11:27:01 +02:00
Tobias Salzmann
8f3f335b0f
concludeCommand should not throw away fieldDescriptions 2020-04-30 11:22:43 +02:00
Jack Christensen
15856c001a
Merge pull request #33 from pjediny/sslmode-require-with-rootca
Fix behavior of sslmode=require with sslrootcert present
2020-04-07 20:00:31 -05:00
Jack Christensen
5d2be99c25 Fix panic when closing conn during cancellable query
fixes #29
2020-04-07 19:38:21 -05:00
Petr Jediný
84aee0ab44 Fix behavior of sslmode=require with sslrootcert present
According to PostgreSQL documentation the behavior should be
the same as that of verify-ca sslmode

https://www.postgresql.org/docs/12/libpq-ssl.html
2020-04-08 00:08:53 +02: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