pgsql: Fix pg_upgrade failure when extension_control_path is used

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Fix pg_upgrade failure when extension_control_path is used
Date: 2026-03-16 10:56:24
Message-ID: E1w25cW-0000L4-3B@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix pg_upgrade failure when extension_control_path is used

When an extension is located via extension_control_path and it has a
hardcoded $libdir/ path, this is stripped by the
extension_control_path mechanism. But when pg_upgrade verifies the
extension using LOAD, this stripping does not happen, and so
pg_upgrade will fail because it cannot load the extension. To work
around that, change pg_upgrade to itself strip the prefix when it runs
its checks. A test case is also added.

Author: Jonathan Gonzalez V. <jonathan(dot)abdiel(at)gmail(dot)com>
Reviewed-by: Niccolò Fei <niccolo(dot)fei(at)enterprisedb(dot)com>
Reviewed-by: Matheus Alcantara <matheusssilv97(at)gmail(dot)com>
Discussion: https://www.postgresql.org/message-id/flat/43b3691c673a8b9158f5a09f06eacc3c63e2c02d.camel%40gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1e67508730eb0c98bf6eec660d0ed04368982266

Modified Files
--------------
src/bin/pg_upgrade/Makefile | 6 +-
src/bin/pg_upgrade/function.c | 8 ++
src/bin/pg_upgrade/meson.build | 21 +++-
src/bin/pg_upgrade/t/008_extension_control_path.pl | 126 +++++++++++++++++++++
src/test/modules/test_extensions/Makefile | 3 +
src/test/modules/test_extensions/meson.build | 13 +++
src/test/modules/test_extensions/test_ext.c | 22 ++++
7 files changed, 197 insertions(+), 2 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Bertrand Drouvot 2026-03-16 11:16:51 Re: PGPROC alignment (was Re: pgsql: Separate RecoveryConflictReasons from procsignals)
Previous Message Peter Eisentraut 2026-03-16 10:42:35 Re: PGPROC alignment (was Re: pgsql: Separate RecoveryConflictReasons from procsignals)