Re: Add version macro to libpq-fe.h

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

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Thu, Jun 17, 2021 at 9:34 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2021-06-17 17:41:51 Re: [Proposal] Fully WAL logged CREATE DATABASE - No Checkpoints
Previous Message Tom Lane 2021-06-17 17:03:29 Re: Centralizing protective copying of utility statements