diff --git a/lib/result.js b/lib/result.js index aea4d374..7dfd116f 100644 --- a/lib/result.js +++ b/lib/result.js @@ -27,7 +27,7 @@ var Result = function (rowMode) { } } -var matchRegexp = /([A-Za-z]+) ?(\d+ )?(\d+)?/ +var matchRegexp = /^([A-Za-z]+)(?: (\d+))?(?: (\d+))?/ // adds a command complete message Result.prototype.addCommandComplete = function (msg) { @@ -41,12 +41,12 @@ Result.prototype.addCommandComplete = function (msg) { } if (match) { this.command = match[1] - // match 3 will only be existing on insert commands if (match[3]) { - // msg.value is from native bindings - this.rowCount = parseInt(match[3] || msg.value, 10) + // COMMMAND OID ROWS this.oid = parseInt(match[2], 10) - } else { + this.rowCount = parseInt(match[3], 10) + } else if (match[2]) { + // COMMAND ROWS this.rowCount = parseInt(match[2], 10) } } diff --git a/test/unit/client/result-metadata-tests.js b/test/unit/client/result-metadata-tests.js index 59b83443..276892e9 100644 --- a/test/unit/client/result-metadata-tests.js +++ b/test/unit/client/result-metadata-tests.js @@ -35,3 +35,5 @@ testForTag('INSERT 841 1', check(841, 1, 'INSERT')) testForTag('DELETE 10', check(null, 10, 'DELETE')) testForTag('UPDATE 11', check(null, 11, 'UPDATE')) testForTag('SELECT 20', check(null, 20, 'SELECT')) +testForTag('COPY', check(null, null, 'COPY')) +testForTag('COPY 12345', check(null, 12345, 'COPY'))