Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VQzao-0004ps-Eo for pgsql-interfaces@arkaria.postgresql.org; Tue, 01 Oct 2013 13:02:22 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VQzan-0006mm-VM for pgsql-interfaces@arkaria.postgresql.org; Tue, 01 Oct 2013 13:02:22 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VQzan-0006mg-6E for pgsql-interfaces@postgresql.org; Tue, 01 Oct 2013 13:02:21 +0000 Received: from mail231.strasbourg.4js.com ([92.103.31.231]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VQzaf-000158-FT for pgsql-interfaces@postgresql.org; Tue, 01 Oct 2013 13:02:20 +0000 Received: from [10.0.0.204] (orca.strasbourg.4js.com [10.0.0.204]) (authenticated bits=0) by mail231.strasbourg.4js.com (8.14.4/8.14.4/Debian-4) with ESMTP id r91D2BO5007418 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NOT) for ; Tue, 1 Oct 2013 15:02:11 +0200 Message-ID: <524AC850.7000109@4js.com> Date: Tue, 01 Oct 2013 15:04:16 +0200 From: Sebastien FLAESCH Organization: Four Js Development Tools User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20111110 Lightning/1.0b1 Icedove/3.0.11 MIME-Version: 1.0 To: pgsql-interfaces@postgresql.org Subject: Re: libpq compatibility policy across versions References: <522F0B6B.1040006@4js.com> <113082781.20131001152820@gf.microolap.com> In-Reply-To: <113082781.20131001152820@gf.microolap.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.8 at mail231 X-Virus-Status: Clean X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail231.strasbourg.4js.com [10.10.0.1]); Tue, 01 Oct 2013 15:02:11 +0200 (CEST) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-interfaces Precedence: bulk Sender: pgsql-interfaces-owner@postgresql.org Thank you Pavel, On 10/01/2013 02:28 PM, Pavel Golub wrote: > Yes, you should use the latest client library. It's compatible with > all prior versions. Just to be clear: We deliver our product without any PostgreSQL lib included. Our product installs beside an existing PostgreSQL install, typically on an application server, where both PostgreSQL client and server are installed in the same directory. Imagine for ex a machine with PostgreSQL 8.3 installed. I am asking how I must compile my source code and how to link, to build my binary, to be sure that it's compatible with PostgreSQL 8.3, and any in fact any existing PostgreSQL versions. Can I for ex, use the V 9.3 headers and library on my dev platform and then deliver this binary for any PostgreSQL version? In other words, is the PostgreSQL client C API backward compatible? Today the lib is stamped with 5 (libpq.so.5), will this never change in future versions? Is there a way to detect dynamically the version of the PostgreSQL server? Thanks! Seb On 10/01/2013 02:28 PM, Pavel Golub wrote: > Hello, Sebastien. > > You wrote: > > SF> Hi all, > > SF> We have a libpq client application written in C. > > SF> We want to deliver the software so that can it be used with different > SF> PostgreSQL client versions, from 8.3 to 9.3 (and future versions). > > SF> So far, we build (compile and link) a binary with each major version > SF> of PostgreSQL (8.3, 8.4, 9.0, 9.1, 9.2, 9.3) - in fact we have shared > SF> libraries (database driver) for each PostgreSQL version. > > SF> Is this the proper way, or could we just compile/link with a given > SF> version (9.3) and assume that it's backward compatible with any > SF> prior version such as 8.3 ? > > Yes, you should use the latest client library. It's compatible with > all prior versions. > > SF> Assuming that we could dynamically load the libpq.so client, search > SF> for existing API symbols and only use them if present? > > SF> Is this risky? Do the C headers define C structures that are compatible > SF> between newer and older versions? > > SF> I would expect some note about libpq compatibility policy here: > > SF> http://www.postgresql.org/docs/9.3/static/libpq-build.html > > SF> I can see that the lib version number of libpq.so.x.y changes > SF> for each major version: > > SF> /opt3/dbs/pgs/9.2/lib/libpq.so -> libpq.so.5.5 > SF> /opt3/dbs/pgs/9.2/lib/libpq.so.5 -> libpq.so.5.5 > SF> /opt3/dbs/pgs/9.2/lib/libpq.so.5.5 > SF> /opt3/dbs/pgs/9.3.0/lib/libpq.so -> libpq.so.5.6 > SF> /opt3/dbs/pgs/9.3.0/lib/libpq.so.5 -> libpq.so.5.6 > SF> /opt3/dbs/pgs/9.3.0/lib/libpq.so.5.6 > > SF> The binaries are dependent from libpq.so.5: > > SF> $ ldd -r dbmpgs92x.so > SF> ... > SF> libpq.so.5 => /opt3/dbs/pgs/9.2.3/lib/libpq.so.5 (0xb77bb000) > SF> ... > > SF> What does this mean? > > SF> Theoritically, a binary linked in a 9.3 env can use le libpq.so version > SF> of a prior version down to 8.2 ... (8.1 has libpq.so.4) > > SF> The main question is about C header compatibility: > > SF> - Compile + link with PostgreSQL client version X.Y.? > SF> - What PostgreSQL client version can be used at runtime? > > SF> Thanks. > SF> Seb > > > > > -- Sent via pgsql-interfaces mailing list (pgsql-interfaces@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-interfaces