Hi,

Looks like I found an issue: there can be a situation when libpq frontend hangs after zpq_read(). This may happen when the socket is not read ready and we can't perform another read because we wait on pqWait() but we actually have some buffered rx data.

I think we should add a check if there is any buffered rx data before calling pqWait() to avoid such hangs.

--
Daniil Zakhlystov