Commit Graph

154 Commits

Author SHA1 Message Date
Raul Marin
389c25f44d Merge tag 'v6.4.2' into cdb-6.1
Bump version
2018-05-23 17:54:17 +02:00
Raul Ochoa
3eef52dd1e Merge tag 'v6.1.6' into cdb-6.1
Bump version
2017-08-13 12:01:19 +02:00
Eder Ávila Prado
860cccd531 fix for server enconding when using SQL_ASCII and latin1 enconding 2017-06-21 12:23:06 -05:00
Brian M. Carlson
b5b49eb895 Add deprecations
This adds deprecations in preparation for `pg@7.0`

- deprecate using event emitters on automatically created results from client.query.
- deprecate query.promise() - it should never have been a public method and it's not documented. I need to do better about using _ prefix on private methods in the future.
- deprecate singleton pool on the `pg` object. `pg.connect`, `pg.end`, and `pg.cancel`.
2017-06-19 16:00:37 -05:00
Brian Carlson
76c59a01f2 Emit error when backend unexpectedly disconnects 2017-06-09 12:27:47 -05:00
T.J. Schuck
e5f0e5d36a s/2016/2017/ (#1291) 2017-05-17 16:47:07 -05:00
Kibae Shin
4f790deb73 Support for logical streaming replication (#1271)
* Support for logical streaming replication

* Wrong compare expr in getLibpqConnectionString

* Simplify codes for replication parameter
2017-04-24 13:24:30 -05:00
Magnus Hiie
197f86f90d Fix ECONNRESET error emitted after failed connect (#1230)
On Windows, after a connect attempt has failed, an error event with
ECONNRESET is emitted after the real connect error is propagated to the
connect callback, because the connection is not in ending state
(connection._ending) where ECONNRESET is ignored. This change ends the
connection when connect has failed.

This fixes #746.
2017-03-20 12:01:41 -05:00
Linus Unnebäck
ce8f215c88 Fix throw in type parsers when in prepared statement (#1242) 2017-03-09 15:05:26 -06:00
Raul Ochoa
3c81aea432 Clean line end 2016-12-16 17:35:47 +00:00
Raul Ochoa
8e7c659f33 Merge remote-tracking branch 'brianc/master' into cdb-6.1 2016-12-16 16:55:33 +00: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
Daniel García Aubert
fa8cfcaebf Emit message if the returned row is bigger than limit 2016-12-07 15:12:43 +01: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
Illirik Smirnov
522d62229b Resolve merge conflict in PR #1041 (#1065)
* Add license comment

* Delete pool.js
2016-06-24 10:56:43 -05:00
Brian C
0aa62f2854 Make tcp-keepalive configurable (#1058) 2016-06-21 21:38:10 -05:00
Martynas Kunigėlis
6fddc566f0 Use Buffer concatenation for binary data instead of binary strings. Fixes Node.js v6.0.0 breakage. (#1001) 2016-04-27 13:52:28 -05:00
Joost Farla
f50f5ce7e8 Require statements break Browserify compatibility 2015-10-10 11:10:51 +02: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
kesavkolla
81d125fe18 Making a conditional check for type parser
The code is failing with pg-copy-streams.  The pg-copy-streams creates a query object but it doesn't have any _result.  Make the type parser an optional only when _result object available on query then only set the type parser.
2014-12-11 12:10:14 +05:30
David H. Bronke
4bfdc041ef Moved type override code into a new class. 2014-12-03 11:00:27 -06:00
David H. Bronke
857408540c Corrected property access on possibly undefined variable. 2014-12-03 10:53:55 -06:00
David H. Bronke
a0bf25e308 Implemented per-client type parser overrides.
Adds Client#getTypeParser() and Client#setTypeParser().
2014-12-03 10:38:57 -06:00
Brian M. Carlson
fb2db0874d Merge with origin/master 2014-11-18 14:59:38 -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
0b2344b6b5 Remove COPY TO / COPY FROM 2014-10-11 14:27:03 -04:00
Brian M. Carlson
d2bb532d73 Make moar tests pass 2014-09-14 21:11:51 -04:00
Ricky Ng-Adam
6216f6089f test to reproduce behavior of issue brianc/node-postgres#549
a fix was provided in 5079c1e0c41f431ac2e02c40ebd875d8fbb34004;
test is modeled on query-error-handling-tests.js;
test both kill query and disconnection on prepared statement execution;
make connection error string message consistent between native and non-native;
disable test server-side kill for native as it hangs;
sync can cause error to be emitted so we catch that;
we also move _ending state before _send is called.
2014-04-24 08:36:54 +08:00
Brian C
f3fc6ff705 Merge pull request #546 from CartoDB/2.11-ensure-connect-callback
Ensure connect callback is invoked on premature socket hangup
2014-04-06 11:18:23 -05:00
Victor Widell
5079c1e0c4 Added missing argument to handleError method call.
Before the change, it would crash with a very unhelpful error message:

	[project path]/node_modules/pg/lib/query.js:92
	    connection.sync();
	               ^
	TypeError: Cannot call method 'sync' of undefined
	    at Query.handleError ([project path]/node_modules/pg/lib/query.js:92:16)
	    at Client.connect ([project path]/node_modules/pg/lib/client.js:178:24)
	    at g (events.js:185:14)
	    at EventEmitter.emit (events.js:85:17)
	    at Socket.<anonymous> ([project path]/node_modules/pg/lib/connection.js:60:10)
	    at Socket.EventEmitter.emit (events.js:85:17)
	    at TCP.onread (net.js:424:51)


After the change, it reports a much more helpful

	error running query [Error: Stream unexpectedly ended during query execution]
2014-03-29 16:45:00 +01:00
Sandro Santilli
64d6883a81 Ensure connect callback is invoked on premature socket hangup
Closes #534
2014-03-18 13:03:15 +01:00
Hannes Hörl
7fd79a41c3 Add support for (fallback_)application_name 2014-01-05 18:08:58 +01:00
Hannes Hörl
95295ad2fb Handle .pgpass in the js client 2013-12-06 00:01:51 +01:00
Brian M. Carlson
99f9492c72 Clean up copy-in internal API 2013-10-22 00:23:43 -05:00
Brian M. Carlson
894c60e605 Accept anything with function 'submit' as a query
This allows for passing in custom objects which conform to the query API
2013-10-21 13:29:17 -05:00
Brian M. Carlson
a72bd5cb3c Semi-colons 2013-10-21 09:39:49 -05:00
Brian M. Carlson
fc397ee7f5 Clean up client->query event delegation 2013-10-21 09:20:21 -05:00
Brian Carlson
1674359b57 Respect SSL setting from connection parameters 2013-09-09 11:50:20 -05:00
rpedela
ffe51c20f2 Add missing semicolons. 2013-07-15 09:13:48 -05:00
rpedela
876018e103 Add support for PQescapeLiteral and PQescapeIdentifier. Also add JS versions of the functions. 2013-07-15 09:13:48 -05:00
bmc
56a5903a02 Make throws in query error callback not break client
If you receive an error while running a query and in user's callback
they throw an exception it can disrupt the internal query queue
and prevent a client from ever cleaning up properly
2013-04-19 09:25:53 -05:00
bmc
9b1c4facc2 Make query callback exceptions not break client
If you throw an exception in a query callback the client will not pulse
its internal query queue and therefor will never process any
more queries or emit its own 'drain' event.

I don't find this to be an issue in production code since I restart
the process on exceptions, but it can break tests and cause things
to 'hang'.  My crude benchmarks show no noticable impact in perf
from the try/catch/rethrow.

:q
2013-04-19 09:09:28 -05:00
Karl Mikkelsen
44e4586e18 var utils declared and not used 2013-04-05 17:46:23 +12:00
bmc
766b4286d5 merge branch v1.0 2013-04-04 11:51:55 -05:00
brianc
683d636501 better handling of client stream termination
1. Pass an error to an active query if the client is ended while a query is in progress.
2. actually emit 'end' event on the client when the stream ends
3. do not emit an error from native bindings if lasterror is null
2013-03-28 13:24:33 -05:00
brianc
1d6541724e remove deprecation warnings & deprecate lib 2013-03-17 14:51:57 -05:00
brianc
e93a4a5d66 remove pauseDrain/resumeDrain 2013-03-07 16:12:09 -06:00
brianc
213518648b ability to hide deprecation warnings 2013-03-07 10:01:14 -06:00
brianc
6415450634 deprecate pauseDrain/resumeDrain & auto-releasing client pool 2013-03-07 09:47:04 -06:00
brianc
c57eee8661 normalize whitespace, add comments, and do a little house cleaning 2013-03-06 10:26:40 -06:00