Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 46E471337B68 for ; Thu, 16 Dec 2010 12:08:06 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 35050-04 for ; Thu, 16 Dec 2010 16:07:59 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by mail.postgresql.org (Postfix) with ESMTP id E098F1337B4A for ; Thu, 16 Dec 2010 12:07:58 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id oBGG7u69022011; Thu, 16 Dec 2010 11:07:57 -0500 (EST) To: Magnus Hagander cc: "Massa, Harald Armin" , PostgreSQL-development Subject: Re: [GENERAL] queriing the version of libpq In-reply-to: References: Comments: In-reply-to Magnus Hagander message dated "Thu, 16 Dec 2010 16:56:32 +0100" Date: Thu, 16 Dec 2010 11:07:56 -0500 Message-ID: <22010.1292515676@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-5 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201012/1443 X-Sequence-Number: 176705 Magnus Hagander writes: > But it does outline that fact that it wouldn't suck to have a >function  in libpq returning the version so that application can >check this at  runtime - clearly it would also be useful when >being linked "through" something like psycopg2. > Stuck in a local git branch. I've rebased on current and added docs, > see attachment. Ick. Please get rid of that extra version number. There is no reason not to use PG_VERSION_NUM. The documentation needs further thought too: grammar needs work, and the format of the result value is unspecified. But perhaps we should first recheck the premise. Exactly how will this function be useful? I don't believe it's usable in the form implied by the documentation, namely if (PQlibVersion() >= something) ... call PQspiffyNewFunction() ... else ... do something else ... because if you're trying to link against an older libpq, the link will fail before you ever get to execute. So let's have a less implausible use-case please. regards, tom lane