Commit Graph

92 Commits

Author SHA1 Message Date
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
Charmander
41017814d3 Avoid infinite loop on malformed message (#1208)
* Avoid infinite loop on malformed message

If handling of such messages is deemed unimportant, `indexOf` is still faster (~40%) and cleaner than a manual loop.

Addresses #1048 to an extent.

* Use indexOf fallback for Node ≤0.12
2017-02-21 11:19:03 -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
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
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
Dorian Johnson
eb7b15c623 Fix byte representation of CancelRequest message
I noticed that query cancellation was not working when connecting through pgbouncer,
even though it worked fine when directly connected. This is because we're appending an
extra null byte, and pgbouncer is strict about the packet length.
(per http://www.postgresql.org/docs/9.1/static/protocol-message-formats.html)

This removes the extraneous byte, which fixes cancellation against pgbouncer.
2016-03-09 16:13:54 -08:00
sibedge
f703c18aca Error message misspelling.
Fixing error message misspelling.
2015-11-14 16:33:25 +00:00
brianc
edef4fee53 Add warning on long query names
Postgres has a 63 character limit on query names.  To avoid potential footgunning of users we'll log to their stderr if they use a longer query name.

For reference: https://github.com/brianc/node-postgres/pull/772
2015-05-21 13:17:04 -04:00
rpedela
f4579b7a9c #701 Expose error fields added in PG 9.3. 2015-01-10 15:02:18 -07:00
jeromew
aada94da6b Add Close/CloseComplete messages of wire protocol 2014-09-18 11:27:22 +02:00
Solomon English
48b5537683 adding an error handler for the tls socket connection 2014-05-07 02:18:03 -07: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
Matti Virolainen
17dbb640a6 Remove unused parameter 'name' from DataRowMessage. 2014-04-19 11:54:12 +03:00
Tim Griesser
cd050334ba Removed various unused vars 2014-04-09 08:46:17 -04: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
Sandro Santilli
e1b1c62e3e Do not emit 'end' twice from Connection on close 2014-04-04 10:07:07 +02:00
Sandro Santilli
96e4afdb1b Have Connection also emit 'end' on stream 'close' event
Should fix missing connect callback call with node-0.8 (#534)
2014-03-18 14:23:05 +01:00
Brian M. Carlson
79f03948dd Use packet reader 2014-03-14 06:59:19 -05:00
Hannes Hörl
7fd79a41c3 Add support for (fallback_)application_name 2014-01-05 18:08:58 +01:00
Eugene Ware
4662d41972 bind Buffer variables as binary values 2013-09-19 01:50:42 +10:00
Rob Raux
bf419d2659 fix global variable leaks 2013-09-11 14:36:29 +00:00
Brian Carlson
beeae35291 Fix js-hint error 2013-08-17 17:33:27 -05:00
Brian Carlson
c98125b065 Use on('data') for v0.8.x 2013-08-17 17:25:24 -05:00
Brian Carlson
5108161a47 Cleanup & tweak perf a bit 2013-08-17 14:21:19 -05:00
Brian Carlson
4cdd7a116b Compile result parsing for a 60% speed increase
Tested against a 1000 row result set.  Need to test against
smaller result sets & figure out a way to make this backwards compatible if possible
2013-08-07 15:33:57 -05:00
Brian Carlson
b6bca99489 Minor speed improvements 2013-08-07 12:41:38 -05:00
Brian Carlson
56b7c4168d Create message in each parsing function 2013-08-07 12:20:51 -05:00
Brian Carlson
31318c02a2 Speed up JavaScript parser slightly 2013-08-07 11:57:43 -05:00
bmc
44784fa2f3 Fix JavaScript SSL upgrade logic
I had accepted the pull request way back without proper test coverage.
I've added test coverage & fixed this long-standing bug.
2013-06-29 23:20:48 -07:00
bmc
b33c266734 increase speed of javascript parser ~5% 2013-04-08 19:04:17 -05:00
bmc
ca5c10a02f clean up connection slightly & add initial bench 2013-04-08 16:44:41 -05:00
bmc
766b4286d5 merge branch v1.0 2013-04-04 11:51:55 -05:00
brianc
6e3cc794c3 ignore socket hangup. fixes #314 2013-03-29 09:38:49 -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
cee5f1d8b3 move buffer-writer to external module 2013-03-16 11:51:26 -05:00
Brian C
ed75b2f453 Merge pull request #291 from wgraeber/master
Potential fix for client_encoding error
2013-03-07 05:32:15 -08:00
brianc
c57eee8661 normalize whitespace, add comments, and do a little house cleaning 2013-03-06 10:26:40 -06:00
brianc
b58ae9e7f7 clean up prototype shorthand
For some reason a few years ago I thought it would be neat to use a shorthand version of prototype to save myself some keystrokes.  That was a cosmetic mistake.  It also breaks ctags.

Also, normalized some whitespace.
2013-03-06 08:48:52 -06:00
swilly
d4dc76077b possible fix for: error: unrecognized configuration parameter 'lient_encoding' 2013-03-05 15:44:20 -05:00
Arkady Emelyanov
4c254e8edf force utf-8 encoding on connect 2013-01-29 20:19:38 -06:00
Philipp Borgers
d8255c6f85 fix jshint errors in lib/connection.js 2013-01-24 22:05:34 +01:00
Philipp Borgers
cedcf0ca35 fix jshint errors for lib/connection.js 2013-01-24 21:59:28 +01:00
Sandro Santilli
2fc22de21a Send backend a CopyFail when no stream is defined to copy from 2013-01-16 12:41:14 +01:00
anton
c014096e0e COPY TO/FROM native/libpq done. Looks like it works, but need to test 2013-01-06 12:06:26 -06:00
brianc
c5b804f5c4 fix reference to ssl parameters 2012-12-04 14:18:19 -06:00
bmc
9341efe669 allow options to pass to js ssl connection bindings 2012-09-10 21:40:41 -05:00
Bruno Harbulot
158562f3d1 Initial support for SSL/TLS connections. 2012-08-20 21:41:56 -05:00
brianc
fa80b4e3fa make data conversion the same between native & javascript 2012-07-11 22:47:02 -05:00
brianc
7a2c428973 ignore writes to unwritable sockets - closes #130 2012-05-30 22:41:51 -05:00