Re: Add version macro to libpq-fe.h

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

On 2021-Jun-18, Boris Kolpackov wrote:

> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> writes:
>
> > 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.
>
> That would be even better, but I agree with what others have
> said: we would have to keep adding such feature test macros
> going forward.

But we do not add that many significant features to libpq in the first
place, so I'm not sure it would be too bad. As far as I am aware, this
is the first time someone has requested a mechanism to detect feature
presence specifically in libpq.

To put a number to it, I counted the number of commits to exports.txt
since Jan 2015 -- there are 17. But many of them are just intra-release
fixups; the number of actual "features" is 11, an average of two per
year. That seems small enough to me.

So I'm +1 on adding this "feature macro".

(The so-version major changed from 4 to 5 in commit 1e7bb2da573e, dated
April 2006.)

> I think ideally you would want to have both since the version
> macro could still be helpful in dealing with "features" that you
> did not plan to add (aka bugs).
>
>
> > Comparing v13 and v14 libpq-fe.h, I see that there is a solution
> > available now: "#ifdef PQ_QUERY_PARAM_MAX_LIMIT".
>
> Hm, it must have been added recently since I don't see it in 14beta1.
> But thanks for the pointer, if nothing better comes up this will
> have to do.

Yeah, this one was added by commit cb92703384e2 on June 8th, three weeks
after beta1.

--
Álvaro Herrera Valdivia, Chile
"Pido que me den el Nobel por razones humanitarias" (Nicanor Parra)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Julien Rouhaud 2021-06-18 15:15:45 Re: Centralizing protective copying of utility statements
Previous Message Tom Lane 2021-06-18 14:24:20 Re: Centralizing protective copying of utility statements