From eb7b15c6235a170defe04f9b60525bcc619069bb Mon Sep 17 00:00:00 2001 From: Dorian Johnson <2014@dorianj.net> Date: Wed, 9 Mar 2016 16:13:54 -0800 Subject: [PATCH] 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. --- lib/connection.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/connection.js b/lib/connection.js index f606de13..44b023cb 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -159,7 +159,7 @@ Connection.prototype.cancel = function(processID, secretKey) { .addInt16(5678) .addInt32(processID) .addInt32(secretKey) - .addCString('').flush(); + .flush(); var length = bodyBuffer.length + 4;