Make "directory" setting work with extension_control_path
authorPeter Eisentraut <[email protected]>
Fri, 2 May 2025 14:25:40 +0000 (16:25 +0200)
committerPeter Eisentraut <[email protected]>
Fri, 2 May 2025 14:35:48 +0000 (16:35 +0200)
commit81eaaa2c41dd29b06edf8b234753debbd1a581d5
treedcaff46d93c9bce7ef21a16aec711957b0f9c91e
parenta724c7889f74cc4e76e1979f90808decbc744c79
Make "directory" setting work with extension_control_path

The extension_control_path setting (commit 4f7f7b03758) did not
support extensions that set a custom "directory" setting in their
control file.  Very few extensions use that and during the discussion
on the previous commit it was suggested to maybe remove that
functionality.  But a fix was easier than initially thought, so this
just adds that support.  The fix is to use the control->control_dir as
a share dir to return the path of the extension script files.

To make this work more sensibly overall, the directory suffix
"extension" is no longer to be included in the extension_control_path
value.  To quote the patch, it would be

-extension_control_path = '/usr/local/share/postgresql/extension:/home/my_project/share/extension:$system'
+extension_control_path = '/usr/local/share/postgresql:/home/my_project/share:$system'

During the initial patch, there was some discussion on which of these
two approaches would be better, and the committed patch was a 50/50
decision.  But the support for the "directory" setting pushed it the
other way, and also it seems like many people didn't like the previous
behavior much.

Author: Matheus Alcantara <[email protected]>
Reviewed-by: Christoph Berg <[email protected]>
Reviewed-by: David E. Wheeler <[email protected]>
Discussion: https://www.postgresql.org/message-id/flat/aAi1VACxhjMhjFnb%40msg.df7cb.de#0cdf7b7d727cc593b029650daa3c4fbc
doc/src/sgml/config.sgml
doc/src/sgml/extend.sgml
src/backend/commands/extension.c
src/test/modules/test_extensions/t/001_extension_control_path.pl