Re: Add PQsendSyncMessage() to libpq

Anton Kirilov <antonvkirilov@gmail.com>

From: Anton Kirilov <antonvkirilov@gmail.com>
To: Alvaro Herrera <alvherre@alvh.no-ip.org>
Cc: Michael Paquier <michael@paquier.xyz>, Robert Haas <robertmhaas@gmail.com>, pgsql-hackers@postgresql.org
Date: 2023-05-05T15:02:24Z
Lists: pgsql-hackers
Hello,

On Thu, 4 May 2023, 11:36 Alvaro Herrera, <alvherre@alvh.no-ip.org <mailto:alvherre@alvh.no-ip.org>> wrote:
> On 2023-May-04, Anton Kirilov wrote:
> If you want to make sure it's fully flushed, your only option is to have
> the call block.


Surely PQflush() returning 0 would signify that the output buffer has been fully flushed? Which means that there is another, IMHO simpler option than introducing an extra flag - make the new function return the same values as PQflush(), i.e. 0 for no error and fully flushed output, -1 for error, and 1 for partial flush (so that the user may start polling for write readiness). Of course, the function would never return 1 (but would block instead) unless the user has called PQsetnonblocking() beforehand.

Best wishes,
Anton Kirilov

Commits

  1. Remove some comments related to pqPipelineSync() and PQsendPipelineSync()

  2. libpq: Add PQsendPipelineSync()

  3. Fix stop condition for dumping GRANT commands