Skip to content

Commit d189dee

Browse files
committed
Improve documentation about the relationship of extensions and schemas.
There's been some confusion expressed about this point, so clarify. Extended version of a patch by David Wheeler.
1 parent 7ef1107 commit d189dee

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

doc/src/sgml/extend.sgml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@
352352
extension.) Also notice that while a table can be a member of an
353353
extension, its subsidiary objects such as indexes are not directly
354354
considered members of the extension.
355+
Another important point is that schemas can belong to extensions, but not
356+
vice versa: an extension as such has an unqualified name and does not
357+
exist <quote>within</> any schema. The extension's member objects,
358+
however, will belong to schemas whenever appropriate for their object
359+
types. It may or may not be appropriate for an extension to own the
360+
schema(s) its member objects are within.
355361
</para>
356362

357363
<sect2>

doc/src/sgml/ref/create_extension.sgml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ PostgreSQL documentation
2222
<refsynopsisdiv>
2323
<synopsis>
2424
CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name</replaceable>
25-
[ WITH ] [ SCHEMA <replaceable class="parameter">schema</replaceable> ]
25+
[ WITH ] [ SCHEMA <replaceable class="parameter">schema_name</replaceable> ]
2626
[ VERSION <replaceable class="parameter">version</replaceable> ]
2727
[ FROM <replaceable class="parameter">old_version</replaceable> ]
2828
</synopsis>
@@ -85,7 +85,7 @@ CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name
8585
</varlistentry>
8686

8787
<varlistentry>
88-
<term><replaceable class="parameter">schema</replaceable></term>
88+
<term><replaceable class="parameter">schema_name</replaceable></term>
8989
<listitem>
9090
<para>
9191
The name of the schema in which to install the extension's
@@ -94,6 +94,12 @@ CREATE EXTENSION [ IF NOT EXISTS ] <replaceable class="parameter">extension_name
9494
If not specified, and the extension's control file does not specify a
9595
schema either, the current default object creation schema is used.
9696
</para>
97+
<para>
98+
Remember that the extension itself is not considered to be within any
99+
schema: extensions have unqualified names that must be unique
100+
database-wide. But objects belonging to the extension can be within
101+
schemas.
102+
</para>
97103
</listitem>
98104
</varlistentry>
99105

0 commit comments

Comments
 (0)