libpq: drop pending pipelined commands in pqDropConnection().
authorTom Lane <[email protected]>
Thu, 12 May 2022 16:42:29 +0000 (12:42 -0400)
committerTom Lane <[email protected]>
Thu, 12 May 2022 17:08:31 +0000 (13:08 -0400)
commit93909599cdba64c8759d646983c0a4ef93de1e50
treeb6790513e4d573be69c4585fd3712a72ed7f0e2e
parentb5f44225b833a2fd07b4a7c77e33ae0c37e6a7d6
libpq: drop pending pipelined commands in pqDropConnection().

The original coding did this in pqDropServerData(), which seems
fairly backwards.  Pending commands are more like already-queued
output data, which is dropped in pqDropConnection().  Moving the
operation means that we clear the command queue immediately upon
detecting connection drop, which improves the sanity of subsequent
behavior.  In particular this eliminates duplicated error message
text as a consequence of code added in b15f25446, which supposed
that a nonempty command queue must mean the prior operation is
still active.

There might be an argument for backpatching this to v14; but as with
b15f25446, I'm unsure about interactions with 618c16707.  For now,
given the lack of complaints about v14's behavior, leave it alone.

Per report from Peter Eisentraut.

Discussion: https://postgr.es/m/de57761c-b99b-3435-b0a6-474c72b1149a@enterprisedb.com
src/interfaces/libpq/fe-connect.c