Skip to content

Commit cb4083d

Browse files
committed
Fix permissions explanations in CREATE DATABASE and CREATE SCHEMA docs.
These reference pages still claimed that you have to be superuser to create a database or schema owned by a different role. That was true before 8.1, but it was changed in commits aa11106 and f91370c to allow assignment of ownership to any role you are a member of. However, at the time we were thinking of that primarily as a change to the ALTER OWNER rules, so the need to touch these two CREATE ref pages got missed.
1 parent a846f63 commit cb4083d

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

doc/src/sgml/ref/create_database.sgml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,6 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
4646
See <xref linkend="SQL-CREATEUSER">.
4747
</para>
4848

49-
<para>
50-
Normally, the creator becomes the owner of the new database.
51-
Superusers can create databases owned by other users, by using the
52-
<literal>OWNER</> clause. They can even create databases owned by
53-
users with no special privileges. Non-superusers with <literal>CREATEDB</>
54-
privilege can only create databases owned by themselves.
55-
</para>
56-
5749
<para>
5850
By default, the new database will be created by cloning the standard
5951
system database <literal>template1</>. A different template can be
@@ -84,9 +76,11 @@ CREATE DATABASE <replaceable class="PARAMETER">name</replaceable>
8476
<term><replaceable class="parameter">user_name</replaceable></term>
8577
<listitem>
8678
<para>
87-
The name of the database user who will own the new database,
79+
The role name of the user who will own the new database,
8880
or <literal>DEFAULT</literal> to use the default (namely, the
89-
user executing the command).
81+
user executing the command). To create a database owned by another
82+
role, you must be a direct or indirect member of that role,
83+
or be a superuser.
9084
</para>
9185
</listitem>
9286
</varlistentry>

doc/src/sgml/ref/create_schema.sgml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">user_name</replaceabl
6565
<term><replaceable class="parameter">schema_name</replaceable></term>
6666
<listitem>
6767
<para>
68-
The name of a schema to be created. If this is omitted, the user name
68+
The name of a schema to be created. If this is omitted, the
69+
<replaceable class="parameter">user_name</replaceable>
6970
is used as the schema name. The name cannot
7071
begin with <literal>pg_</literal>, as such names
7172
are reserved for system schemas.
@@ -77,9 +78,10 @@ CREATE SCHEMA AUTHORIZATION <replaceable class="parameter">user_name</replaceabl
7778
<term><replaceable class="parameter">user_name</replaceable></term>
7879
<listitem>
7980
<para>
80-
The name of the user who will own the schema. If omitted,
81-
defaults to the user executing the command. Only superusers
82-
can create schemas owned by users other than themselves.
81+
The role name of the user who will own the new schema. If omitted,
82+
defaults to the user executing the command. To create a schema
83+
owned by another role, you must be a direct or indirect member of
84+
that role, or be a superuser.
8385
</para>
8486
</listitem>
8587
</varlistentry>
@@ -175,7 +177,8 @@ CREATE VIEW hollywood.winners AS
175177
all objects within it. <productname>PostgreSQL</productname>
176178
allows schemas to contain objects owned by users other than the
177179
schema owner. This can happen only if the schema owner grants the
178-
<literal>CREATE</> privilege on his schema to someone else.
180+
<literal>CREATE</> privilege on his schema to someone else, or a
181+
superuser chooses to create objects in it.
179182
</para>
180183
</refsect1>
181184

0 commit comments

Comments
 (0)