brianc/node-pg-query-stream

Can you combine QueryStream & Prepared Statements?

if-kenn opened this issue · 4 comments

Is this possible?

When I do something like:

var pg          = require('pg'),
    QueryStream = require('pg-query-stream');
    credUrl     = {...};

pg.connect(credUrl, function(err, client, done) {
    var query       = new QueryStream({text : 'SELECT 10 as ten;', name : 'select10'}, []),
        stream      = client.query(query);
});

I get "TypeError: Argument must be a string". Am I missing something?

btd commented

I would suggest you to try:

var query = new QueryStream('SELECT 10 as ten', []);
qyery.name = 'select10';

I have not tried it yet myself. But by idea it should work.

Any (official) update on this?

Now with pg@7.0.0 this becomes really important

This isn't currently supported but I can add it as a new feature.

If you or your company benefit from node-postgres and have the means, please consider supporting my work on Patreon.

This would be really great 😊