mirror of
https://git.postgresql.org/git/postgresql.git
synced 2026-02-17 11:57:00 +08:00
@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
10 lines
412 B
SQL
10 lines
412 B
SQL
/* src/test/modules/test_extensions/test_ext_req_schema2--1.0.sql */
|
|
-- complain if script is sourced in psql, rather than via CREATE EXTENSION
|
|
\echo Use "CREATE EXTENSION test_ext_req_schema2" to load this file. \quit
|
|
|
|
-- This formulation can handle relocation of the required extension.
|
|
CREATE FUNCTION dep_req2() RETURNS text
|
|
BEGIN ATOMIC
|
|
SELECT @extschema:test_ext_req_schema1@.dep_req1() || ' req2';
|
|
END;
|