* Fix deepEqual compare
In node 12 assert.deepEqual against a buffer & array no longer passes if the values are the same. This makes sense. Updated the test to not use deepEqual in this case.
* Fix typo
* Enable eslint:recommended and remove unused eslint plugins
Enables eslint:recommended by disabling the options that would not pass. Also removes
dependencies for included but unused eslint plugins.
* Convert console.error(...) calls to use %s placeholders
* Enable eslint no-console rule
* Add and enable eslint-node-plugin
* Correct typo
* Enable eslint no-unused-vars
* Added the missing connect_timeout and keepalives_idle config parameters
* Implementation and tests for keepAliveInitialDelayMillis and connectionTimeoutMillis [squashed 4]
Adds a try/catch block around the prepareValue(...) invocations in query.prepare(...)
to ensure that any that throw an error are caught and bubbled up to the caller.
The documentation states that you can pass custom type processors to
query objects. See:
https://node-postgres.com/features/queries#types
This didn't actually work. This commit adds an initial implementation
of per-query type-parsing. Caveats:
* It does not work with pg-native. That would require a separate pull
request to pg-native, and a rather significant change to how that
library handles query results.
* Per-query types do not "inherit" from types assigned to the Client,
ala TypeOverrides.
* Add read_timeout to connection settings
* Fix uncaught error issue
* Fix lint
* Fix "queryCallback is not a function"
* Added test and fixed error returning
* Added query timeout to native client
* Added test for timeout not reached
* Ensure error is the correct one
Correct test name
* Removed dubious check
* Added new test
* Improved test
Fixes the deprecation warning for using `new Buffer`.
The change is semver major in buffer-writer since we dropped support for node < 4.x, but otherwise it's a non-breaking change. Since node-postgres already requires node >= 4.x it's fine.
* 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