2314 Commits

Author SHA1 Message Date
Matt Keas
7de137f9f8 tls.connect({checkServerIdentity}) option cannot be a null - must be a method or not exist.
Defaults to built-in `tls.checkServerIdentity` method in the event one is not passed into `pgConfig.ssl`

Found breaking in v9.4.2 vs v9.4.1 a la 49054717b4ec0c6d477f04c2becd1f9680b2d13a

cc @tobio @brianc
2018-05-07 10:05:56 -05:00
Brian M. Carlson
83ede28e18 Bump version v7.4.2 2018-05-04 14:01:26 -05:00
Yuval Greenfield
277dc508da Clarifying pool connect logging (#73)
Existing log code was outputting 'connecting new client' twice and saying 'new client connected', creating a false impression when an error (like a timeout) was present.
2018-05-04 13:06:49 -05:00
Yuval Greenfield
6b2883d290 terminiated -> terminated (#78) 2018-05-04 13:06:32 -05:00
Charmander
1871d0f9e1 Remove timed-out checkouts from queue correctly (#86)
* Add failing test for correct removal from checkout queue on timeout

* Remove timed-out checkouts from queue correctly

Fixes #85.
2018-05-04 13:04:42 -05:00
Charmander
fabf39c606 Count only test query itself (#87)
* Count only test query itself

This breaks more obviously in PostgreSQL 10 (https://wiki.postgresql.org/wiki/New_in_postgres_10#Significant_Expansion_of_Wait_Events_in_pg_stat_activity).

* Fix query counting for PostgreSQL 9.1
2018-05-04 12:59:39 -05:00
contra
72db7902fa dont use dynamic functions to parse rows, closes #1417 2018-05-04 12:34:46 -05:00
Toby Brain
49054717b4 Add ability to specify checkServerIdentity callback 2018-05-04 12:33:48 -05:00
Justin Jaffray
831dfb1b4c Pass through portal properly
This happened to work before because `Query.portalName` was undefined,
but in order to be able to set the portal explicitly it should be using
`Query.portal`.
2018-05-04 12:30:17 -05:00
Matthew Blewitt
9389527609 Add comments to case branches, explaining code meanings 2018-05-04 12:20:42 -05:00
Matthew Blewitt
3eb73751f5 Expand test to check for expected and unexpected errors 2018-05-04 12:20:42 -05:00
Matthew Blewitt
7dd3b50e41 Add guard to test to not check errors for empty error messages 2018-05-04 12:20:42 -05:00
Matthew Blewitt
5d32be4a90 Handle SSL negotiation errors more robustly
This commit adds some finer grained detail to handling the postmaster's
response to SSL negotiation packets, by accounting for the possibility
of an 'E' byte being sent back, and emitting an appropriate error.

In the naive case, the postmaster will respond with either 'S' (proceed
with an SSL connection) or 'N' (SSL is not supported). However, the
current if statement doesn't account for an 'E' byte being returned
by the postmaster, where an error is encountered (perhaps unable to
fork due to being out of memory).

By adding this case, we can prevent confusing error messages when SSL is
enforced and the postmaster returns an error after successful SSL
connections.

This also brings the connection handling further in line with
libpq, where 'E' is handled similarly as of this commit:

a49fbaaf8d

Given that there are no longer pre-7.0 databases out in the wild, I
believe this is a safe change to make, and should not break backwards
compatibility (unless matching on error message content).

* Replace if statement with switch, to catch 'S', 'E' and 'N' bytes
  returned by the postmaster
* Return an Error for non 'S' or 'N' cases
* Expand and restructure unit tests for SSL negotiation packets
2018-05-04 12:20:42 -05:00
Vratislav Kalenda
0902d145f4 fix: end stream connection 2018-05-04 12:19:53 -05:00
Sehrope Sarkuni
860928e2d5 Change test to use Buffer.from(...) 2018-05-04 12:18:31 -05:00
Sehrope Sarkuni
272e9a5998 Change network partition test to use socket.destroy() 2018-05-04 12:18:31 -05:00
Sehrope Sarkuni
b0c60cf288 Add node v10 to travis matrix 2018-05-04 12:18:31 -05:00
Charmander
2f14cb1a0f Update CI versions (#88)
* Update CI versions

PostgreSQL 9.1 is no longer available on 14.04.

* Add Node 9 to CI
2018-04-06 11:28:03 -05:00
Elexy
8fb641ee91 upgrade testing node versions 2018-04-04 14:40:25 -07:00
Charmander
87dd65fda5
Merge pull request #1592 from chentsulin/patch-1
use net.Socket instead of net.Stream
2018-03-14 23:33:27 +00:00
C. T. Lin
875236fc0b
use net.Socket instead of net.Stream
`net.Stream` is a undocumented legacy naming from node 0.x
4ae320f2b3/lib/net.js (L1762)
2018-03-14 22:43:52 +08:00
Charmander
50b1221e11
Merge pull request #1585 from BridgeAR/master
Remove `noAssert` argument
2018-03-10 21:15:42 +00:00
Ruben Bridgewater
3f1d7b9bc6
Remove noAssert argument
The support for the `noAssert` argument dropped in the upcoming
Node.js v.10.x. All input is then validated no matter if this
is set to true or not. Just remove the argument because of that.
2018-03-10 22:09:23 +01:00
Charmander
94d38f941e Capitalize some parts of the README 2018-01-09 21:39:40 -08:00
Ben Holden-Crowther
be57714f16 spelling corrections 2018-01-10 05:28:14 +00:00
Brian M. Carlson
a664983cbb Bump version v7.4.1 2018-01-05 13:41:36 -06:00
Pasi Eronen
9825e7c733 Use Buffer.from instead of deprecated Buffer constructor 2018-01-05 13:40:25 -06:00
Pasi Eronen
70a8ee1334 Don't repeat logic for reporting stream errors 2018-01-05 13:40:25 -06:00
Pasi Eronen
4cf67b23d4 Ignore socket hangup when ending connection also with ssl (#1344). 2018-01-05 13:40:25 -06:00
Ben Holden-Crowther
c9ca1dad69 License date in README 2018-01-03 21:09:12 +00:00
Ben Holden-Crowther
1e48733b20 Update license date 2018-01-02 20:15:15 +00:00
jakob
2398e992a8 return rowCount on insert 2018-01-01 18:43:18 +00:00
Brian C
6c723b2f14
Update SPONSORS.md 2017-12-06 10:11:49 -06:00
Brian C
56633a5989
Update SPONSORS.md 2017-12-06 10:06:13 -06:00
Charmander
9870c86fde Make tests compatible with PostgreSQL 10
PostgreSQL 10 reports its version as only `major.minor`, so it can’t be parsed with semver. The `server_version_num` setting is a major version followed by a four-digit minor version since version 10, and was a three-digit major version followed by a two-digit minor version before that.
2017-11-17 14:16:03 -06:00
Charmander
0b80abacaf Specify collation when relied on in tests
Fixes #189.
2017-11-17 14:12:16 -06:00
Brian M. Carlson
9da3a85cbc Bump version v7.4.0 2017-11-04 14:21:36 -05:00
Brian M. Carlson
fccf8e818c Update changelog 2017-11-04 14:21:28 -05:00
Jan Schär
894e2f2f1e Support Uint8Array values 2017-11-04 14:18:36 -05:00
Robert Treat
32537d5345 Fix minor type in recent changelog entry 2017-11-04 14:17:26 -05:00
Sehrope Sarkuni
19bfb2f9b8 Add postgresql to package.json keywords 2017-11-04 14:17:10 -05:00
Sehrope Sarkuni
c2da0ed978 Sort keywords in package.json 2017-11-04 14:17:10 -05:00
Charmander
74aaced74a Avoid modifying package.json or creating package-lock when running tests with npm 5
Should save some confusion in future pull requests (#1465, #1436, #1363).
2017-11-04 14:16:34 -05:00
Hetul Patel
24e485e81e Fix closing a finished cursor without supplying a callback 2017-10-03 18:13:40 -07:00
Brian C
e087305f31 Update SPONSORS.md 2017-09-06 10:41:25 -05:00
Brian M. Carlson
f66379f5fe Bump version v7.3.0 2017-09-03 14:41:16 -05:00
Brian M. Carlson
dfc7214d14 Update changelog 2017-09-03 14:41:03 -05:00
Sehrope Sarkuni
f1336fcb00 Change Makefile to use local eslint
Changes the Makefile lint target to use the local copy of
eslint that would be installed in node_modules rather than
a global copy that may not be installed.
2017-09-03 14:28:32 -05:00
Josh
ecab41c3f3 restore newline at end of file 2017-09-03 14:14:28 -05:00
Josh
64eb77e94c new test for actual statement timeout 2017-09-03 14:14:28 -05:00