Re: Proposal: Document ABI Compatibility - Mailing list pgsql-hackers

From Andres Freund
Subject Re: Proposal: Document ABI Compatibility
Date
Msg-id 20240612152032.h4ftxxjvpmxf2t6j@awork3.anarazel.de
Whole thread Raw
In response to Re: Proposal: Document ABI Compatibility  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: Proposal: Document ABI Compatibility
List pgsql-hackers
On 2024-06-11 10:55:38 -0400, David E. Wheeler wrote:
> ABI Policy
> ==========
> 
> The PostgreSQL core team maintains two application binary interface (ABI) guarantees: one for major releases and one
forminor releases.
 

I.e. for major versions it's "there is none"?

> Major Releases
> --------------
> 
> Applications that use the PostgreSQL APIs must be compiled for each major release supported by the application. The
inclusionof `PG_MODULE_MAGIC` ensures that code compiled for one major version will rejected by other major versions.
 
> 
> Furthermore, new releases may make API changes that require code changes. Use the `PG_VERSION_NUM` constant to adjust
codein a backwards compatible way:
 
> 
> ``` c
> #if PG_VERSION_NUM >= 160000
> #include "varatt.h"
> #endif
> ```
> 
> PostgreSQL avoids unnecessary API changes in major releases, but usually
> ships a few necessary API changes, including deprecation, renaming, and
> argument variation.


> In such cases the incompatible changes will be listed in the Release Notes.

I don't think we actually exhaustively list all of them.


> Minor Releases
> --------------
> 
> PostgreSQL makes every effort to avoid both API and ABI breaks in minor releases. In general, an application compiled
againstany minor release will work with any other minor release, past or future.
 

s/every/a reasonable/ or just s/every/an/


> When a change *is* required, PostgreSQL will choose the least invasive way
> possible, for example by squeezing a new field into padding space or
> appending it to the end of a struct. This sort of change should not impact
> dependent applications unless they use `sizeof(the struct)` or create their
> own instances of such structs --- patterns best avoided.

The padding case doesn't affect sizeof() fwiw.

I think there's too often not an alternative to using sizeof(), potentially
indirectly (via makeNode() or such. So this sounds a bit too general.

Greetings,

Andres Freund



pgsql-hackers by date:

Previous
From: Imran Zaheer
Date:
Subject: Re: Windows: openssl & gssapi dislike each other
Next
From: Andres Freund
Date:
Subject: Re: Proposal: Document ABI Compatibility