From 496b56e6d50f21acf3c92da6768ea60314d58ca3 Mon Sep 17 00:00:00 2001 From: Vuong Hong An Date: Sun, 24 Nov 2019 23:05:03 +0700 Subject: [PATCH] Workaround problem of "Numeric fields returned as text" (https://github.com/brianc/node-pg-types/issues/28) --- lib/postgresql.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/postgresql.js b/lib/postgresql.js index 0a538d8f..d3164da6 100644 --- a/lib/postgresql.js +++ b/lib/postgresql.js @@ -30,6 +30,9 @@ exports.initialize = function initializeDataSource(dataSource, callback) { if (!postgresql) { return; } + postgresql.types.setTypeParser(20, function(val) { + return parseInt(val) + }) const dbSettings = dataSource.settings || {}; dbSettings.host = dbSettings.host || dbSettings.hostname || 'localhost';