model-writtenrun 8383 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Andres Freund reported that shutting down the server during pgbench initialization left COPY consuming CPU and made control-C ineffective because the cancellation request could not be sent #1.
- Tom Lane separated the problem into missing socket reads after write failures, longstanding failure to process server error messages during COPY, and a cancellation flag that depended on successfully sending a request #2.
- Tom supplied a libpq patch that reads incoming data in both write-failure paths, reporting successful pgbench tests with fast and immediate shutdowns, with and without SSL, while deferring broader COPY behavior changes #3.
- Thomas Munro reproduced the earlier SSL failure scenario and confirmed that the libpq patch preserved the expected revoked-certificate error #4 #5; he also reported a separate misleading server-side SSL error for which this thread supplied no fix #6.
- Oleksandr Shulgin asked about regression coverage #7, but Thomas identified Windows socket behavior and the need for an injected delay as obstacles to automating the SSL test #8.
- Tom posted an independent cancellation patch that makes CancelRequested mean SIGINT was received, removes a potentially blocking and unnecessary query-result read, and simplifies select_loop instead of introducing another cancellation flag #9.
- Andres questioned whether checking write_failed elsewhere could suffice and whether consuming COPY error messages truly required an API change #10; Tom defended centralized socket reads and discussed peeking at errors versus consuming and reporting them, leaving broader COPY error handling unresolved at the thread's last message #11.
- The cancellation patch #9 subsequently landed as 92f33bb7af with only comment edits and no backport, while the libpq patch #3 landed unchanged as 7247e243a8 and was backported to PostgreSQL 12.