2461 Commits

Author SHA1 Message Date
Igor Savin
badf0a1c65 Update ESLint (#1753)
* Update ESLint

* Downgrade ESLint version to restore Node 4 support

* Downgrade more dependencies

* Keep downgrading
2018-10-26 08:55:31 -05:00
Charmander
1cf1e05ab9 Allow a custom type to be used for Client promises (#1518)
Matches the Pool API.
2018-10-24 10:40:23 -05:00
Igor Savin
ff6fe1e01e Execute tests on Node 11 in CI (#1752) 2018-10-23 13:02:49 -07:00
John Lindal
37997fed76 fix formatting issues 2018-10-23 09:59:50 -07:00
John Lindal
19c68c753e fix: AWS Redshift requires a portal name to honor fetchSize 2018-10-17 14:30:56 -07:00
Brian M. Carlson
6177ff95a6 Bump version 2018-10-08 12:51:13 -05:00
Brian C
2446fdb8d0
Fix for pg@7.5 (#47)
* Fix for pg@7.5

Don't return anything from `stream.submit`

* Add node@10 to travis version

* Relax version of node@4.x
2018-10-08 12:50:11 -05:00
Brian M. Carlson
04a0ec71b4 Bump version v7.5.0 2018-10-03 10:46:12 -05:00
Brian M. Carlson
8cf5a84539 Update changelog 2018-10-03 10:45:53 -05:00
Charmander
3828aa8608 Queued query errors (#1503)
* Add tests for query callbacks after connection-level errors

* Ensure callbacks are executed for all queued queries after connection-level errors

Separates socket errors from error messages, sends socket errors to all queries in the queue, marks clients as unusable after socket errors.

This is not very pleasant but should maintain backwards compatibility…?

* Always call `handleError` asynchronously

This doesn’t match the original behaviour of the type errors, but it’s correct.

* Fix return value of `Client.prototype.query` in immediate error cases

* Mark clients with closed connections as unusable consistently

* Add tests for error event when connecting Client

* Ensure the promise and callback versions of Client#connect always have the same behaviour

* Give same error to queued queries as to active query when ending

and do so in the native Client as well.

* Restore original ordering between queued query callbacks and 'end' event
2018-10-03 10:37:15 -05:00
Thomas Hunter II
fed6375e0a remove query.stream references
* This hasn't been supported since 0b2344b6b5afbb68e89eff1ef2b57ecf0726d80b
* `node-pg-copy-streams` relies on overriding the `handleCopyInResponse` method:
  * https://github.com/brianc/node-pg-copy-streams/blob/e15feb19/index.js#L53
2018-10-03 10:16:42 -05:00
Pat Gaffney
11a4793452 Add error handling for null params to Client.prototype.query() 2018-10-03 10:15:04 -05:00
Charmander
e7602bc678
Merge pull request #1701 from gajus/issue-1699
refactor: simplify the escapeIdentifier logic
2018-07-30 02:46:22 +00:00
Gajus Kuizinas
00d749cdfa refactor: simplify the escapeIdentifier logic 2018-07-29 21:29:27 +01:00
Charmander
6c840aabb0
Merge pull request #1692 from askmike/patch-1
typo in test: g/provded/provided
2018-07-17 01:29:30 +00:00
Mike van Rossum
9bfd4bff40
[test] g/provded/provided 2018-07-17 01:07:00 +08:00
Charmander
a9b3ef7cd3
Merge pull request #1684 from dominicletz/patch-1
Replace poolSize by max in error test
2018-07-09 16:00:55 +00:00
Dominic Letz
28e66ccd4b
Use pool constructor to pass pool size 2018-07-09 14:19:55 +08:00
Dominic Letz
2ea5f91f4a
Replace poolSize by max in error test 2018-07-09 11:46:56 +08:00
Charmander
1cbd507b8c
Merge pull request #1677 from sehrope/fix-network-partition-test-race
Fix network partition test race
2018-06-25 00:33:34 +00:00
Brian C
91bdbbd3d7
Merge pull request #40 from savvymas/patch-1
Add repo to package.json
2018-06-21 14:13:11 -07:00
Savannah Mastrangelo
7eabfbe0ba
Add repo to package.json
Without this pages like https://www.npmjs.com/package/pg-cursor don't link back correctly.
2018-06-20 12:29:41 -04:00
Sehrope Sarkuni
2dc5c6864b Change network partition test to wait for client socket creation prior to destroy 2018-06-17 11:58:37 -04:00
Brian M. Carlson
3ac356a812 Bump version v7.4.3 2018-05-07 10:07:10 -05:00
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