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
Luke Murray
a8f9b7dc93
avoid eval if the row is returned as an array
2014-05-21 00:44:53 +10:00
Nuno Sousa
7612bbc402
Add support for overriding generic pool defaults
2014-05-16 15:00:18 +01:00
Marek
47b0aafa6d
Make sure 'end' is emitted even if no connection has ever happened
2014-05-13 12:57:01 +01:00
Solomon English
48b5537683
adding an error handler for the tls socket connection
2014-05-07 02:18:03 -07:00
Ricky Ng-Adam
4de8f04c34
count reuse of each connection as client.poolCount
2014-04-25 13:10:16 +08: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
1047aeb3c2
Merge pull request #571 from letsface/ended-event-on-pool-drained
...
emit event 'ended' on pool drained
2014-04-22 16:27:57 -05:00
Matti Virolainen
17dbb640a6
Remove unused parameter 'name' from DataRowMessage.
2014-04-19 11:54:12 +03:00
Ricky Ng-Adam
0882c8da02
from ended to end
2014-04-18 23:30:45 +08:00
Ricky Ng-Adam
9ab6ed76d1
remove extra whitespace
2014-04-17 17:04:46 +08:00
Ricky Ng-Adam
85c28e9088
destroyAllNow also has a callback
2014-04-17 16:25:59 +08:00
Ricky Ng-Adam
382d6d66f9
emit event when all pool are actually destroyed
2014-04-17 16:18:49 +08:00
Philipp Borgers
fa3b1ccc5b
remove pause/resumeDrain functions from native code as disccued in issue #515
2014-04-16 19:10:49 +02:00
Brian M. Carlson
9c87253aff
Fix memory leak with domains
2014-04-12 00:29:44 -05:00
Tim Griesser
cd050334ba
Removed various unused vars
2014-04-09 08:46:17 -04:00
Tim Griesser
0565ed6c05
Remove legacy .once events shim
2014-04-08 21:29:51 -04:00
Brian M. Carlson
bd74d48791
Fix query error emit on native bindings
2014-04-06 12:55:26 -05:00
Brian M. Carlson
357b64d704
Remove query emit 'end' event when query has error
...
Closes #547
2014-04-06 11:53:47 -05: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
Brian C
82486929a9
Merge pull request #555 from benesch/custom-type-coercion
...
Supercharge `prepareValue`
2014-04-06 11:16:33 -05:00
Sandro Santilli
e1b1c62e3e
Do not emit 'end' twice from Connection on close
2014-04-04 10:07:07 +02:00
Nikhil Benesch
619ba46ffe
pass prepareValue
hook to toPostgres
...
Pass `toPostgres` type-coercers a reference to the `prepareValue`
function to ease constructing literals composed of other Postgres types.
2014-04-03 10:28:02 -04:00
Brian C
7dbc4c9845
Merge pull request #552 from geon/patch-1
...
Added missing argument to handleError method call.
2014-04-03 08:58:48 -05:00
Nikhil Benesch
6ced524390
allow type-coercion overrides for custom objects
...
Attempt to call a `toPostgres` method on objects passed as query values
before converting them to JSON. This allows custom types to convert
themselves to the appropriate PostgreSQL literal.
This strategy is fully backwards-compatible and uses the same pattern as
the `toJSON` override.
2014-03-30 20:39:56 -04:00
Nikhil Benesch
c41eedc3e0
properly prepare complex arrays
...
`arrayString` duplicated too much of `prepareValue`'s logic, and so
didn't receive bugfixes for handling dates with timestamps. Defer to
`prepareValue` whenever possible.
This change enforces double-quote escaping of all array elements,
regardless of whether escaping is necessary. This has the side-effect of
properly escaping JSON arrays.
2014-03-30 19:12:18 -04:00
Nikhil Benesch
364cf4b3ca
utils: convert tabs to spaces
2014-03-30 19:11:02 -04:00
Nikhil Benesch
7faa2b325e
utils: reorganize prepareValue conditional for clarity
...
Prefer positive tests; group tests for specific objects.
2014-03-30 19:03:28 -04:00
Nikhil Benesch
cb7bbe6502
query: remove dead type-parsing code path
...
Type parsing was factored out into the pg-types package. Remove vestigal
`noParse` function.
2014-03-30 19:02:11 -04: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
Brian C
b12dd4c420
Merge pull request #543 from CartoDB/2.11-remove-ended-connections
...
Remove disconnected clients from the pool
2014-03-22 10:47:53 -05: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
Sandro Santilli
64d6883a81
Ensure connect callback is invoked on premature socket hangup
...
Closes #534
2014-03-18 13:03:15 +01:00
Sandro Santilli
fb118cf069
Avoid loop between pool.destroy and client.end
2014-03-18 09:42:19 +01:00
Sandro Santilli
9c5cd8d02d
Remove disconnected clients from the pool
...
Might fix #458
Fixes https://github.com/CartoDB/CartoDB-SQL-API/issues/135
2014-03-17 18:51:32 +01:00
Brian M. Carlson
779c8064f2
Add domain support to connection pool
2014-03-15 16:41:33 -05:00
Brian M. Carlson
0254fa565f
Add test for pg.types interface
2014-03-15 15:41:36 -05:00
Brian M. Carlson
876abe8730
Break type parsing into separate module
2014-03-15 15:36:27 -05:00
Brian M. Carlson
79f03948dd
Use packet reader
2014-03-14 06:59:19 -05:00
Brian C
2716f95257
Merge pull request #514 from benighted/parse-date-as-local
...
Parse date type as local time
2014-02-26 06:16:12 -06:00
Brian C
ff8fb616f6
Merge pull request #501 from lalitkapoor/GH-452
...
improve support for int arrays and float arrays
2014-02-26 06:15:35 -06:00
Brian C
be37756607
Merge pull request #395 from aaronyo/master
...
Unable to reconnect after calling pg.end()
2014-02-26 06:12:57 -06:00
Brian M. Carlson
bf0c4bfaa9
Merge branch 'pull/326'
...
Conflicts:
lib/connection-parameters.js
test/unit/connection-parameters/creation-tests.js
2014-02-26 06:10:15 -06:00
Michael Payne
b81a60a260
Parse date type as local time
2014-01-26 10:43:15 -05:00
Brian C
62f6b2fbf9
Merge pull request #507 from brianc/issues/507
...
Unexpected identifier with pg versions > 2.3.1
2014-01-22 06:42:59 -08:00
Brian M. Carlson
5f592a1240
Fix exception caused by column names with single quotes
...
Also rename some test files so they match the Makefile regex. They will be included in the test suite from now on.
2014-01-22 08:38:29 -06:00
Lalit Kapoor
8f4644dc3d
parse values in float arrays as floats not strings
...
javascript numbers are 64-bit floating numbers
2014-01-08 00:09:34 -06:00
Lalit Kapoor
3cb35e0f46
big integer array support
2014-01-08 00:08:57 -06:00
Lalit Kapoor
58b4d9cf9c
comment explaining how to get oid
2014-01-07 11:48:55 -06:00
Hannes Hörl
7fd79a41c3
Add support for (fallback_)application_name
2014-01-05 18:08:58 +01:00
Hannes Hörl
5c5c57e60b
Fixes bug in test for extended years
2013-12-23 02:13:10 +01:00
Hannes Hörl
9ad0159037
merge with upstream
2013-12-22 23:21:42 +01:00
Aurélio A. Heckert
c0fd4b1431
Set database on socket string connection
...
Allows to conect to a specific database trough this ways:
pg.connect('/some/path database', callback);
pg.connect('socket:/some/path?db=database', callback)
pg.connect('socket:/some/path?db=database&encoding=utf8', callback)
2013-12-19 15:37:26 -03:00
Hannes Hörl
61f8f55d43
Handle .pgpass in the native client
2013-12-11 01:24:55 +01:00
Michael Payne
b9c9c6f329
Fix for Y10k problem
2013-12-09 23:35:18 -05:00
Hannes Hörl
95295ad2fb
Handle .pgpass in the js client
2013-12-06 00:01:51 +01:00
Brar Piening
d5e459227a
Modified defaults.js to use process.env.USERNAME instead of process.env.USER as default value for user and database on Windows platforms
2013-11-20 20:19:31 +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
Albert Łącki
96018dbfae
FIXED for jshint
2013-10-17 03:06:31 +02:00
Albert Łącki
67a47b9025
Parse arrays: json[], uuid[]
2013-10-16 07:03:43 +02:00
Brian C
aea984f7bc
Merge pull request #447 from eugeneware/buffer-params
...
Bind Buffer Variables as binary values (with Native implementation also)
2013-10-02 20:32:03 -07:00
Brian C
4fcfc66a45
Merge pull request #423 from rpedela/master
...
Add support for single row mode
2013-09-30 09:31:07 -07: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
1674359b57
Respect SSL setting from connection parameters
2013-09-09 11:50:20 -05:00