head	1.7;
access;
symbols
	REL9_0_0:1.7
	REL9_1_ALPHA1:1.7
	REL9_0_RC1:1.7
	REL9_0_BETA4:1.7
	REL9_0_STABLE:1.7.0.2
	REL9_0_BETA3:1.7
	REL9_0_BETA2:1.7
	REL8_2_17:1.3
	REL8_3_11:1.3
	REL8_4_4:1.4
	REL9_0_BETA1:1.6
	REL9_0_ALPHA5_BRANCH:1.4.0.12
	REL9_0_ALPHA5:1.4
	REL8_2_16:1.3
	REL8_3_10:1.3
	REL8_4_3:1.4
	REL9_0_ALPHA4:1.4
	REL9_0_ALPHA4_BRANCH:1.4.0.10
	REL8_5_ALPHA3:1.4
	REL8_5_ALPHA3_BRANCH:1.4.0.8
	REL8_2_15:1.3
	REL8_3_9:1.3
	REL8_4_2:1.4
	REL8_5_ALPHA2:1.4
	REL8_5_ALPHA2_BRANCH:1.4.0.6
	REL8_2_14:1.3
	REL8_3_8:1.3
	REL8_4_1:1.4
	REL8_5_ALPHA1:1.4
	REL8_5_ALPHA1_BRANCH:1.4.0.4
	REL8_4_STABLE:1.4.0.2
	REL8_4_0:1.4
	REL8_4_RC2:1.4
	REL8_4_RC1:1.4
	REL8_4_BETA2:1.4
	REL8_4_BETA1:1.4
	REL8_2_13:1.3
	REL8_3_7:1.3
	REL8_2_12:1.3
	REL8_3_6:1.3
	REL8_2_11:1.3
	REL8_3_5:1.3
	REL8_2_10:1.3
	REL8_3_4:1.3
	REL8_2_9:1.3
	REL8_3_3:1.3
	REL8_2_8:1.3
	REL8_3_2:1.3
	REL8_2_7:1.3
	REL8_3_1:1.3
	REL8_3_STABLE:1.3.0.4
	REL8_3_0:1.3
	REL8_3_RC2:1.3
	REL8_2_6:1.3
	REL8_3_RC1:1.3
	REL8_3_BETA4:1.3
	REL8_3_BETA3:1.3
	REL8_3_BETA2:1.3
	REL8_3_BETA1:1.3
	REL8_2_5:1.3
	REL8_2_4:1.3
	REL8_2_3:1.3
	REL8_2_2:1.3
	REL8_2_1:1.3
	REL8_2_STABLE:1.3.0.2
	REL8_2_0:1.3
	REL8_2_RC1:1.3
	REL8_2_BETA3:1.3
	REL8_2_BETA2:1.3
	REL8_2_BETA1:1.3;
locks; strict;
comment	@# @;


1.7
date	2010.05.31.18.47.35;	author alvherre;	state Exp;
branches;
next	1.6;

1.6
date	2010.04.03.07.23.02;	author petere;	state Exp;
branches;
next	1.5;

1.5
date	2010.04.02.17.29.22;	author sriggs;	state Exp;
branches;
next	1.4;

1.4
date	2008.11.14.10.22.47;	author petere;	state Exp;
branches;
next	1.3;

1.3
date	2006.09.16.00.30.19;	author momjian;	state Exp;
branches;
next	1.2;

1.2
date	2006.04.02.04.02.40;	author neilc;	state Exp;
branches;
next	1.1;

1.1
date	2005.11.21.12.49.30;	author alvherre;	state Exp;
branches;
next	;


desc
@@


1.7
log
@Add note about database ownership to REASSIGN OWNED command documentation,
per Josh Berkus.  Add ALTER DATABASE to the "see also" section, too.
@
text
@<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/reassign_owned.sgml,v 1.6 2010/04/03 07:23:02 petere Exp $
PostgreSQL documentation
-->

<refentry id="SQL-REASSIGN-OWNED">
 <refmeta>
  <refentrytitle>REASSIGN OWNED</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>REASSIGN OWNED</refname>
  <refpurpose>change the ownership of database objects owned by a database role</refpurpose>
 </refnamediv>

 <indexterm zone="sql-reassign-owned">
  <primary>REASSIGN OWNED</primary>
 </indexterm>

 <refsynopsisdiv>
<synopsis>
REASSIGN OWNED BY <replaceable class="PARAMETER">old_role</replaceable> [, ...] TO <replaceable class="PARAMETER">new_role</replaceable>
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>REASSIGN OWNED</command> instructs the system to change
   the ownership of the database objects owned by one of the
   old_roles, to new_role.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
   <varlistentry>
    <term><replaceable class="PARAMETER">old_role</replaceable></term>
    <listitem>
     <para>
      The name of a role. The ownership of all the objects in the
      current database owned by this role will be reassigned to
      <replaceable class="PARAMETER">new_role</replaceable>.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="PARAMETER">new_role</replaceable></term>
    <listitem>
     <para>
      The name of the role that will be made the new owner of the
      affected objects.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Notes</title>

  <para>
   <command>REASSIGN OWNED</command> is often used to prepare for the
   removal of one or more roles. Because <command>REASSIGN
   OWNED</command> only affects the objects in the current database,
   it is usually necessary to execute this command in each database
   that contains objects owned by a role that is to be removed.
  </para>

  <para>
   <command>REASSIGN OWNED</command> requires privileges on both the
   source role(s) and the target role.
  </para>

  <para>
   The <xref linkend="sql-drop-owned"> command is an alternative that
   drops all the database objects owned by one or more roles. Note
   also that <command>DROP OWNED</command> requires privileges only
   on the source role(s).
  </para>

  <para>
   The <command>REASSIGN OWNED</command> command does not affect the
   privileges granted to the old_roles in objects that are not owned
   by them.  Use <command>DROP OWNED</command> to revoke those
   privileges.
  </para>

  <para>
   The <command>REASSIGN OWNED</command> command does not affect the
   ownership of any databases owned by the role.  Use
   <xref linkend="sql-alterdatabase"> to reassign that ownership.
  </para>

 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   The <command>REASSIGN OWNED</command> statement is a
   <productname>PostgreSQL</productname> extension.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-drop-owned"></member>
   <member><xref linkend="sql-droprole"></member>
   <member><xref linkend="sql-alterdatabase"></member>
  </simplelist>
 </refsect1>

</refentry>
@


1.6
log
@Remove unnecessary xref endterm attributes and title ids

The endterm attribute is mainly useful when the toolchain does not support
automatic link target text generation for a particular situation.  In  the
past, this was required by the man page tools for all reference page links,
but that is no longer the case, and it now actually gets in the way of
proper automatic link text generation.  The only remaining use cases are
currently xrefs to refsects.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/reassign_owned.sgml,v 1.5 2010/04/02 17:29:22 sriggs Exp $
d95 6
d118 1
@


1.5
log
@Clarify some behaviours of REASSIGN OWNED and DROP OWNED BY.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/reassign_owned.sgml,v 1.4 2008/11/14 10:22:47 petere Exp $
d8 1
a8 1
  <refentrytitle id="SQL-REASSIGN-OWNED-TITLE">REASSIGN OWNED</refentrytitle>
d82 1
a82 2
   The <xref linkend="sql-drop-owned"
    endterm="sql-drop-owned-title"> command is an alternative that
d110 2
a111 2
   <member><xref linkend="sql-drop-owned" endterm="sql-drop-owned-title"></member>
   <member><xref linkend="sql-droprole" endterm="sql-droprole-title"></member>
@


1.4
log
@Set SQL man pages to be section 7 by default, and only transform them to
another section if required by the platform (instead of the old way of
building them in section "l" and always transforming them to the
platform-specific section).

This speeds up the installation on common platforms, and it avoids some
funny business with the man page tools and build process.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/reassign_owned.sgml,v 1.3 2006/09/16 00:30:19 momjian Exp $
d77 5
d84 3
a86 1
   drops all the database objects owned by one or more roles.
@


1.3
log
@Remove emacs info from footer of SGML files.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/reassign_owned.sgml,v 1.2 2006/04/02 04:02:40 neilc Exp $
d9 1
@


1.2
log
@Correct some errors and do some SGML police work on the reference pages
for REASSIGN OWNED and DROP OWNED.
@
text
@d2 1
a2 1
$PostgreSQL: pgsql/doc/src/sgml/ref/reassign_owned.sgml,v 1.1 2005/11/21 12:49:30 alvherre Exp $
a108 17

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
@


1.1
log
@Implement DROP OWNED and REASSIGN OWNED.  These new commands facilitate the
process of dropping roles by dropping objects owned by them and privileges
granted to them, or giving the owned objects to someone else, through the
use of the data stored in the new pg_shdepend catalog.

Some refactoring of the GRANT/REVOKE code was needed, as well as ALTER OWNER
code.  Further cleanup of code duplication in the GRANT code seems necessary.

Implemented by me after an idea from Tom Lane, who also provided various kind
of implementation advice.

Regression tests pass.  Some tests for the new functionality are also added,
as well as rudimentary documentation.
@
text
@d2 1
a2 1
$PostgreSQL$
d14 1
a14 1
  <refpurpose>change ownership of database objects owned by a database role</refpurpose>
d23 1
a23 1
REASSIGN OWNED <replaceable class="PARAMETER">old_role</replaceable> [, ...] TO <replaceable class="PARAMETER">new_role</replaceable>
d31 3
a33 3
   The <command>REASSIGN OWNED</command> instructs the system to change
   the ownership of the database objects owned by one of the old_roles,
   to new_role.
d38 27
d68 11
a78 3
   The <command>REASSIGN OWNED</command> command is mostly used in preparation to
   drop the roles.  See the <command>DROP OWNED</command> command for an
   alternative that drops the objects.
d82 4
a85 3
   The <command>REASSIGN OWNED</command> command does not affect the privileges
   granted to the old_roles in objects not owned by them.  Use
   <command>DROP OWNED</command> to remove them.
@

