> From: pgsql-hackers-owner@postgresql.org
> [mailto:pgsql-hackers-owner@postgresql.org] On Behalf Of Michael Paquier
> On Fri, Jul 1, 2016 at 9:33 AM, Tsunakawa, Takayuki
> <tsunakawa.takay@jp.fujitsu.com> wrote:
> > [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?
>
> Yes, that works properly. There could be problems with potential changes
> in the backend APIs in a stable branch, but this usually does not happen
> much.
>
> > 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?
>
> Not necessarily.
>
> > Or, are PostgreSQL developers aware of such incompatibility and careful
> not to change data structure layout?
>
> Committers are aware and careful about that, that's why exposed APIs and
> structures are normally kept stable. At least that's what I see.
>
> > [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?
>
> Each distribution has usually its own compilation options (say page size,
> etc.) even if I recall that most of them use the defaults, so it clearly
> depends on what kind of things each of them uses. I would recommend a
> recompilation just to be safe. It may not be worth spending time at looking
> and checking each one's differences.
Thanks for sharing your experience, Michael.
I'd like to document the policy clearly in the upgrade section of PostgreSQL manual, eliminating any ambiguity, so that
userscan determine what they should do without fear like "may or may not work". Which of the following policies should
Ibase on?
Option 1:
Rebuild UDFs with the target PostgreSQL distribution and minor release.
Option 2:
Rebuild UDFs with the target PostgreSQL distribution.
You do not have to rebuild UDFs when you upgrade or downgrade the minor release. (If your UDF doesn't work after
changingthe minor release, it's the bug of PostgreSQL. You can report it to pgsql-bugs.)
Regards
Takayuki Tsunakawa