pgsql: Add @extschema:name@ and no_relocate options to extensions.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Add @extschema:name@ and no_relocate options to extensions.
Date: 2023-03-20 22:37:26
Message-ID: E1peO85-004YBh-Pe@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Add @extschema:name@ and no_relocate options to extensions.

@extschema:name@ extends the existing @extschema@ feature so that
we can also insert the schema name of some required extension,
thus making cross-extension references robust even if they are in
different schemas.

However, this has the same hazard as @extschema@: if the schema
name is embedded literally in an installed object, rather than being
looked up once during extension script execution, then it's no longer
safe to relocate the other extension to another schema. To deal with
that without restricting things unnecessarily, add a "no_relocate"
option to extension control files. This allows an extension to
specify that it cannot handle relocation of some of its required
extensions, even if in themselves those extensions are relocatable.
We detect "no_relocate" requests of dependent extensions during
ALTER EXTENSION SET SCHEMA.

Regina Obe, reviewed by Sandro Santilli and myself

Discussion: https://postgr.es/m/003001d8f4ae$402282c0$c0678840$@pcorp.us

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/72a5b1fc880481914da2d4233077438dd87840ca

Modified Files
--------------
doc/src/sgml/extend.sgml | 45 +++++++++++-
src/backend/commands/extension.c | 81 +++++++++++++++++++++-
src/test/modules/test_extensions/Makefile | 9 ++-
.../test_extensions/expected/test_extensions.out | 77 ++++++++++++++++++++
src/test/modules/test_extensions/meson.build | 6 ++
.../test_extensions/sql/test_extensions.sql | 23 ++++++
.../test_extensions/test_ext_req_schema1--1.0.sql | 6 ++
.../test_extensions/test_ext_req_schema1.control | 3 +
.../test_extensions/test_ext_req_schema2--1.0.sql | 9 +++
.../test_extensions/test_ext_req_schema2.control | 4 ++
.../test_extensions/test_ext_req_schema3--1.0.sql | 12 ++++
.../test_extensions/test_ext_req_schema3.control | 5 ++
12 files changed, 272 insertions(+), 8 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2023-03-21 00:26:45 pgsql: meson: rename html_help target to htmlhelp
Previous Message Alvaro Herrera 2023-03-20 13:12:27 pgsql: doc/PDF: Add page breaks for <sect1> in contrib appendix