Thread: libpq backwards compatbility

libpq backwards compatbility

From
Andy Halsall
Date:

We have a libpq application written in C++. There are existing running deployments of our application that were compiled against PostgreSQL version 9.3.


We want to move to PostgreSQL version 9.6.


Can we assume that the 9.6 libpq library is backwards compatible with applications compiled against 9.3 headers? I wouldn't expect to have to re-compile our application against 9.6 libpq headers and redeploy because we're not taking advantage of any new features and nothing seems to have been deprecated.


The release notes talk about additions to libpq in section E.2.3.9 "Client Interfaces". I'd expect any un-changed features to be backwards compatible. Limited testing suggests this is so but I can't find a clear statement.


Could somebody please advise?

Thanks

Andy


Re: libpq backwards compatbility

From
Michael Paquier
Date:
On Wed, Nov 2, 2016 at 11:58 PM, Andy Halsall <andyh@live.co.uk> wrote:
> Can we assume that the 9.6 libpq library is backwards compatible with
> applications compiled against 9.3 headers? I wouldn't expect to have to
> re-compile our application against 9.6 libpq headers and redeploy because
> we're not taking advantage of any new features and nothing seems to have
> been deprecated.
>
> The release notes talk about additions to libpq in section E.2.3.9 "Client
> Interfaces". I'd expect any un-changed features to be backwards compatible.
> Limited testing suggests this is so but I can't find a clear statement.
>
> Could somebody please advise?

libpq has a long history of keeping a backward-compatible interface
across the ages, and that pays in the long term. Your application
compiled with 9.3 headers would link to libpq.so.5, so that would be
binary-compatible with 9.6. For consistency's sake, you may want to
recompile it anyway.
--
Michael


Re: libpq backwards compatbility

From
Andy Halsall
Date:

Thanks for the response. I have to also ask about  binary compatibility in the other direction. I.e. An application compiled against 9.6 libpq headers but running against the 9.3 libpq library. Obviously you'd never choose to deploy this way in general, but we're not using any new libpq features and so I guess the question is whether or not existing libpq library features are forwards compatible with later compilations? 


While this is far from ideal, we want the next release of our application to be compiled against the target libpq version (9.6), however the PostgreSQL version on the deployment platforms isn't under our control. It could be 9.3 for a time before getting upgraded to 9.6.


Testing suggests that all's ok but, if we can't be sure, we'll have to either compile the next release of the application against 9.3 until we know all PostgreSQL platforms have been upgraded to 9.6. Or make it a dependency of the application release that the PostgreSQL platform is 9.6.


Andy


From: Michael Paquier <michael.paquier@gmail.com>
Sent: 03 November 2016 09:35
To: Andy Halsall
Cc: pgsql-general@postgresql.org
Subject: Re: [GENERAL] libpq backwards compatbility
 
On Wed, Nov 2, 2016 at 11:58 PM, Andy Halsall <andyh@live.co.uk> wrote:
> Can we assume that the 9.6 libpq library is backwards compatible with
> applications compiled against 9.3 headers? I wouldn't expect to have to
> re-compile our application against 9.6 libpq headers and redeploy because
> we're not taking advantage of any new features and nothing seems to have
> been deprecated.
>
> The release notes talk about additions to libpq in section E.2.3.9 "Client
> Interfaces". I'd expect any un-changed features to be backwards compatible.
> Limited testing suggests this is so but I can't find a clear statement.
>
> Could somebody please advise?

libpq has a long history of keeping a backward-compatible interface
across the ages, and that pays in the long term. Your application
compiled with 9.3 headers would link to libpq.so.5, so that would be
binary-compatible with 9.6. For consistency's sake, you may want to
recompile it anyway.
--
Michael