1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-28 18:48:04 +03:00
Files
postgres/doc/src/sgml/ref/reassign_owned.sgml
Peter Eisentraut 9081bddbd7 Improve <xref> vs. <command> formatting in the documentation
SQL commands are generally marked up as <command>, except when a link
to a reference page is used using <xref>.  But the latter doesn't
create monospace markup, so this looks strange especially when a
paragraph contains a mix of links and non-links.

We considered putting <command> in the <refentrytitle> on the target
side, but that creates some formatting side effects elsewhere.
Generally, it seems safer to solve this on the link source side.

We can't put the <xref> inside the <command>; the DTD doesn't allow
this.  DocBook 5 would allow the <command> to have the linkend
attribute itself, but we are not there yet.

So to solve this for now, convert the <xref>s to <link> plus
<command>.  This gives the correct look and also gives some more
flexibility what we can put into the link text (e.g., subcommands or
other clauses).  In the future, these could then be converted to
DocBook 5 style.

I haven't converted absolutely all xrefs to SQL command reference
pages, only those where we care about the appearance of the link text
or where it was otherwise appropriate to make the appearance match a
bit better.  Also in some cases, the links where repetitive, so in
those cases the links where just removed and replaced by a plain
<command>.  In cases where we just want the link and don't
specifically care about the generated link text (typically phrased
"for further information see <xref ...>") the xref is kept.

Reported-by: Dagfinn Ilmari Mannsåker <ilmari@ilmari.org>
Discussion: https://www.postgresql.org/message-id/flat/87o8pco34z.fsf@wibble.ilmari.org
2020-10-03 16:40:02 +02:00

124 lines
3.5 KiB
Plaintext

<!--
doc/src/sgml/ref/reassign_owned.sgml
PostgreSQL documentation
-->
<refentry id="sql-reassign-owned">
<indexterm zone="sql-reassign-owned">
<primary>REASSIGN OWNED</primary>
</indexterm>
<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>
<refsynopsisdiv>
<synopsis>
REASSIGN OWNED BY { <replaceable class="parameter">old_role</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER } [, ...]
TO { <replaceable class="parameter">new_role</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>REASSIGN OWNED</command> instructs the system to change
the ownership of database objects owned by any of the
<replaceable class="parameter">old_roles</replaceable> to
<replaceable class="parameter">new_role</replaceable>.
</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 within the
current database, and of all shared objects (databases, tablespaces),
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> does not affect objects within other databases,
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 membership on both the
source role(s) and the target role.
</para>
<para>
The <link linkend="sql-drop-owned"><command>DROP OWNED</command></link> command is an alternative that
simply drops all the database objects owned by one or more roles.
</para>
<para>
The <command>REASSIGN OWNED</command> command does not affect any
privileges granted to
the <replaceable class="parameter">old_roles</replaceable> on objects
that are not owned by them. Likewise, it does not affect default
privileges created with <command>ALTER DEFAULT PRIVILEGES</command>.
Use <command>DROP OWNED</command> to revoke such privileges.
</para>
<para>
See <xref linkend="role-removal"/> for more discussion.
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
The <command>REASSIGN OWNED</command> command 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>