agora inbox for pgsql-interfaces@postgresql.org  
help / color / mirror / Atom feed
From: Sebastien FLAESCH <sf@4js.com>
To: pgsql-interfaces@postgresql.org
Subject: libpq compatibility policy across versions
Date: Tue, 10 Sep 2013 14:07:07 +0200
Message-ID: <522F0B6B.1040006@4js.com> (raw)
List-Unsubscribe:  <mailto:majordomo@postgresql.org?body=unsub%20pgsql-interfaces>

Hi all,

We have a libpq client application written in C.

We want to deliver the software so that can it be used with different
PostgreSQL client versions, from 8.3 to 9.3 (and future versions).

So far, we build (compile and link) a binary with each major version
of PostgreSQL (8.3, 8.4, 9.0, 9.1, 9.2, 9.3) - in fact we have shared
libraries (database driver) for each PostgreSQL version.

Is this the proper way, or could we just compile/link with a given
version (9.3) and assume that it's backward compatible with any
prior version such as 8.3 ?

Assuming that we could dynamically load the libpq.so client, search
for existing API symbols and only use them if present?

Is this risky? Do the C headers define C structures that are compatible
between newer and older versions?

I would expect some note about libpq compatibility policy here:

http://www.postgresql.org/docs/9.3/static/libpq-build.html

I can see that the lib version number of libpq.so.x.y changes
for each major version:

/opt3/dbs/pgs/9.2/lib/libpq.so -> libpq.so.5.5
/opt3/dbs/pgs/9.2/lib/libpq.so.5 -> libpq.so.5.5
/opt3/dbs/pgs/9.2/lib/libpq.so.5.5
/opt3/dbs/pgs/9.3.0/lib/libpq.so -> libpq.so.5.6
/opt3/dbs/pgs/9.3.0/lib/libpq.so.5 -> libpq.so.5.6
/opt3/dbs/pgs/9.3.0/lib/libpq.so.5.6

The binaries are dependent from libpq.so.5:

$ ldd -r dbmpgs92x.so
	...
	libpq.so.5 => /opt3/dbs/pgs/9.2.3/lib/libpq.so.5 (0xb77bb000)
	...

What does this mean?

Theoritically, a binary linked in a 9.3 env can use le libpq.so version
of a prior version down to 8.2 ... (8.1 has libpq.so.4)

The main question is about C header compatibility:

- Compile + link with PostgreSQL client version X.Y.?
- What PostgreSQL client version can be used at runtime?

Thanks.
Seb


-- 
Sent via pgsql-interfaces mailing list (pgsql-interfaces@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-interfaces



view thread (8+ messages)  latest in thread

Message-ID: <522F0B6B.1040006@4js.com>
Permalink:  ../522F0B6B.1040006@4js.com/
Also on:    postgresql.org/message-id/522F0B6B.1040006@4js.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: sf@4js.com
  Subject: Re: libpq compatibility policy across versions
  In-Reply-To: <522F0B6B.1040006@4js.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox