94 Commits

Author SHA1 Message Date
Stas Kelvich
e3406d95f9 Add test coverage for client SNI 2022-08-19 17:35:33 -05:00
Jack Christensen
fe0fb3b24d Clean up docs for new ParseConfigOptions feature 2022-07-20 06:28:08 -05:00
Jack Christensen
69b99209fb Run go fmt 2022-07-20 06:06:54 -05:00
yun.xu
cdd2cc4124 EC-2198 change for sslpassword 2022-07-20 06:05:06 -05:00
Eric McCormack
32ec44f726 Add support for SslPassword 2022-07-20 06:05:06 -05:00
Jack Christensen
05d532b5df Fix connect when receiving NoticeResponse
refs #102
2022-01-20 16:41:47 -06:00
Blake Embrey
c0a0be876d Fix TLS connection timeout 2021-12-27 14:28:33 -06:00
James Hartig
5a5260b73d feat: support port in ip from LookupFunc to override config
Fixes #97
2021-12-18 08:16:31 -06:00
Jack Christensen
6996e8d6c5 Context errors returned instead of net.Error
The net.Error caused by using SetDeadline to implement context
cancellation shouldn't leak.

fixes #80
2021-07-24 09:09:22 -05:00
Jack Christensen
cf5894e092 Use std errors instead of golang.org/x/xerrors
New error functionality was introduced in Go 1.13. pgconn only
officially supports 1.15+. Transitional xerrors package can now be
removed.
2021-03-06 14:45:33 -06:00
Jack Christensen
fb88a34cb4 Skip test with known issue on CockroachDB 2021-02-20 16:40:16 -06:00
Jack Christensen
d05c52217a Initial CockroachDB testing 2021-02-13 10:47:22 -06:00
Jack Christensen
a78ab5bdcd Test should abort if cannot setup database 2021-02-13 09:39:42 -06:00
Jack Christensen
0f17ba2cf3 Fix unconstrained data value slices
See https://github.com/jackc/pgx/issues/859
2020-11-03 19:17:52 -06:00
Jack Christensen
0d4f029683 Exec(Params|Prepared) return ResultReader with FieldDescriptions loaded
Previously, it wasn't loaded until NextRow was called the first time.
2020-09-05 13:14:14 -05:00
Jack Christensen
fdfc783345 Rename CleanupChan to CleanupDone 2020-08-20 22:08:40 -05:00
Jack Christensen
3eb5432c47 Add PgConn.CleanupChan 2020-08-20 22:00:21 -05:00
Jack Christensen
4e4c4ea541 Fix deadlock on error after CommandComplete but before ReadyForQuery
See: https://github.com/jackc/pgx/issues/800
2020-07-29 21:47:23 -05:00
Jack Christensen
473062b114 Remove NewConfig and add more docs for ParseConfig
refs #42
2020-06-27 11:29:21 -05:00
Jack Christensen
7cf5101bb2 Add NewConfig()
refs #42
2020-06-20 12:59:15 -05:00
Jack Christensen
2647eff567 Fix ValidateConnect with cancelable context
fixes #40
2020-05-25 11:49:37 -05:00
georgysavva
01a7510ae9 Reformat imports 2020-05-02 16:43:02 +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
Jack Christensen
5d2be99c25 Fix panic when closing conn during cancellable query
fixes #29
2020-04-07 19:38:21 -05: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
139342081e Fix CopyFrom deadlock when multiple NoticeResponse received during copy
fixes #21
2020-01-25 20:32:42 -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
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
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
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
Artemiy Ryabinkov
17d3d592e9
add test for custom lookup func
Signed-off-by: Artemiy Ryabinkov <getlag@ya.ru>
2019-09-14 19:11:26 +03:00
Jack Christensen
2f6b8f3f56 Fix context timeout on connect 2019-08-31 17:01:54 -05:00
Jack Christensen
138254da5b Refactor errors
- Use strongly typed errors internally
- SafeToRetry(error) streamlines retry logic over ErrNoBytesSent
- Timeout(error) removes the need to choose between returning a context
  and an i/o error
2019-08-27 18:05:50 -05:00
Jack Christensen
6feea0c1c5 Replace IsAlive with IsClosed
IsAlive is ambiguous because the connection may be dead and we do not
know it. It implies the possibility of a ping. IsClosed is clearer -- it
does not promise the connection is alive only that it hasn't been
closed.

fixes #2
2019-08-24 23:43:26 -05:00
Jack Christensen
760dd75542 Require Config to be created by ParseConfig 2019-08-24 09:28:44 -05:00
Jack Christensen
d364370a31 Add SendBytes and ReceiveMessage 2019-08-20 14:12:07 -05:00
Jack Christensen
f0b479097a Fix missing deferred constraint violations in certain conditions
See https://github.com/jackc/pgx/issues/570.
2019-08-06 17:07:11 -05:00
Jack Christensen
3dec184811 Split ValidateConnect from AfterConnect
This avoids the foot-gun of ParseConfig setting AfterConnect because of
target_session_attrs and the user inadvertently overriding it with an
AfterConnect designed to setup the connection.

Now target_session_attrs will be handled with ValidateConnect.
2019-07-13 10:22:09 -05:00
Jack Christensen
59941377c8 Rename Config.AfterConnectFunc to AfterConnect
No need to include the type in the name.
2019-07-13 09:52:22 -05:00
Artemiy Ryabinkov
529805557f
Fix linters notifications
Signed-off-by: Artemiy Ryabinkov <getlag@ya.ru>
2019-06-22 10:41:01 +03:00
Jack Christensen
a97dd2f9f6 Update test envvar and docs 2019-06-01 09:59:04 -05:00
Jack Christensen
1e3961bd0e Fix flickering test 2019-04-24 16:49:52 -05:00
Jack Christensen
7e0022ef6b Tag errors if no bytes sent to server 2019-04-20 16:48:24 -05:00
Jack Christensen
0f8e1d30e2 Link context errors and underlying conn errors
Using golang.org/x/xerrors type errors both errors can be exposed.
2019-04-20 15:53:30 -05:00
Jack Christensen
f3b5f6b275 Allow skipping TestConnExecBatchHuge in short mode 2019-04-20 15:34:49 -05:00
Jack Christensen
39e6ff5766 Prevent deadlock with huge batches 2019-04-20 11:11:09 -05:00
Jack Christensen
9f774761ba Fix TestConnLocking 2019-04-20 10:59:50 -05:00
Jack Christensen
7bb6c2f3e9 Unify locked and closed into status
No longer panic on locking busy conn
2019-04-19 15:52:12 -05:00