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

Commit63acfb7

Browse files
committed
Further improve documentation of the role-dropping process.
In commit1ea0c73 I added a section to user-manag.sgml about how to droproles that own objects; but as pointed out by Stephen Frost, I neglectedthat shared objects (databases or tablespaces) may need special treatment.Fix that. Back-patch to supported versions, like the previous patch.
1 parent820ddb2 commit63acfb7

File tree

1 file changed

+18
-7
lines changed

1 file changed

+18
-7
lines changed

‎doc/src/sgml/user-manag.sgml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -431,17 +431,23 @@ ALTER TABLE bobs_table OWNER TO alice;
431431
</programlisting>
432432
Alternatively, the <xref linkend="sql-reassign-owned"> command can be
433433
used to reassign ownership of all objects owned by the role-to-be-dropped
434-
to a single other role. Because <command>REASSIGN OWNED</> can only
435-
access objects in the current database, it is necessary to run it in each
436-
database that contains objects owned by the role.
434+
to a single other role. Because <command>REASSIGN OWNED</> cannot access
435+
objects in other databases, it is necessary to run it in each database
436+
that contains objects owned by the role. (Note that the first
437+
such <command>REASSIGN OWNED</> will change the ownership of any
438+
shared-across-databases objects, that is databases or tablespaces, that
439+
are owned by the role-to-be-dropped.)
437440
</para>
438441

439442
<para>
440443
Once any valuable objects have been transferred to new owners, any
441444
remaining objects owned by the role-to-be-dropped can be dropped with
442-
the <xref linkend="sql-drop-owned"> command. Again, this command can
443-
only access objects in the current database, so it is necessary to run it
444-
in each database that contains objects owned by the role.
445+
the <xref linkend="sql-drop-owned"> command. Again, this command cannot
446+
access objects in other databases, so it is necessary to run it in each
447+
database that contains objects owned by the role. Also, <command>DROP
448+
OWNED</> will not drop entire databases or tablespaces, so it is
449+
necessary to do that manually if the role owns any databases or
450+
tablespaces that have not been transferred to new owners.
445451
</para>
446452

447453
<para>
@@ -456,7 +462,6 @@ ALTER TABLE bobs_table OWNER TO alice;
456462
<para>
457463
In short then, the most general recipe for removing a role that has been
458464
used to own objects is:
459-
460465
</para>
461466
<programlisting>
462467
REASSIGN OWNED BY doomed_role TO successor_role;
@@ -465,6 +470,12 @@ DROP OWNED BY doomed_role;
465470
DROP ROLE doomed_role;
466471
</programlisting>
467472

473+
<para>
474+
When not all owned objects are to be transferred to the same successor
475+
owner, it's best to handle the exceptions manually and then perform
476+
the above steps to mop up.
477+
</para>
478+
468479
<para>
469480
If <command>DROP ROLE</> is attempted while dependent objects still
470481
remain, it will issue messages identifying which objects need to be

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp