node-postgres
node-postgres copied to clipboard
Get fields from query stream
Copy of this issue from the legacy repository https://github.com/brianc/node-pg-query-stream/issues/51
When using pg-query-stream is there a way to get the field description at the beginning or end of the stream?
You can do this:
const query = new QueryStream('SELECT * FROM SOMETHING')
const stream = client.query(query)
client.connection.once('rowDescription', (fields) => {
})
The stream itself doesn't emit the row description event, but the connection (kinda lower level thing inside the client) does.