Re: Proposal: Document ABI Compatibility

From: Andres Freund <andres(at)anarazel(dot)de>
To: "David E(dot) Wheeler" <david(at)justatheory(dot)com>
Cc: Peter Eisentraut <peter(at)eisentraut(dot)org>, Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Proposal: Document ABI Compatibility
Date: 2024-06-12 15:20:32
Message-ID: 20240612152032.h4ftxxjvpmxf2t6j@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 for minor 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 inclusion of `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 code in 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 against any 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-06-12 15:22:48 Re: Proposal: Document ABI Compatibility
Previous Message Imran Zaheer 2024-06-12 15:12:51 Re: Windows: openssl & gssapi dislike each other