<div>21.10.2022, 17:40, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>:</div><blockquote><p>Laurenz Albe <<a href="mailto:laurenz(dot)albe(at)cybertec(dot)at" rel="noopener noreferrer">laurenz(dot)albe(at)cybertec(dot)at</a>> writes:</p><blockquote> On Fri, 2022-10-21 at 07:27 +0300, Vasily Kulikov wrote:<blockquote> The problem is that sometimes PQconsumeInput() may close the connection</blockquote></blockquote><p>What I'd suggest doing is checking for PQstatus(conn) == CONNECTION_BAD,<br />or else directly rechecking PQsocket() each time, rather than assuming<br />the socket is still there.</p></blockquote><div>I've chosen this one. Thanks for the help!</div>