Commit Graph

603 Commits

Author SHA1 Message Date
Tristan Davies
55abbaa844 don't mutate params when preparing statement (#992) 2016-04-28 14:46:33 -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
Martin Kuba
52aa25d8e8 added Client constructor back on pool to enable instrumentation (#998) 2016-04-26 17:41:11 -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
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
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
b78a508420 Add function stub to native result to solve broken test 2016-02-12 13:38:38 +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
3a9f5c3500 wrap entry point to prepareValue to only accept 1 arg 2016-01-27 18:08:46 +13:00
sibedge
f703c18aca Error message misspelling.
Fixing error message misspelling.
2015-11-14 16:33:25 +00:00
Brian C
ee21036962 Merge pull request #873 from kevinburke/fix-typo
defaults.js: fix typo in comment
2015-11-13 10:45:14 -06:00
Joost Farla
f50f5ce7e8 Require statements break Browserify compatibility 2015-10-10 11:10:51 +02:00
Kevin Burke
fccaa1c598 defaults.js: fix typo in comment 2015-10-08 23:02:15 -07:00
Oliver Salzburg
e5a63ab58d Don't emit error events parsed out of data stream 2015-08-24 17:24:52 +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
brianc
17f14f4e58 Add warning for native bindings 2015-06-07 10:20:48 -04: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
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
rpedela
f4579b7a9c #701 Expose error fields added in PG 9.3. 2015-01-10 15:02:18 -07: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
06b0392a57 Update travis config 2014-11-18 11:51:40 -05:00
Brian M. Carlson
35596fdbdc Upgrade version of pg-native 2014-11-18 09:32:16 -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
1e648c5df4 Do not consider a statement as prepared if it errors
Fixes #600
2014-10-19 22:53:08 -04:00
Brian M. Carlson
21f6dbe006 Break native result into its own file 2014-10-18 00:27:28 -04:00
Brian M. Carlson
5dff31387c Remove dead file 2014-10-18 00:21:39 -04:00
Brian M. Carlson
c3513a27fa Make native bindings an optional install 2014-10-18 00:20:18 -04:00
Brian M. Carlson
89d0938655 Subscribe to notification before emitting connected
Fixes a case where you connect & immediatley disconnect and _sometimes_ your notification subscription starts the reader on the libpq instance after the libpq instance is disconnected.  This segfaults the app.
2014-10-17 23:09:55 -04:00
Brian M. Carlson
0b2344b6b5 Remove COPY TO / COPY FROM 2014-10-11 14:27:03 -04:00
Brian M. Carlson
2de9838e78 Merge remote-tracking branch 'origin/master' into libpq
Conflicts:
	lib/native/index.js
	package.json
2014-10-11 14:16:23 -04:00
Brian M. Carlson
4c5f3aba65 Add support for native rowMode: array
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.
2014-10-11 14:09:29 -04:00
Brian M. Carlson
613112ca33 Upgrade to pg-native 1.2.0 to support rowMode:array 2014-10-09 21:54:34 -04:00
Brian M. Carlson
3867851341 Make cancel query tests pass 2014-10-09 21:12:17 -04:00
Brian M. Carlson
c5d4207aac Fix a few more failing tests 2014-09-23 18:57:20 -04:00
jeromew
aada94da6b Add Close/CloseComplete messages of wire protocol 2014-09-18 11:27:22 +02:00
Brian M. Carlson
60d5ab6abb Use 'bindings' module 2014-09-18 00:24:13 -04:00
Brian M. Carlson
d2bb532d73 Make moar tests pass 2014-09-14 21:11:51 -04:00
Brian M. Carlson
667c528ea6 Work towards more tests passing 2014-09-14 01:23:02 -04:00
Brian M. Carlson
b325971fdf Make more tests pass 2014-09-13 22:37:30 -04:00
Brian M. Carlson
9a68682109 First tests passing for new native bindings 2014-09-13 12:32:53 -04:00
Jos Kuijpers
1c17177369 Only call destroy on a client when it is not already being destroyed
Adds a check in the error listener on the client in the pool, to
prevent calling destroy on a client when it is already being
destroyed.
Without this check, if an error occurs during the ending of the
stream, such as a timeout, the client is never removed from
the pool and weird things happen.
2014-07-30 14:17:04 +02:00
Blaine Bublitz
54271a2df3 switch to pg-connection-string module for parsing 2014-07-06 16:39:22 -07:00
Mark Yen
fa17b6882a Include port as a connection parameter for socket connections 2014-06-11 18:18:11 -07:00
Brian C
e81245fce4 Merge pull request #591 from seegno/allow-config-override
Add support for overriding generic pool defaults
2014-05-22 12:09:46 -04:00
Brian C
f8df873023 Merge pull request #594 from lukemurray/master
avoid eval if the row is returned as an array
2014-05-22 12:09:09 -04:00