8000 Further improve documentation of the role-dropping process. · SudhirLonkar/postgres@f9fc8e7 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9fc8e7

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

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
@@ -436,17 +436,23 @@ ALTER TABLE bobs_table OWNER TO alice;
436436
</programlisting>
437437
Alternatively, the <xref linkend="sql-reassign-owned"> command can be
438438
used to reassign ownership of all objects owned by the role-to-be-dropped
439-
to a single other role. Because <command>REASSIGN OWNED</> can only
440-
access objects in the current database, it is necessary to run it in each
441-
database that contains objects owned by the role.
439+
to a single other role. Because <command>REASSIGN OWNED</> cannot access
440+
objects in other databases, it is necessary to run it in each database
441+
that contains objects owned by the role. (Note that the first
442+
such <command>REASSIGN OWNED</> will change the ownership of any
443+
shared-across-databases objects, that is databases or tablespaces, that
444+
are owned by the role-to-be-dropped.)
442445
</para>
443446

444447
<para>
445448
Once any valuable objects have been transferred to new owners, any
446449
remaining objects owned by the role-to-be-dropped can be dropped with
447-
the <xref linkend="sql-drop-owned"> command. Again, this command can
448-
only access objects in the current database, so it is necessary to run it
449-
in each database that contains objects owned by the role.
450+
the <xref linkend="sql-drop-owned"> command. Again, this command cannot
451+
access objects in other databases, so it is necessary to run it in each
452+
database that contains objects owned by the role. Also, <command>DROP
453+
OWNED</> will not drop entire databases or tablespaces, so it is
454+
necessary to do that manually if the role owns any databases or
455+
tablespaces that have not been transferred to new owners.
450456
</para>
451457

452458
<para>
@@ -461,7 +467,6 @@ ALTER TABLE bobs_table OWNER TO alice;
461467
<para>
462468
In short then, the most general recipe for removing a role that has been
463469
used to own objects is:
464-
465470
</para>
466471
<programlisting>
467472
REASSIGN OWNED BY doomed_role TO successor_role;
@@ -470,6 +475,12 @@ DROP OWNED BY doomed_role;
470475
DROP ROLE doomed_role;
471476
</programlisting>
472477

478+
<para>
479+
When not all owned objects are to be transferred to the same successor
480+
owner, it's best to handle the exceptions manually and then perform
481+
the above steps to mop up.
482+
</para>
483+
473484
<para>
474485
If <command>DROP ROLE</> is attempted while dependent objects still
475486
remain, it will issue messages identifying which objects need to be

0 commit comments

Comments
 (0)
0