Re: RFC: Additional Directory for Extensions - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: RFC: Additional Directory for Extensions
Date
Msg-id 04235387-120e-4bf6-b5c8-645d869222b9@eisentraut.org
Whole thread Raw
In response to Re: RFC: Additional Directory for Extensions  ("David E. Wheeler" <david@justatheory.com>)
Responses Re: RFC: Additional Directory for Extensions
List pgsql-hackers
On 11.11.24 19:15, David E. Wheeler wrote:
>> In fact, most of the patch is refactoring the routines in dfmgr.c to not hardcode dynamic_library_path but allow
searchingfor any file in any path.  Once a control file is found, the other extension support files (script files and
auxiliarycontrol files) are looked for in the same directory.
 
> 
> What about shared libraries files?

Nothing changes about shared library files.  They are looked up in 
dynamic_library_path or any hardcoded file name.

>> This works pretty much fine for the use cases that have been presented here, including installing extensions outside
ofthe core installation tree (for CNPG and Postgres.app) and for testing uninstalled extensions (for Debian).
 
> 
> If I understand correctly, shared modules still lie in dynamic_library_path, yes? That makes things a bit more
complicated,as the CNPG use case has to set up multiple persistent volumes to persist files put into various
directories,notably sharedir and pkglibdir.
 

No, you can also install them into a common directory and mount that 
one.  For example, you install the extension at build time into 
/tmp/foo/{lib,share/extension}, you package that up as a disk image, 
mount it at /opt/extensions/myext, and then you can point 
extension_control_path at /opt/extensions/myext/lib and 
dynamic_library_path at /opt/extensions/myext/share/extension.

>> - The biggest problem is that many extensions set in their control file
>>
>>     module_pathname = '$libdir/foo'
>>
>> This disables the use of dynamic_library_path, so this whole idea of installing an extension elsewhere won't work
thatway.  The obvious solution is that extensions change this to just 'foo'.  But this will require a lot updating work
formany extensions, or a lot of patching by packagers.
 
> 
> Since that’s set at build/install time, couldn’t the definition of `$libdir` here be changed to mean “the directory
intowhich it’s being installed right now?”. Doesn’t seem necessary to search a path if the specific location is set at
installtime.
 

No, this is not set at build or install time.  This is for typical 
extensions hardcoded, and $libdir is resolved by the PostgreSQL server 
at run time.

> Perhaps I misunderstand, but I would like to talk through the implications of a more radical rethinking of extension
filelocation along the lines of the other thread[2] and the RFC I’m working up based on them both[1], especially since
thereare a few other use cases that inform it.
 

I'm aware of that thread, but I think that is looking like a much larger 
project than what I'm proposing here.




pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: logical replication: restart_lsn can go backwards (and more), seems broken since 9.4
Next
From: Alvaro Herrera
Date:
Subject: Re: Disallow UPDATE/DELETE on table with unpublished generated column as REPLICA IDENTITY