From 7d11562e7bc5bb4453df80e1dd988a2dd9a0928b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Lal?= Date: Thu, 7 Nov 2013 15:36:46 +0100 Subject: [PATCH] postgres: always save object as Buffer There is either a problem with Dialect.escapeVal, or a problem with postgres 9.3 when casting string to bytea. Some strings are not accepted (because of \ ?) --- lib/Drivers/DML/postgres.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Drivers/DML/postgres.js b/lib/Drivers/DML/postgres.js index b2470b69..7380a3a0 100644 --- a/lib/Drivers/DML/postgres.js +++ b/lib/Drivers/DML/postgres.js @@ -302,7 +302,9 @@ Driver.prototype.propertyToValue = function (value, property) { switch (property.type) { case "object": - value = JSON.stringify(value); + if (!Buffer.isBuffer(value)) { + value = new Buffer(JSON.stringify(value)); + } break; case "date": if (this.config.timezone && this.config.timezone != 'local') {