Re: Add version macro to libpq-fe.h

Alvaro Herrera <alvaro.herrera@2ndquadrant.com>

From: Alvaro Herrera <alvaro.herrera@2ndquadrant.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Boris Kolpackov <boris@codesynthesis.com>, pgsql-hackers@lists.postgresql.org
Date: 2021-06-18T18:03:41Z
Lists: pgsql-hackers
On 2021-Jun-18, Tom Lane wrote:

> Alvaro Herrera <alvaro.herrera@2ndquadrant.com> writes:
> > So I'm +1 on adding this "feature macro".
> 
> Concretely, how about the attached?

Seems OK to me.  We can just accumulate any similar ones in the future
nearby.

> (I also got rid of a recently-added
> extra comma.  While the compilers we use might not warn about that,
> it seems unwise to assume that no user's compiler will.)

Oops.

> I guess one unresolved question is whether we want to mention these in
> the SGML docs.  I vote "no", because it'll raise the maintenance cost
> noticeably.  But I can see an argument on the other side.

Well, if we do want docs for these macros, then IMO it'd be okay to have
them in libpq-fe.h itself rather than SGML.  A one-line comment for each
would suffice:

+/*
+ * These symbols may be used in compile-time #ifdef tests for the availability
+ * of newer libpq features.
+ */
+/* Indicates presence of PQenterPipelineMode and friends */
+#define LIBPQ_HAS_PIPELINING 1
+
+/* Indicates presence of PQsetTraceFlags; PQtrace changed output format */
+#define LIBPQ_HAS_TRACE_FLAGS 1

-- 
Álvaro Herrera                            39°49'30"S 73°17'W



Commits

  1. Provide feature-test macros for libpq features added in v14.

  2. Adjust batch size in postgres_fdw to not use too many parameters

  3. Arrange to strip libpq.so of symbols that aren't officially supposed to