pgsql: Don't strip $libdir from LOAD command

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Don't strip $libdir from LOAD command
Date: 2025-06-04 09:42:47
Message-ID: E1uMkdz-00089Y-06@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Don't strip $libdir from LOAD command

Commit 4f7f7b03758 implemented the extension_control_path GUC, and to
make it work it was decided that we should strip the $libdir/ on
module_pathname from .control files, so that extensions don't need to
worry about this change.

This strip logic was implemented on expand_dynamic_library_name()
which works fine when executing the SQL functions from extensions, but
this function is also called when the LOAD command is executed, and
since the user may explicitly pass the $libdir prefix on LOAD
parameter, we should not strip in this case.

This commit fixes this issue by moving the strip logic from
expand_dynamic_library_name() to load_external_function() that is
called when the running the SQL script from extensions.

Reported-by: Evan Si <evsi(at)amazon(dot)com>
Author: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
Reviewed-by: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Reviewed-by: Rahila Syed <rahilasyed90(at)gmail(dot)com>
Bug: #18920
Discussion: https://www.postgresql.org/message-id/flat/18920-b350b1c0a30af006%40postgresql.org

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/f777d773878ddda3388bb18dbcb93e97a0fb52e2

Modified Files
--------------
src/backend/utils/fmgr/dfmgr.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Eisentraut 2025-06-04 10:12:19 pgsql: doc PG 18 relnotes: Add incompatibility note about checksums now
Previous Message Fujii Masao 2025-06-04 04:14:44 Re: pgsql: postgres_fdw: Inherit the local transaction's access/deferrable