pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Boris Kolpackov <boris@codesynthesis.com>
Cc: pgsql-hackers@lists.postgresql.org
Cc: alvaro.herrera@2ndquadrant.com
Subject: Re: Add version macro to libpq-fe.h
Date: Fri, 18 Jun 2021 10:12:34 -0400
Message-ID: <1100325.1624025554@sss.pgh.pa.us> (raw)
In-Reply-To: <boris.20210618154240@codesynthesis.com>
References: <boris.20210617102439@codesynthesis.com>
	<968815.1623936849@sss.pgh.pa.us>
	<boris.20210618154240@codesynthesis.com>

Boris Kolpackov <boris@codesynthesis.com> writes:
> Tom Lane <tgl@sss.pgh.pa.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.

> 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.

Yes, and I think that is a superior solution.  I think the
argument that it's too much effort is basically nonsense.

> 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).

I really doubt that a version number appearing in libpq-fe.h would
be helpful for deciding whether you need to work around a bug.
The problem again is version skew: how well does the libpq.so you
are running against today match up with the header you compiled
against (possibly months ago, possibly on a different machine)?
What you'd want for that sort of thing is a runtime test, i.e.
consult PQlibVersion().

That point, along with the previously-discussed point about confusion
between server and libpq versions, nicely illustrates another reason
why I'm resistant to just adding a version number to libpq-fe.h.
If we do that, application programmers will be presented with THREE
different Postgres version numbers, and it seems inevitable that
people will make mistakes and consult the wrong one for a particular
purpose.  I think we can at least reduce the confusion by handling
the question of which-features-are-visible-in-the-include-file in a
different style.

			regards, tom lane





view thread (26+ messages)  latest in thread

Message-ID: <1100325.1624025554@sss.pgh.pa.us>
Permalink:  ../1100325.1624025554@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/1100325.1624025554@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, boris@codesynthesis.com, alvaro.herrera@2ndquadrant.com
  Subject: Re: Add version macro to libpq-fe.h
  In-Reply-To: <1100325.1624025554@sss.pgh.pa.us>
  References: <boris.20210617102439@codesynthesis.com> <968815.1623936849@sss.pgh.pa.us> <boris.20210618154240@codesynthesis.com> <1100325.1624025554@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox