2005-11-21 13:49:33 +01:00
|
|
|
<!--
|
2010-09-20 22:08:53 +02:00
|
|
|
doc/src/sgml/ref/reassign_owned.sgml
|
2005-11-21 13:49:33 +01:00
|
|
|
PostgreSQL documentation
|
|
|
|
-->
|
|
|
|
|
|
|
|
<refentry id="SQL-REASSIGN-OWNED">
|
2014-02-24 03:25:35 +01:00
|
|
|
<indexterm zone="sql-reassign-owned">
|
|
|
|
<primary>REASSIGN OWNED</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
2005-11-21 13:49:33 +01:00
|
|
|
<refmeta>
|
2010-04-03 09:23:02 +02:00
|
|
|
<refentrytitle>REASSIGN OWNED</refentrytitle>
|
2008-11-14 11:22:48 +01:00
|
|
|
<manvolnum>7</manvolnum>
|
2005-11-21 13:49:33 +01:00
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
<refname>REASSIGN OWNED</refname>
|
2006-04-02 06:02:40 +02:00
|
|
|
<refpurpose>change the ownership of database objects owned by a database role</refpurpose>
|
2005-11-21 13:49:33 +01:00
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<synopsis>
|
2017-10-09 04:00:57 +02:00
|
|
|
REASSIGN OWNED BY { <replaceable class="parameter">old_role</replaceable> | CURRENT_USER | SESSION_USER } [, ...]
|
|
|
|
TO { <replaceable class="parameter">new_role</replaceable> | CURRENT_USER | SESSION_USER }
|
2005-11-21 13:49:33 +01:00
|
|
|
</synopsis>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
|
|
|
<para>
|
2006-04-02 06:02:40 +02:00
|
|
|
<command>REASSIGN OWNED</command> instructs the system to change
|
2015-10-07 22:12:05 +02:00
|
|
|
the ownership of database objects owned by any of the
|
2017-10-09 04:00:57 +02:00
|
|
|
<replaceable class="parameter">old_roles</replaceable> to
|
|
|
|
<replaceable class="parameter">new_role</replaceable>.
|
2005-11-21 13:49:33 +01:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
2006-04-02 06:02:40 +02:00
|
|
|
<refsect1>
|
|
|
|
<title>Parameters</title>
|
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
2017-10-09 04:00:57 +02:00
|
|
|
<term><replaceable class="parameter">old_role</replaceable></term>
|
2006-04-02 06:02:40 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2013-01-28 22:03:23 +01:00
|
|
|
The name of a role. The ownership of all the objects within the
|
|
|
|
current database, and of all shared objects (databases, tablespaces),
|
|
|
|
owned by this role will be reassigned to
|
2017-10-09 04:00:57 +02:00
|
|
|
<replaceable class="parameter">new_role</replaceable>.
|
2006-04-02 06:02:40 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2017-10-09 04:00:57 +02:00
|
|
|
<term><replaceable class="parameter">new_role</replaceable></term>
|
2006-04-02 06:02:40 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The name of the role that will be made the new owner of the
|
|
|
|
affected objects.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
2005-11-21 13:49:33 +01:00
|
|
|
<refsect1>
|
|
|
|
<title>Notes</title>
|
|
|
|
|
|
|
|
<para>
|
2006-04-02 06:02:40 +02:00
|
|
|
<command>REASSIGN OWNED</command> is often used to prepare for the
|
|
|
|
removal of one or more roles. Because <command>REASSIGN
|
2013-01-28 22:03:23 +01:00
|
|
|
OWNED</command> does not affect objects within other databases,
|
2006-04-02 06:02:40 +02:00
|
|
|
it is usually necessary to execute this command in each database
|
|
|
|
that contains objects owned by a role that is to be removed.
|
|
|
|
</para>
|
|
|
|
|
2010-04-02 19:29:22 +02:00
|
|
|
<para>
|
2017-10-17 11:45:34 +02:00
|
|
|
<command>REASSIGN OWNED</command> requires membership on both the
|
2010-04-02 19:29:22 +02:00
|
|
|
source role(s) and the target role.
|
|
|
|
</para>
|
|
|
|
|
2006-04-02 06:02:40 +02:00
|
|
|
<para>
|
2010-04-03 09:23:02 +02:00
|
|
|
The <xref linkend="sql-drop-owned"> command is an alternative that
|
2015-10-07 22:12:05 +02:00
|
|
|
simply drops all the database objects owned by one or more roles.
|
2005-11-21 13:49:33 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2015-10-07 22:12:05 +02:00
|
|
|
The <command>REASSIGN OWNED</command> command does not affect any
|
2017-10-09 03:44:17 +02:00
|
|
|
privileges granted to the <replaceable class="parameter">old_roles</replaceable> for
|
2015-10-07 22:12:05 +02:00
|
|
|
objects that are not owned by them. Use <command>DROP OWNED</command> to
|
|
|
|
revoke such privileges.
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
See <xref linkend="role-removal"> for more discussion.
|
2005-11-21 13:49:33 +01:00
|
|
|
</para>
|
|
|
|
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Compatibility</title>
|
|
|
|
|
|
|
|
<para>
|
2015-10-07 22:12:05 +02:00
|
|
|
The <command>REASSIGN OWNED</command> command is a
|
2005-11-21 13:49:33 +01:00
|
|
|
<productname>PostgreSQL</productname> extension.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
2010-04-03 09:23:02 +02:00
|
|
|
<member><xref linkend="sql-drop-owned"></member>
|
|
|
|
<member><xref linkend="sql-droprole"></member>
|
2010-05-31 20:47:35 +02:00
|
|
|
<member><xref linkend="sql-alterdatabase"></member>
|
2005-11-21 13:49:33 +01:00
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
</refentry>
|