@@ -431,17 +431,23 @@ ALTER TABLE bobs_table OWNER TO alice;
431
431
</programlisting>
432
432
Alternatively, the <xref linkend="sql-reassign-owned"> command can be
433
433
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.)
437
440
</para>
438
441
439
442
<para>
440
443
Once any valuable objects have been transferred to new owners, any
441
444
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.
445
451
</para>
446
452
447
453
<para>
@@ -456,7 +462,6 @@ ALTER TABLE bobs_table OWNER TO alice;
456
462
<para>
457
463
In short then, the most general recipe for removing a role that has been
458
464
used to own objects is:
459
-
460
465
</para>
461
466
<programlisting>
462
467
REASSIGN OWNED BY doomed_role TO successor_role;
@@ -465,6 +470,12 @@ DROP OWNED BY doomed_role;
465
470
DROP ROLE doomed_role;
466
471
</programlisting>
467
472
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
+
468
479
<para>
469
480
If <command>DROP ROLE</> is attempted while dependent objects still
470
481
remain, it will issue messages identifying which objects need to be
0 commit comments