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 1026744.1623950177@sss.pgh.pa.us
Whole thread Raw
In response to Re: Add version macro to libpq-fe.h  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Add version macro to libpq-fe.h
Re: Add version macro to libpq-fe.h
Re: Add version macro to libpq-fe.h
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Thu, Jun 17, 2021 at 9:34 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> 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.

> I realize that this kind of feature-based testing is generally
> considered a best practice, but the problem is we're unlikely to do it
> consistently. If we put a version number in there, people will be able
> to test for whatever they want.

We don't really add major new APIs to libpq very often, so I don't
find that too compelling.  I do find it compelling that user code
shouldn't embed knowledge about "feature X arrived in version Y".

> Then again, why would pg_config.h be absent?

Likely because somebody decided it was a server-side include rather
than an application-side include.

A more critical point is that if pg_config is present, it'll likely
contain the server version, which might not have a lot to do with the
libpq version.  Debian's already shipping things in a way that decouples
those, and I gather Red Hat is moving in that direction too.

I think what people really want to know is "if I try to call
PQenterPipelineMode, will that compile?".  Comparing v13 and v14
libpq-fe.h, I see that there is a solution available now:
"#ifdef PQ_QUERY_PARAM_MAX_LIMIT".  But depending on that seems
like a bit of a hack, because I'm not sure that it's directly tied
to the pipelining feature.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Centralizing protective copying of utility statements
Next
From: Robert Haas
Date:
Subject: Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints