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 searching for any file in any path.
Once a control file is found, the other extension support files (script files
and auxiliary control 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 of the 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 that way. The obvious solution is that
extensions change this to just 'foo'. But this will require a lot updating
work for many 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 into which it’s being installed right
now?”. Doesn’t seem necessary to search a path if the specific location is set
at install time.
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 file location along the lines of the other
thread[2] and the RFC I’m working up based on them both[1], especially since
there are 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.