Skip site navigation (1) Skip section navigation (2)

Re: Details about libpq cross-version compatibility

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Sebastien FLAESCH <sf(at)4js(dot)com>
Cc: pgsql-docs(at)postgresql(dot)org
Subject: Re: Details about libpq cross-version compatibility
Date: 2012-09-13 07:01:10
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-docs
On 12.09.2012 18:21, Sebastien FLAESCH wrote:
> I believe there is some info missing in the page describing libpq
> programs build:
> I am working with PostgreSQL for several years now (since V7),
> maintaining a set
> of "db drivers" for our system, that can be used with the different
> PostgreSQL
> versions.
> We need to build our binaries for different versions of PostgreSQL,
> today it's
> from 8.3 to 9.2 ...
> What is the compatibility rule regarding this?
> Can I compile / link with a PostgreSQL 9.1 environment and deploy on 9.2
> ???
> Can I compile / link with a PostgreSQL 8.x environment and deploy on 9.x
> ???

If your binary is just a client application that uses libpq to speak to 
the server, you can use any (supported) version of libpq with any 
(supported) server version. There hasn't been any incompatible protocol 
changes since version 7.4, which introduced the protocol version 3, and 
even that was done in a backwards-compatible fashion so that even 9.2 
server still supports the old version 2 of the protocol.

Now, another question is what happens if you compile your binaries 
against e.g 9.1 version of libpq, but at runtime, you have 9.2 libpq 
installed. I think that should work too, but not vice versa, if you use 
any new functions from the 9.2 libpq library. In general, you should 
have the same or higher version of libpq at runtime that the binaries 
were built with.

The version number bump from 8.x to 9.0 was made because 9.0 introduced 
many new features, but from a compatibility policy point-of-view, 8.4 -> 
9.0 is no different than, say, going from 8.3 to 8.4.

> The problem is that we have to ship several versions of the drivers for all
> the PostgreSQL versions that are in the support live cycle, today this is
> from 8.3 to 9.2 ...

That really shouldn't be necessary.

> So far, we followed the version policy as described here:
> I think it's ok to follow this rule, but would feel much better if it was
> clearly stated in the "Building libpq Programs" page.

Agreed. Either that page, or the libpq top page at, or a new 
"cross-version compatibility" section under that. Could you write up a 
few paragraphs for the manual please? That would be much appreciated, 
you'd be in a good position to do that since you're facing the problem 
right now.

- Heikki

In response to


pgsql-docs by date

Next:From: Sebastien FLAESCHDate: 2012-09-13 07:46:15
Subject: Re: Details about libpq cross-version compatibility
Previous:From: Sebastien FLAESCHDate: 2012-09-12 15:21:15
Subject: Details about libpq cross-version compatibility

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group