brianc / node-pg-pool

A connection pool for node-postgres
MIT License
180 stars 64 forks source link

pool.query does not return query, that is event emitter #63

Closed TheFive closed 7 years ago

TheFive commented 7 years ago

I try to transfer my code to the new pg-pool.

In my code i have used the query from a client as EventEmitter. This is not supported by pool.query. Do you plan to introduce that to, or is it a problem with the pooling ? (So should I refactor my code, or wait for a pg-pool update ?)

brianc commented 7 years ago

Hey good question! I recommend not using a query as an event emitter - use pool.query with either a promise response or a callback. Using a query as an event emitter will be deprecated in the next major release of node-postgres too! If you need to stream rows back use pg-query-stream

Hope this helps!

TheFive commented 7 years ago

Thanks, then i have to refactor.