dmanjunath / node-redshift

A simple collection of tools to help you get started with Amazon Redshift from node.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pg.types in node-redshift

Noursounet opened this issue · comments

Hi,

When a date is pulled from RedShift, nodejs makes a "new Date()", so we depend on Local timezone.
pg offers the possibility to override types parsing:

var pg = require('pg');
var types = pg.types;

var TIMESTAMP_OID = 1114;
var parseDateFn = function (val) {
    return val === null ? null : val;
};
types.setTypeParser(TIMESTAMP_OID, parseDateFn);

Unfortunately the node-redshift npm doesn't export this pg.types object and so we can't modify the way javascript will parse redshift data.

Would it be possible to add it?

Thanks

Yeah great suggestion @Noursounet. Turns out it was a one liner to add it to redshift object. I've pushed up the code already. I'll update the readme and I'll do an npm push sometime today.

Thanks a lot!

Hi @dmanjunath,

Sorry for bothering but i was wandering when are you planning to publish the new npm version ? ^^

Thanks a lot!

Noursounet

Great! Thanks a lot