Re: Add version macro to libpq-fe.h

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Boris Kolpackov <boris(at)codesynthesis(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org, alvaro(dot)herrera(at)2ndquadrant(dot)com
Subject: Re: Add version macro to libpq-fe.h
Date: 2021-06-17 13:34:09
Message-ID: 968815.1623936849@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Boris Kolpackov <boris(at)codesynthesis(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2021-06-17 13:34:14 Re: locking [user] catalog tables vs 2pc vs logical rep
Previous Message Mark Dilger 2021-06-17 13:19:58 Re: Fix for segfault in logical replication on master