Debian Codegraph @

doc/src/sgml/ref/alter_schema.sgml

raw
1 <!--
2 doc/src/sgml/ref/alter_schema.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="sql-alterschema">
7 <indexterm zone="sql-alterschema">
8 <primary>ALTER SCHEMA</primary>
9 </indexterm>
10
11 <refmeta>
12 <refentrytitle>ALTER SCHEMA</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements</refmiscinfo>
15 </refmeta>
16
17 <refnamediv>
18 <refname>ALTER SCHEMA</refname>
19 <refpurpose>change the definition of a schema</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <synopsis>
24 ALTER SCHEMA <replaceable>name</replaceable> RENAME TO <replaceable>new_name</replaceable>
25 ALTER SCHEMA <replaceable>name</replaceable> OWNER TO { <replaceable>new_owner</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
26 </synopsis>
27 </refsynopsisdiv>
28
29 <refsect1>
30 <title>Description</title>
31
32 <para>
33 <command>ALTER SCHEMA</command> changes the definition of a schema.
34 </para>
35
36 <para>
37 You must own the schema to use <command>ALTER SCHEMA</command>.
38 To rename a schema you must also have the
39 <literal>CREATE</literal> privilege for the database.
40 To alter the owner, you must be able to <literal>SET ROLE</literal> to the
41 new owning role, and that role must have the
42 <literal>CREATE</literal> privilege for the database.
43 (Note that superusers have all these privileges automatically.)
44 </para>
45 </refsect1>
46
47 <refsect1>
48 <title>Parameters</title>
49
50 <variablelist>
51 <varlistentry>
52 <term><replaceable>name</replaceable></term>
53 <listitem>
54 <para>
55 The name of an existing schema.
56 </para>
57 </listitem>
58 </varlistentry>
59
60 <varlistentry>
61 <term><replaceable>new_name</replaceable></term>
62 <listitem>
63 <para>
64 The new name of the schema. The new name cannot
65 begin with <literal>pg_</literal>, as such names
66 are reserved for system schemas.
67 </para>
68 </listitem>
69 </varlistentry>
70
71 <varlistentry>
72 <term><replaceable class="parameter">new_owner</replaceable></term>
73 <listitem>
74 <para>
75 The new owner of the schema.
76 </para>
77 </listitem>
78 </varlistentry>
79 </variablelist>
80 </refsect1>
81
82 <refsect1>
83 <title>Compatibility</title>
84
85 <para>
86 There is no <command>ALTER SCHEMA</command> statement in the SQL
87 standard.
88 </para>
89 </refsect1>
90
91 <refsect1>
92 <title>See Also</title>
93
94 <simplelist type="inline">
95 <member><xref linkend="sql-createschema"/></member>
96 <member><xref linkend="sql-dropschema"/></member>
97 </simplelist>
98 </refsect1>
99
100 </refentry>