2003-06-27 16:45:32 +02:00
|
|
|
<!--
|
2010-09-20 22:08:53 +02:00
|
|
|
doc/src/sgml/ref/alter_schema.sgml
|
2003-06-27 16:45:32 +02:00
|
|
|
PostgreSQL documentation
|
|
|
|
-->
|
|
|
|
|
2017-10-20 03:16:39 +02:00
|
|
|
<refentry id="sql-alterschema">
|
2014-02-24 03:25:35 +01:00
|
|
|
<indexterm zone="sql-alterschema">
|
|
|
|
<primary>ALTER SCHEMA</primary>
|
|
|
|
</indexterm>
|
|
|
|
|
2003-06-27 16:45:32 +02:00
|
|
|
<refmeta>
|
2010-04-03 09:23:02 +02:00
|
|
|
<refentrytitle>ALTER SCHEMA</refentrytitle>
|
2008-11-14 11:22:48 +01:00
|
|
|
<manvolnum>7</manvolnum>
|
2003-11-08 12:06:37 +01:00
|
|
|
<refmiscinfo>SQL - Language Statements</refmiscinfo>
|
2003-06-27 16:45:32 +02:00
|
|
|
</refmeta>
|
|
|
|
|
|
|
|
<refnamediv>
|
|
|
|
<refname>ALTER SCHEMA</refname>
|
|
|
|
<refpurpose>change the definition of a schema</refpurpose>
|
|
|
|
</refnamediv>
|
|
|
|
|
|
|
|
<refsynopsisdiv>
|
|
|
|
<synopsis>
|
2009-09-19 12:23:27 +02:00
|
|
|
ALTER SCHEMA <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
|
2020-09-17 11:39:28 +02:00
|
|
|
ALTER SCHEMA <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
|
2003-06-27 16:45:32 +02:00
|
|
|
</synopsis>
|
|
|
|
</refsynopsisdiv>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Description</title>
|
|
|
|
|
|
|
|
<para>
|
|
|
|
<command>ALTER SCHEMA</command> changes the definition of a schema.
|
2005-10-14 00:44:51 +02:00
|
|
|
</para>
|
|
|
|
|
|
|
|
<para>
|
2017-10-09 03:44:17 +02:00
|
|
|
You must own the schema to use <command>ALTER SCHEMA</command>.
|
2005-10-14 00:44:51 +02:00
|
|
|
To rename a schema you must also have the
|
|
|
|
<literal>CREATE</literal> privilege for the database.
|
2023-01-16 16:35:29 +01:00
|
|
|
To alter the owner, you must be able to <literal>SET ROLE</literal> to the
|
|
|
|
new owning role, and that role must have the
|
2005-10-14 00:44:51 +02:00
|
|
|
<literal>CREATE</literal> privilege for the database.
|
|
|
|
(Note that superusers have all these privileges automatically.)
|
2003-06-27 16:45:32 +02:00
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
2003-09-12 02:12:47 +02:00
|
|
|
<title>Parameters</title>
|
2003-06-27 16:45:32 +02:00
|
|
|
|
|
|
|
<variablelist>
|
|
|
|
<varlistentry>
|
|
|
|
<term><replaceable>name</replaceable></term>
|
|
|
|
<listitem>
|
|
|
|
<para>
|
2004-06-25 23:55:59 +02:00
|
|
|
The name of an existing schema.
|
2003-06-27 16:45:32 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2009-09-19 12:23:27 +02:00
|
|
|
<term><replaceable>new_name</replaceable></term>
|
2003-06-27 16:45:32 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
2004-06-25 23:55:59 +02:00
|
|
|
The new name of the schema. The new name cannot
|
|
|
|
begin with <literal>pg_</literal>, as such names
|
|
|
|
are reserved for system schemas.
|
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
|
|
|
|
<varlistentry>
|
2009-09-19 12:23:27 +02:00
|
|
|
<term><replaceable class="parameter">new_owner</replaceable></term>
|
2004-06-25 23:55:59 +02:00
|
|
|
<listitem>
|
|
|
|
<para>
|
|
|
|
The new owner of the schema.
|
2003-06-27 16:45:32 +02:00
|
|
|
</para>
|
|
|
|
</listitem>
|
|
|
|
</varlistentry>
|
|
|
|
</variablelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>Compatibility</title>
|
2010-11-23 21:27:50 +01:00
|
|
|
|
2003-06-27 16:45:32 +02:00
|
|
|
<para>
|
|
|
|
There is no <command>ALTER SCHEMA</command> statement in the SQL
|
|
|
|
standard.
|
|
|
|
</para>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
<refsect1>
|
|
|
|
<title>See Also</title>
|
|
|
|
|
|
|
|
<simplelist type="inline">
|
2017-11-23 15:39:47 +01:00
|
|
|
<member><xref linkend="sql-createschema"/></member>
|
|
|
|
<member><xref linkend="sql-dropschema"/></member>
|
2003-06-27 16:45:32 +02:00
|
|
|
</simplelist>
|
|
|
|
</refsect1>
|
|
|
|
|
|
|
|
</refentry>
|