Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltvcz-0003nA-FT for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jun 2021 17:16:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltvcy-0007tU-9H for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jun 2021 17:16:28 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltvcy-0007tM-1k for pgsql-hackers@lists.postgresql.org; Thu, 17 Jun 2021 17:16:28 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltvcr-00056G-U3 for pgsql-hackers@lists.postgresql.org; Thu, 17 Jun 2021 17:16:27 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 15HHGHTr1026745; Thu, 17 Jun 2021 13:16:17 -0400 From: Tom Lane To: Robert Haas cc: Boris Kolpackov , PostgreSQL Hackers , =?UTF-8?Q?=C3=81lvaro_Herrera?= Subject: Re: Add version macro to libpq-fe.h In-reply-to: References: <968815.1623936849@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Thu, 17 Jun 2021 12:56:58 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1026743.1623950177.1@sss.pgh.pa.us> Date: Thu, 17 Jun 2021 13:16:17 -0400 Message-ID: <1026744.1623950177@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Robert Haas writes: > On Thu, Jun 17, 2021 at 9:34 AM Tom Lane 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