node-postgres icon indicating copy to clipboard operation
node-postgres copied to clipboard

fix(pg-query-stream): invoke `this.callback` on cursor end/error

Open aleclarson opened this issue 3 years ago • 8 comments
trafficstars

Closes #2013

This issue was caused by two things:

  • the Client wasn't using the callback argument that Pool#query passes with the QueryStream submittable
  • the QueryStream wasn't attaching end/error listeners to its cursor, which it needs for calling its callback

aleclarson avatar Sep 07 '22 17:09 aleclarson

Thanks for doing this! Can you include a test to reproduce the issue / prove its fixed? Without tests I am unlikely to merge PRs as they become a future bug waiting to re-occur! 😄

brianc avatar Sep 08 '22 04:09 brianc

I think pg-copy-streams may suffer from the same issue, and am happy to provide a failure case/ test.

peterp avatar Sep 11 '22 05:09 peterp

@peterp I believe you can send a PR to my fork and it'll show up here when I merge

aleclarson avatar Sep 11 '22 14:09 aleclarson

@aleclarson I'm sorry; I'm not going to find enough time to write this.

peterp avatar Sep 19 '22 09:09 peterp

I'm sorry; I'm not going to find enough time to write this.

While I greatly appreciate the work in fixing this, the PR will remain unmerged until a test case is submitted. I can't merge untested code as it becomes a forever maintenance burden for me in the future with no way to check for expected behavior.

brianc avatar Sep 27 '22 10:09 brianc

@aleclarson Can you update your repo to latest. I maybe able to write the tests that we needed for this

ashmit-coder avatar Dec 04 '23 12:12 ashmit-coder

@ashmit-coder 👍

aleclarson avatar Dec 05 '23 18:12 aleclarson

@aleclarson I let CI run on this PR so it should letcha know if tests pass. 😄

brianc avatar Dec 08 '23 00:12 brianc