Boris Kolpackov <boris@codesynthesis.com> writes:
> I am making use of the new pipeline mode added to libpq in
> PostgreSQL 14. At the same time I would still like to support
> older libpq versions by not providing the extended functionality
> that depends on this mode.
Good point.
> The natural way to achieve this in C/C++ is to conditionally
> enable code that depends on the additional APIs based on the
> preprocessor macro. And I could easily do this if libpq-fe.h
> provided a macro containing its version.
I think putting a version number as such in there is a truly
horrid idea. However, I could get behind adding a boolean flag
that says specifically whether the pipeline feature exists.
Then you'd do something like
#ifdef LIBPQ_HAS_PIPELINING
rather than embedding knowledge of exactly which release
added that.
regards, tom lane