From 81eaaa2c41dd29b06edf8b234753debbd1a581d5 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Fri, 2 May 2025 16:25:40 +0200 Subject: 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 Reviewed-by: Christoph Berg Reviewed-by: David E. Wheeler Discussion: https://www.postgresql.org/message-id/flat/aAi1VACxhjMhjFnb%40msg.df7cb.de#0cdf7b7d727cc593b029650daa3c4fbc --- doc/src/sgml/config.sgml | 15 ++++++++------- doc/src/sgml/extend.sgml | 4 ++-- 2 files changed, 10 insertions(+), 9 deletions(-) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index fd6e3e02890..23d2b1be424 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -11030,16 +11030,17 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' (Use pg_config --sharedir to find out the name of this directory.) For example: -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' or, in a Windows environment: -extension_control_path = 'C:\tools\postgresql\extension;H:\my_project\share\extension;$system' +extension_control_path = 'C:\tools\postgresql;H:\my_project\share;$system' - Note that the path elements should typically end in - extension if the normal installation layouts are - followed. (The value for $system already includes - the extension suffix.) + Note that the specified paths elements are expected to have a + subdirectory extension which will contain the + .control and .sql files; the + extension suffix is automatically appended to + each path element. @@ -11064,7 +11065,7 @@ extension_control_path = 'C:\tools\postgresql\extension;H:\my_project\share\exte linkend="guc-dynamic-library-path"/> to a correspondent location, for example, -extension_control_path = '/usr/local/share/postgresql/extension:$system' +extension_control_path = '/usr/local/share/postgresql:$system' dynamic_library_path = '/usr/local/lib/postgresql:$libdir' diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml index 065bc49c973..63c5ec6d1eb 100644 --- a/doc/src/sgml/extend.sgml +++ b/doc/src/sgml/extend.sgml @@ -674,7 +674,7 @@ RETURNS anycompatible AS ... The directory containing the extension's SQL script file(s). Unless an absolute path is given, the name is relative to - the installation's SHAREDIR directory. By default, + the directory where the control file was found. By default, the script files are looked for in the same directory where the control file was found. @@ -1836,7 +1836,7 @@ make install prefix=/usr/local/extras linkend="guc-dynamic-library-path"/> to enable the PostgreSQL server to find the files: -extension_control_path = '/usr/local/extras/share/postgresql/extension:$system' +extension_control_path = '/usr/local/extras/share/postgresql:$system' dynamic_library_path = '/usr/local/extras/lib/postgresql:$libdir' -- cgit v1.2.3