blob: 7dd052cc1244512638684d1e0f3178ba5dd45e1d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/alter_view.sgml,v 1.3 2007/10/03 16:48:43 tgl Exp $
PostgreSQL documentation
-->
<refentry id="SQL-ALTERVIEW">
<refmeta>
<refentrytitle id="SQL-ALTERVIEW-TITLE">ALTER VIEW</refentrytitle>
<refmiscinfo>SQL - Language Statements</refmiscinfo>
</refmeta>
<refnamediv>
<refname>ALTER VIEW</refname>
<refpurpose>change the definition of a view</refpurpose>
</refnamediv>
<indexterm zone="sql-alterview">
<primary>ALTER VIEW</primary>
</indexterm>
<refsynopsisdiv>
<synopsis>
ALTER VIEW <replaceable>name</replaceable> RENAME TO <replaceable>newname</replaceable>
</synopsis>
</refsynopsisdiv>
<refsect1>
<title>Description</title>
<para>
<command>ALTER VIEW</command> changes the definition of a view.
The only currently available functionality is to rename the view.
To execute this command you must be the owner of the view.
</para>
</refsect1>
<refsect1>
<title>Parameters</title>
<variablelist>
<varlistentry>
<term><replaceable class="parameter">name</replaceable></term>
<listitem>
<para>
The name (optionally schema-qualified) of an existing view.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><replaceable class="parameter">newname</replaceable></term>
<listitem>
<para>
The new name of the view.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Notes</title>
<para>
Some variants of <command>ALTER TABLE</command> can be used with
views as well; for example, to rename a view it is also
possible to use <command>ALTER TABLE RENAME</command>. To change
the schema or owner of a view, you currently must use <command>ALTER
TABLE</>.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
To rename the view <literal>foo</literal> to
<literal>bar</literal>:
<programlisting>
ALTER VIEW foo RENAME TO bar;
</programlisting>
</para>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
<command>ALTER VIEW</command> is a <productname>PostgreSQL</>
extension of the SQL standard.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createview" endterm="sql-createview-title"></member>
<member><xref linkend="sql-dropview" endterm="sql-dropview-title"></member>
</simplelist>
</refsect1>
</refentry>
|