Re: Add version macro to libpq-fe.h - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Add version macro to libpq-fe.h
Date
Msg-id 968815.1623936849@sss.pgh.pa.us
Whole thread Raw
In response to Add version macro to libpq-fe.h  (Boris Kolpackov <boris@codesynthesis.com>)
Responses Re: Add version macro to libpq-fe.h  (Robert Haas <robertmhaas@gmail.com>)
Re: Add version macro to libpq-fe.h  (Boris Kolpackov <boris@codesynthesis.com>)
List pgsql-hackers
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



pgsql-hackers by date:

Previous
From: Mark Dilger
Date:
Subject: Re: Fix for segfault in logical replication on master
Next
From: Simon Riggs
Date:
Subject: Re: locking [user] catalog tables vs 2pc vs logical rep