diff --git a/index.js b/index.js index d6f0399..17b7237 100644 --- a/index.js +++ b/index.js @@ -62,8 +62,9 @@ CopyStreamQuery.prototype.handleCommandComplete = function(msg) { this.rowCount = parseInt(match[1], 10) } - this.unpipe() - this.emit('end') + // unpipe from connection + this.unpipe(this.connection) + this.connection = null } CopyStreamQuery.prototype.handleReadyForQuery = function() {