pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Add @extschema:name@ and no_relocate options to extensions.
Date: Mon, 20 Mar 2023 22:37:26 +0000
Message-ID: <E1peO85-004YBh-Pe@gemulon.postgresql.org> (raw)

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(-)



Message-ID: <E1peO85-004YBh-Pe@gemulon.postgresql.org>
Permalink:  ../E1peO85-004YBh-Pe@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1peO85-004YBh-Pe@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Add @extschema:name@ and no_relocate options to extensions.
  In-Reply-To: <E1peO85-004YBh-Pe@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox