Skip to content

Commit 79c3012

Browse files
committed
Provide feature-test macros for libpq features added in v17.
As per the policy established in commit 6991e77, 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
1 parent 6b1f78d commit 79c3012

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/interfaces/libpq/libpq-fe.h

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,32 @@ extern "C"
3030

3131
/*
3232
* These symbols may be used in compile-time #ifdef tests for the availability
33-
* of newer libpq features.
33+
* of v14-and-newer libpq features.
3434
*/
35+
/* Features added in PostgreSQL v14: */
3536
/* Indicates presence of PQenterPipelineMode and friends */
3637
#define LIBPQ_HAS_PIPELINING 1
3738
/* Indicates presence of PQsetTraceFlags; also new PQtrace output format */
3839
#define LIBPQ_HAS_TRACE_FLAGS 1
40+
41+
/* Features added in PostgreSQL v15: */
3942
/* Indicates that PQsslAttribute(NULL, "library") is useful */
4043
#define LIBPQ_HAS_SSL_LIBRARY_DETECTION 1
4144

45+
/* Features added in PostgreSQL v17: */
46+
/* Indicates presence of PGcancelConn typedef and associated routines */
47+
#define LIBPQ_HAS_ASYNC_CANCEL 1
48+
/* Indicates presence of PQchangePassword */
49+
#define LIBPQ_HAS_CHANGE_PASSWORD 1
50+
/* Indicates presence of PQsetChunkedRowsMode, PGRES_TUPLES_CHUNK */
51+
#define LIBPQ_HAS_CHUNK_MODE 1
52+
/* Indicates presence of PQclosePrepared, PQclosePortal, etc */
53+
#define LIBPQ_HAS_CLOSE_PREPARED 1
54+
/* Indicates presence of PQsendPipelineSync */
55+
#define LIBPQ_HAS_SEND_PIPELINE_SYNC 1
56+
/* Indicates presence of PQsocketPoll, PQgetCurrentTimeUSec */
57+
#define LIBPQ_HAS_SOCKET_POLL 1
58+
4259
/*
4360
* Option flags for PQcopyResult
4461
*/

0 commit comments

Comments
 (0)