Re: Is a UDF binary portable across different minor releases and PostgreSQL distributions? - Mailing list pgsql-hackers

From Tsunakawa, Takayuki
Subject Re: Is a UDF binary portable across different minor releases and PostgreSQL distributions?
Date
Msg-id 0A3221C70F24FB45833433255569204D1F59C8AA@G01JPEXMBYT05
Whole thread Raw
In response to Re: Is a UDF binary portable across different minor releases and PostgreSQL distributions?  (Michael Paquier <michael.paquier@gmail.com>)
Responses Re: Is a UDF binary portable across different minor releases and PostgreSQL distributions?  (Michael Paquier <michael.paquier@gmail.com>)
Re: Is a UDF binary portable across different minor releases and PostgreSQL distributions?  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
> 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


pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: _mdfd_getseg can be expensive
Next
From: Michael Paquier
Date:
Subject: Re: Is a UDF binary portable across different minor releases and PostgreSQL distributions?