Closed
Description
The type overrides configured at the pool or client level are not applied to the rows returned by the stream. However it works if type overrides are explicitly passed to the QueryStream
const typeInt8 = 20;
const types = new TypeOverrides();
types.setTypeParser(typeInt8, value => 'test');
const pool = new pg.Pool({ types });
pool.connect((err, client, release) => {
client.query('select 1::int8 as num;', (err, result) => {
console.log('query:', result.rows[0]);
});
client
.query(new QueryStream('select 1::int8 as num;'))
.pipe(new stream.Transform({
objectMode: true,
transform(chunk) {
console.log('implicit:', chunk);
}
}))
client
.query(new QueryStream('select 1::int8 as num;', null, { types }))
.pipe(new stream.Transform({
objectMode: true,
transform(chunk) {
console.log('explicit:', chunk);
}
}))
});
Outputs
query: { num: 'test' }
implicit: { num: '1' }
explicit: { num: 'test' }
Metadata
Metadata
Assignees
Labels
No labels