postgresql_16:5.1.5.2 Functions Associated with Pipeline Mode
PostgreSQL 16 > Client Interfaces > libpq — C Library > Pipeline Mode > Functions Associated with Pipeline Mode
PQpipelineStatus
Returns the current pipeline mode status of the libpq connection. PGpipelineStatus PQpipelineStatus(const PGconn *conn);
PQpipelineStatus can return one of the following values: PQ_PIPELINE_ON The libpq connection is in pipeline mode. PQ_PIPELINE_OFF The libpq connection is *not* in pipeline mode. PQ_PIPELINE_ABORTED The libpq connection is in pipeline mode and an error occurred while processing the current pipeline. The aborted flag is cleared when PQgetResult returns a result of type PGRES_PIPELINE_SYNC.
PQenterPipelineMode
Causes a connection to enter pipeline mode if it is currently idle or already in pipeline mode. int PQenterPipelineMode(PGconn *conn);
Returns 1 for success. Returns 0 and has no effect if the connection is not currently idle, i.e., it has a result ready, or it is waiting for more input from the server, etc. This function does not actually send anything to the server, it just changes the libpq connection state.
PQexitPipelineMode
Causes a connection to exit pipeline mode if it is currently in pipeline mode with an empty queue and no pending results. int PQexitPipelineMode(PGconn *conn);
Returns 1 for success. Returns 1 and takes no action if not in pipeline mode. If the current statement isn't finished processing, or PQgetResult has not been called to collect results from all previously sent query, returns 0 (in which case, use (see libpq-PQerrorMessage) to get more information about the failure).
PQpipelineSync
Marks a synchronization point in a pipeline by sending a sync message (see postgresql_16:8.4.2.3) and flushing the send buffer. This serves as the delimiter of an implicit transaction and an error recovery point; see (see postgresql_16:5.1.5.1). int PQpipelineSync(PGconn *conn);
Returns 1 for success. Returns 0 if the connection is not in pipeline mode or sending a sync message (see postgresql_16:8.4.2.3) failed.
PQsendFlushRequest
Sends a request for the server to flush its output buffer. int PQsendFlushRequest(PGconn *conn);
Returns 1 for success. Returns 0 on any failure.
The server flushes its output buffer automatically as a result of PQpipelineSync being called, or on any request when not in pipeline mode; this function is useful to cause the server to flush its output buffer in pipeline mode without establishing a synchronization point. Note that the request is not itself flushed to the server automatically; use PQflush if necessary.