pg numeric return formatting
Per the attached, pg returns numerics with quotes and integers without
You have to specify the type like this:
pg.types.setTypeParser(1700, function(val) { // NUMERIC return val === null ? null : parseFloat(val) }); pg.types.setTypeParser(20, function(val) { // INT8 if(val !== null && val.length >= 16 && val[0] == '9') logger.error('WARNING!!! PG type 20 (int8) value is very likely to be invalid in javascript:',val,'Number.MAX_SAFE_INTEGER',Number.MAX_SAFE_INTEGER); return val === null ? null : parseInt(val) });
@MarkAurit because JavaScript does not support 64 bit numbers we have to return numeric types as strings in case they are larger than 32 bits. There is more information here:
https://github.com/brianc/node-pg-types