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.
* Remove redundant tests
* Add client connectionString test
Add test to ensure { connectionString } is respected as an argument to the client constructor
* Add test for connection string property
Also fixed some legacy require statements.
* Going red: using a config object creates two pools when missing some params
It should only create a pool in a consistent way, even if some params
are not provided in the first place.
* Delay the pool name generation to make it consistent between calls
* Don't fallback to empty object as config is already defined
A long standing bug was the pure JS client didn't accept or call a callback on `client.end`. This is inconsistent with both the documentation & general node patterns.
This fixes the issue & adds a test. The issue did not exist in the native version of the client.
The promise adapter I had implemented wasn't spec compliant: it didn't accept both `onSuccess` and `onFailure` in the call to `query#then`. This subtly broke yield & async/await because they both rely on `onError` being passed into `Promise#then`. The pool was also not returning the promise after a client was acquired, which broke awaiting on `pool.connect` - this is also fixed now.
* Initial work on removing internal pool
* Port backwards-compabible properties
* Cleanup test execution & makefile cruft
* Attempt to fix flakey error test
* Make Query & NativeQuery implement the promise interface
* Fix test
* Use older node API for checking listener length
* Do not test for promises on node@v0.10.0
There was some nasty global-ish variable reference updating happening when the native module 'initializes' after its require with `require('pg').native`
This fixes the issue by making sure both `require('pg')` and `require('pg').native` each initialize their own context in isolation and no weird global-ish references are used & subsequently stomped on.
When a __prepared statement__ has no body in the query the backend responds with an `emptyQuery` message but never with a `commandComplete` or `errorResponse` message. The client was hanging forever waiting for one of the other two expected messages. The server was hanging forever waiting for the client to respond with a `sync` message. This change has the client send the required `sync` on receipt of an `emptyQuery` message when the query is a prepared statement. Fixes#822
This completes the port from the old native bindings to the new node-pg-native bindings!
Time to build in support for older versions of postgres & start the pull request process.
Improve the code and clarity of unit tests in escape-tests.js. And
removed the related integration tests since it has been demonstrated in
the unit tests that a connection is not needed for escaping the literals
and identifiers.