From 81d125fe18b56e4f0979b5a9b5f5ca072c9dd51d Mon Sep 17 00:00:00 2001 From: kesavkolla Date: Thu, 11 Dec 2014 12:10:14 +0530 Subject: [PATCH] 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. --- lib/client.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/client.js b/lib/client.js index 8c281725..3b688f94 100644 --- a/lib/client.js +++ b/lib/client.js @@ -313,7 +313,9 @@ Client.prototype.query = function(config, values, callback) { if(this.binary && !query.binary) { query.binary = true; } - query._result._getTypeParser = this._types.getTypeParser.bind(this._types); + if(query._result) { + query._result._getTypeParser = this._types.getTypeParser.bind(this._types); + } this.queryQueue.push(query); this._pulseQueryQueue();