Re: Question and suggestion about application binary compatibility policy - Mailing list pgsql-hackers

From Bruce Momjian
Subject Re: Question and suggestion about application binary compatibility policy
Date
Msg-id 20160622163953.GA6097@momjian.us
Whole thread Raw
In response to Question and suggestion about application binary compatibility policy  ("Tsunakawa, Takayuki" <tsunakawa.takay@jp.fujitsu.com>)
Responses Re: Question and suggestion about application binary compatibility policy
List pgsql-hackers
On Mon, May 30, 2016 at 03:04:24AM +0000, Tsunakawa, Takayuki wrote:
> Hello,
> 
> I'd like to ask you about the policy of application binary compatibility.  And have a suggestion as well.
> 
> QUESTION
> ==================================================
> 
> My customer asked me if the following usage is correct.
> 
> - Build an embedded SQL C application with PostgreSQL 9.2.
> - Distribute the app without ecpg nor libpq libraries.  Require users to install PostgreSQL client which includes
ecpgand libpq libraries.
 
> - Use the app with newer PostgreSQL major versions without rebuilding the app.  That is, the users just replaces the
PostgreSQLclient.
 
> 
> I expect this is legal, because the so_major versions of ecpg and libpq are 6 and 5 respectively for all PostgreSQL
9.xversions so far.  However, I could not find any description of this binary compatibility policy in the manual, so I
haven'tbeen able to answer the customer.
 
> 
> What's the official policy of application binary compatibility?  I found the same discussion in the below thread, but
I'mafraid any clear answer wasn't given:
 
> 
> https://www.postgresql.org/message-id/522F0B6B.1040006@4js.com
> 
> 
> SUGGESTION
> ==================================================
> 
> How about adding an article about application binary compatibility in the following section, as well as chapters for
libpq,ECPG, etc?
 
> 
> 17.6. Upgrading a PostgreSQL Clust
> https://www.postgresql.org/docs/devel/static/upgrading.html
> 
> There are three kinds of application assets that users are concerned about when upgrading.  Are there anything else
tomention?
 
> 
> * libpq app
> * ECPG app
> * C-language user defined function (and other stuff dependent on it, such as extensions, UDTs, etc.)

I know this thread is old but it bounced around a lot of ideas.  I think
there are some open questions:

*  Will a new application link against an older minor-version libpq?
*  Will an old application link against a newer minor-version libpq?

I think we are all in agreement that a binary cannot run using a libpq
with a different major version number.

We have this text in src/tools/RELEASE_CHANGES:
Major Version=============The major version number should be updated whenever the source of thelibrary changes to make
itbinary incompatible. Such changes include,but are not limited to:1. Removing a public function or structure (or
typedef,enum, ...)2. Modifying a public functions arguments.3. Removing a field from a public structure.4. Adding a
fieldto a public structure, unless steps have beenpreviously taken to shield users from such a change, for example
bysuchstructures only ever being allocated/instantiated by a libraryfunction which would give the new field a suitable
defaultvalue.Adding a new function should NOT force an increase in the major versionnumber. (Packagers will see the
standardminor number update and installthe new library.)  When the major version is increased all applicationswhich
linkto the library MUST be recompiled - this is not desirable. Whenthe major version is updated the minor version gets
reset.MinorVersion=============The minor version number should be updated whenever the functionality ofthe library has
changed,typically a change in source code between releaseswould mean an increase in the minor version number so long as
itdoes notrequire a major version increase.Given that we make at least minor changes to our libraries in every
majorPostgreSQLversion, we always bump all minor library version numbers at thestart of each development cycle as a
matterof policy.
 

This is saying running against a mismatched minor version should be fine
for a binary.

ecpg is a little tricker because it has knowledge of SQL data types and
might not support certain features if the ecpg library isn't _run_
against the same major server version.  My guess is that older ecpg
libraries will run fine against newer servers, but the opposite might
not be true.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+                     Ancient Roman grave inscription +



pgsql-hackers by date:

Previous
From: alain radix
Date:
Subject: Re: Requesting external_pid_file with postgres -C when not initialized lead to coredump
Next
From: Tom Lane
Date:
Subject: Re: Parallelized polymorphic aggs, and aggtype vs aggoutputtype