Open boromisp opened 5 months ago
Similarly to https://github.com/brianc/node-postgres/issues/3219, COPY TO doesn't play nice with query_timeout. https://github.com/brianc/node-pg-copy-streams/pull/126 fixed this issue for COPY FROM.
COPY TO
query_timeout
COPY FROM
I've been using this patch for some time now, and it seems to work:
const { to: copyTo } = require('pg-copy-streams'); const fixedCopyTo = (query, options) => { const streamQuery = copyTo(query, options); streamQuery.callback = () => {}; const handleError = streamQuery.handleError.bind(streamQuery); const handleReadyForQuery = streamQuery.handleReadyForQuery.bind(streamQuery); streamQuery.handleError = e => { streamQuery.callback(); handleError(e); }; streamQuery.handleReadyForQuery = () => { streamQuery.callback(); handleReadyForQuery(); }; return streamQuery; }; module.exports = fixedCopyTo;
Similarly to https://github.com/brianc/node-postgres/issues/3219,
COPY TO
doesn't play nice withquery_timeout
. https://github.com/brianc/node-pg-copy-streams/pull/126 fixed this issue forCOPY FROM
.I've been using this patch for some time now, and it seems to work: