From ff59d5d2cff32cfe88131f87b6c401970d449c08 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 23 Aug 2024 10:12:56 -0400 Subject: [PATCH] Provide feature-test macros for libpq features added in v17. As per the policy established in commit 6991e774e, invent macros that can be tested at compile time to detect presence of new libpq features. This should make calling code more readable and less error-prone than checking the libpq version would be (especially since we don't expose that at compile time; the server version is an unreliable substitute). Discussion: https://postgr.es/m/2042418.1724346970@sss.pgh.pa.us --- src/interfaces/libpq/libpq-fe.h | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/interfaces/libpq/libpq-fe.h b/src/interfaces/libpq/libpq-fe.h index 87a6f3df07..ca3e028a51 100644 --- a/src/interfaces/libpq/libpq-fe.h +++ b/src/interfaces/libpq/libpq-fe.h @@ -30,15 +30,32 @@ extern "C" /* * These symbols may be used in compile-time #ifdef tests for the availability - * of newer libpq features. + * of v14-and-newer libpq features. */ +/* Features added in PostgreSQL v14: */ /* Indicates presence of PQenterPipelineMode and friends */ #define LIBPQ_HAS_PIPELINING 1 /* Indicates presence of PQsetTraceFlags; also new PQtrace output format */ #define LIBPQ_HAS_TRACE_FLAGS 1 + +/* Features added in PostgreSQL v15: */ /* Indicates that PQsslAttribute(NULL, "library") is useful */ #define LIBPQ_HAS_SSL_LIBRARY_DETECTION 1 +/* Features added in PostgreSQL v17: */ +/* Indicates presence of PGcancelConn typedef and associated routines */ +#define LIBPQ_HAS_ASYNC_CANCEL 1 +/* Indicates presence of PQchangePassword */ +#define LIBPQ_HAS_CHANGE_PASSWORD 1 +/* Indicates presence of PQsetChunkedRowsMode, PGRES_TUPLES_CHUNK */ +#define LIBPQ_HAS_CHUNK_MODE 1 +/* Indicates presence of PQclosePrepared, PQclosePortal, etc */ +#define LIBPQ_HAS_CLOSE_PREPARED 1 +/* Indicates presence of PQsendPipelineSync */ +#define LIBPQ_HAS_SEND_PIPELINE_SYNC 1 +/* Indicates presence of PQsocketPoll, PQgetCurrentTimeUSec */ +#define LIBPQ_HAS_SOCKET_POLL 1 + /* * Option flags for PQcopyResult */