Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb67aaf2

Browse files
committed
Add CASCADE support for CREATE EXTENSION.
Without CASCADE, if an extension has an unfullfilled dependency onanother extension, CREATE EXTENSION ERRORs out with "required extension... is not installed". That is annoying, especially when that dependencyis an implementation detail of the extension, rather than something theextension's user can make sense of.In addition to CASCADE this also includes a small set of regressiontests around CREATE EXTENSION.Author: Petr Jelinek, editorialized by Michael Paquier, Andres FreundReviewed-By: Michael Paquier, Andres Freund, Jeff JanesDiscussion: 557E0520.3040800@2ndquadrant.com
1 parentbf68679 commitb67aaf2

File tree

32 files changed

+346
-89
lines changed

32 files changed

+346
-89
lines changed

‎contrib/hstore_plperl/expected/hstore_plperl.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CREATE EXTENSIONhstore;
2-
CREATE EXTENSION plperl;
3-
CREATE EXTENSION hstore_plperl;
1+
CREATE EXTENSIONhstore_plperl CASCADE;
2+
NOTICE: installing required extension "hstore"
3+
NOTICE: installing required extension "plperl"
44
SELECT transforms.udt_schema, transforms.udt_name,
55
routine_schema, routine_name,
66
group_name, transform_type

‎contrib/hstore_plperl/expected/hstore_plperlu.out

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
CREATE EXTENSIONhstore;
2-
CREATE EXTENSION plperlu;
3-
CREATE EXTENSION hstore_plperlu;
1+
CREATE EXTENSIONhstore_plperlu CASCADE;
2+
NOTICE: installing required extension "hstore"
3+
NOTICE: installing required extension "plperlu"
44
SELECT transforms.udt_schema, transforms.udt_name,
55
routine_schema, routine_name,
66
group_name, transform_type

‎contrib/hstore_plperl/sql/hstore_plperl.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
CREATE EXTENSION hstore;
2-
CREATE EXTENSION plperl;
3-
CREATE EXTENSION hstore_plperl;
1+
CREATE EXTENSION hstore_plperl CASCADE;
42

53
SELECTtransforms.udt_schema,transforms.udt_name,
64
routine_schema, routine_name,

‎contrib/hstore_plperl/sql/hstore_plperlu.sql

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
CREATE EXTENSION hstore;
2-
CREATE EXTENSION plperlu;
3-
CREATE EXTENSION hstore_plperlu;
1+
CREATE EXTENSION hstore_plperlu CASCADE;
42

53
SELECTtransforms.udt_schema,transforms.udt_name,
64
routine_schema, routine_name,

‎contrib/hstore_plpython/expected/hstore_plpython.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
CREATE EXTENSIONplpython2u;
2-
CREATE EXTENSION hstore_plpython2u;
1+
CREATE EXTENSIONhstore_plpython2u CASCADE;
2+
NOTICE: installing required extension "plpython2u"
33
-- test hstore -> python
44
CREATE FUNCTION test1(val hstore) RETURNS int
55
LANGUAGE plpythonu

‎contrib/hstore_plpython/sql/hstore_plpython.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
CREATE EXTENSION plpython2u;
2-
CREATE EXTENSION hstore_plpython2u;
1+
CREATE EXTENSION hstore_plpython2u CASCADE;
32

43

54
-- test hstore -> python

‎contrib/ltree_plpython/expected/ltree_plpython.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
CREATE EXTENSIONplpython2u;
2-
CREATE EXTENSION ltree_plpython2u;
1+
CREATE EXTENSIONltree_plpython2u CASCADE;
2+
NOTICE: installing required extension "plpython2u"
33
CREATE FUNCTION test1(val ltree) RETURNS int
44
LANGUAGE plpythonu
55
TRANSFORM FOR TYPE ltree

‎contrib/ltree_plpython/sql/ltree_plpython.sql

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
CREATE EXTENSION plpython2u;
2-
CREATE EXTENSION ltree_plpython2u;
1+
CREATE EXTENSION ltree_plpython2u CASCADE;
32

43

54
CREATEFUNCTIONtest1(val ltree) RETURNSint

‎doc/src/sgml/ref/create_extension.sgml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name
2525
[ WITH ] [ SCHEMA <replaceable class="parameter">schema_name</replaceable> ]
2626
[ VERSION <replaceable class="parameter">version</replaceable> ]
2727
[ FROM <replaceable class="parameter">old_version</replaceable> ]
28+
[ CASCADE ]
2829
</synopsis>
2930
</refsynopsisdiv>
3031

@@ -94,6 +95,35 @@ CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name
9495
If not specified, and the extension's control file does not specify a
9596
schema either, the current default object creation schema is used.
9697
</para>
98+
<para>
99+
If the extension specifies <literal>schema</> in its control file,
100+
the schema cannot be overriden with <literal>SCHEMA</> clause.
101+
The <literal>SCHEMA</> clause in this case works as follows:
102+
<itemizedlist>
103+
<listitem>
104+
<para>
105+
If <replaceable class="parameter">schema_name</replaceable> matches
106+
the schema in control file, it will be used normally as there is no
107+
conflict.
108+
</para>
109+
</listitem>
110+
<listitem>
111+
<para>
112+
If the <literal>CASCADE</> clause is given, the
113+
<replaceable class="parameter">schema_name</replaceable> will only
114+
be used for the missing required extensions which do not specify
115+
<literal>schema</> in their control files.
116+
</para>
117+
</listitem>
118+
<listitem>
119+
<para>
120+
If <replaceable class="parameter">schema_name</replaceable> is not
121+
the same as the one in extension's control file and the
122+
<literal>CASCADE</> clause is not given, error will be thrown.
123+
</para>
124+
</listitem>
125+
</itemizedlist>
126+
</para>
97127
<para>
98128
Remember that the extension itself is not considered to be within any
99129
schema: extensions have unqualified names that must be unique
@@ -139,6 +169,18 @@ CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name
139169
</para>
140170
</listitem>
141171
</varlistentry>
172+
173+
<varlistentry>
174+
<term><literal>CASCADE</></term>
175+
<listitem>
176+
<para>
177+
Try to install extension including the required dependencies
178+
recursively. The <literal>SCHEMA</> option will be propagated
179+
to the required extensions. Other options are not recursively
180+
applied when using this clause.
181+
</para>
182+
</listitem>
183+
</varlistentry>
142184
</variablelist>
143185
</refsect1>
144186

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp