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