Commit Graph

615 Commits

Author SHA1 Message Date
Raul Ochoa
4cd56cc4f8 Make pool name consistent on missing config params (#1279)
* 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
2017-05-24 09:04:50 -05:00
Sehrope Sarkuni
ee8193673c Libpq connection string escaping (#1285)
* Fix escaping of libpq connection string properties

Fix handlings of libpq connection properties to properly escape single
quotes and backslashes. Previously the values were surrounded in single
quotes which handled whitespace within the property value, but internal
single quotes and backslashes would cause invalid connection strings to
be generated.

* Update expected output in test to be quoted

Update the expect host output in the connection parameter test
to expect it to be surrounded by single quotes.

* Add test for configs with quotes and backslashes
2017-05-15 12:19:13 -05:00
Brian Carlson
80d136a531 Add test & documentation for replicationStart message 2017-04-24 13:33:38 -05:00
Linus Unnebäck
5cb38f5892 Handle throws in type parsers (#1218)
* Handle throws in type parsers

* Fix throw in type parsers test for Node 0.x
2017-03-06 11:04:16 -06:00
Charmander
5b6d883723 Remove broken tests with external dependency (#1209)
Yikes.
2017-02-12 22:23:09 -06:00
Alexander Mochalin
f6c40b9331 parse int8[] (#1152)
* parse int8[]

* missing semicolon

* test

* test fixed

* test fixed

* test fixed. again.
2016-12-16 09:44:19 -06:00
Brian C
7f35240a5c Fix for utf-8 characters in md5 passwords (#1183)
This is the same fix as supplied in 1178 but includes a test.

Closes #1178
2016-12-13 11:51:36 -06:00
Charmander
48a9738a0b Run inbound parser tests (#1182)
They were disabled by 4cdd7a116b without comment; it seems that this might have been unintentional?

In any case, they should probably be enabled, updated, or removed.
2016-12-13 07:36:13 -06:00
Brian Carlson
5feacd66d0 Remove redundant test
This functionality is already tested in the node-pg-types repo.
2016-12-10 18:17:09 -06:00
Charmander
5d821c3acb Use more correct escaping for array elements (#1177)
It’s not JSON.
2016-12-10 17:28:48 -06:00
Brian C
a536afb1a8 Add callback to client#end (#1106)
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.
2016-08-11 10:17:03 -05:00
brianc
892d02ca1c Fix typo 2016-07-19 10:17:40 -05:00
Brian C
b1b2801c71 Add onFailure to query#then (#1082)
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.
2016-07-19 10:16:48 -05:00
Brian C
812277f99f Fix native constructor and pool exports (#1061) 2016-06-24 00:52:28 -05:00
Brian C
0aa62f2854 Make tcp-keepalive configurable (#1058) 2016-06-21 21:38:10 -05:00
Konstantin Petryaev
ad65c7b1bc Fix of pool leaking by TCP-keepalive (#918)
* fix of bug with pool leaking by TCP keep-alives

* add test for check setKeepAlive on connect

* fix mistake with var

* fix mistake with var
2016-06-21 14:49:41 -05:00
Brian C
796a44f54f Remove internal pool (#1049)
* Initial work on removing internal pool

* Port backwards-compabible properties

* Cleanup test execution & makefile cruft

* Attempt to fix flakey error test
2016-06-21 09:53:09 -05:00
Jos Kuijpers
1596a933eb Fix SSL configuration error and add tests. #848 (#1055) 2016-06-21 09:42:30 -05:00
Brian C
2fd9c77085 Make Query & NativeQuery implement the promise interface (#1047)
* 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
2016-06-10 17:18:19 -05:00
Brian Dunavant
01e5d726da Support for defaults.connectionString (#910) 2016-06-07 16:09:22 -05:00
Pavel Lang
ad2ffce986 pg.native returns null if pg-native is missing (#950)
`require('pg').native` will be `null` and report error once to `stdout` when `pg-native` is missing.
2016-06-07 16:02:07 -05:00
Tristan Davies
55abbaa844 don't mutate params when preparing statement (#992) 2016-04-28 14:46:33 -05:00
Brian C
a8bd44a6ec Requiring native bindings polutes 'global' (#984)
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.
2016-04-08 18:46:10 -05:00
Seth Pollack
909c0f1872 add option to parse input Dates as UTC 2016-02-23 17:02:08 -08:00
Brian C
93d1e88d81 Merge pull request #935 from jkgeyti/master
Support querying tables with column names with multiple apostrophes
2016-02-15 11:50:00 -05:00
Frederick Stark
ac438e8952 Add integration test for Result.addRow 2016-02-12 13:37:49 +11:00
Jens Kristian Geyti
02c47f5071 Support querying tables with column names with multiple apostrophes (issue #934). Includes integration test. 2016-02-10 20:52:43 +00:00
Michael Nahkies
fa16966f91 add failing test that shows the issue 2016-01-27 18:06:22 +13:00
Tom Hughes
771111eb73 Use connection configuration consistently in tests 2015-12-04 15:41:11 +00:00
Oliver Salzburg
e5a63ab58d Don't emit error events parsed out of data stream 2015-08-24 17:24:52 +02:00
Brian C
0102bad997 Merge pull request #825 from kevinburke/typo-fix
s/saftey/safety
2015-08-04 08:52:00 -05:00
Kevin Burke
b4746e82e5 s/saftey/safety 2015-08-02 09:25:57 -07:00
brianc
6f8292435d Respond to emptyQuery with a sync message
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
2015-08-01 18:51:49 -05:00
brianc
17f14f4e58 Add warning for native bindings 2015-06-07 10:20:48 -04:00
brianc
7568f84553 Patch failing test until I have time to investigate 2015-03-01 19:22:18 -05:00
Brian C
f8d5db9edf Merge pull request #734 from MayhemYDG/patch
Fix result.rowCount being a string instead of a number via native bindings.
2015-02-22 16:33:29 -04:00
Mayhem
e5d2f96099 Use strictEqual instead 2015-02-22 21:30:22 +01:00
Mayhem
37956e22c5 Fix result.rowCount being a string instead of a number via native bindings.
Fixes #708
2015-02-21 17:32:39 +01:00
Marek
4e37b1f053 Add test to make sure interval objects returned can be passed back into a prepared statement 2015-01-27 17:27:09 +00:00
Brian M. Carlson
e2aa07c06c Remove error code test on native 2015-01-13 18:13:20 -05:00
rpedela
619783b916 #701 Add tests for new error fields in 9.3+. 2015-01-12 12:23:17 -07:00
Brian M. Carlson
1094040344 Fix test 2014-12-13 12:25:07 -05:00
Kesav Kumar Kolla
0994d6b795 Added test cases for issue #699 2014-12-12 13:53:09 +05:30
David H. Bronke
5fff5fc61f Added integration test for overriding type parsers on a per-client basis. 2014-12-03 09:45:20 -06:00
Brian M. Carlson
fb2db0874d Merge with origin/master 2014-11-18 14:59:38 -05:00
Brian M. Carlson
35596fdbdc Upgrade version of pg-native 2014-11-18 09:32:16 -05:00
Brian M. Carlson
f088442570 Fix for empty buffer segfault in native bindings 2014-11-10 23:29:15 -05:00
Brian M. Carlson
9e2a3e599b Fix issue with parsed statement cache timing - closes #665 2014-10-21 13:50:49 -04:00
Brian M. Carlson
11c3c74994 Merge branch 'master' of github.com:brianc/node-postgres 2014-10-20 00:21:28 -04:00
Brian M. Carlson
1ccc5eb40b Add regression test for #199 2014-10-20 00:21:16 -04:00