Is a UDF binary portable across different minor releases and PostgreSQL distributions?

From: "Tsunakawa, Takayuki" <tsunakawa(dot)takay(at)jp(dot)fujitsu(dot)com>
To: "'pgsql-hackers(at)postgresql(dot)org'" <pgsql-hackers(at)postgresql(dot)org>
Subject: Is a UDF binary portable across different minor releases and PostgreSQL distributions?
Date: 2016-07-01 00:33:11
Message-ID: 0A3221C70F24FB45833433255569204D1F59C7E4@G01JPEXMBYT05
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

While I was thinking of application binary compatibility between PostgreSQL releases, some questions arose about C language user-defined functions (UDFs) and extensions that depend on them.

[Q1]
Can the same UDF binary be used with different PostgreSQL minor releases? If it is, is it a defined policy (e.g. written somewhere in the manual, wiki, documentation in the source code)?

For example, suppose you build a UDF X (some_extension.so/dll) with PostgreSQL 9.5.0. Can I use the binary with PostgreSQL 9.5.x without rebuilding?

Here, the UDF references the contents of server-side data structures, like pgstattuple accesses the members of HeapScanData. If some bug fix of PostgreSQL changes the member layout of those structures, the UDF binary would possibly misbehave. Basically, should all UDFs be rebuilt with the new minor release? Or, are PostgreSQL developers aware of such incompatibility and careful not to change data structure layout?

[Q2]
Can the same UDF binary be used with different PostgreSQL distributions (EnterpriseDB, OpenSCG, RHEL packages, etc.)? Or should the UDF be built with the target distribution?

I guess the rebuild is necessary if the distribution modified the source code of PostgreSQL. That is, the UDF binary built with the bare PostgreSQL cannot be used with EnterpriseDB's advanced edition, which may modify various data structures.

How about other distributions which probably don't modify the source code? Should the UDF be built with the target PostgreSQL because configure options may differ, which affects data structures?

Regards
Takayuki Tsunakawa

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-07-01 00:46:48 Re: primary_conninfo missing from pg_stat_wal_receiver
Previous Message Andreas Karlsson 2016-07-01 00:27:03 Re: OpenSSL 1.1 breaks configure and more