2 doc/src/sgml/ref/alter_materialized_view.sgml
3 PostgreSQL documentation
6 <refentry id=
"sql-altermaterializedview">
7 <indexterm zone=
"sql-altermaterializedview">
8 <primary>ALTER MATERIALIZED VIEW
</primary>
12 <refentrytitle>ALTER MATERIALIZED VIEW
</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements
</refmiscinfo>
18 <refname>ALTER MATERIALIZED VIEW
</refname>
19 <refpurpose>change the definition of a materialized view
</refpurpose>
24 ALTER MATERIALIZED VIEW [ IF EXISTS ]
<replaceable class=
"parameter">name
</replaceable>
25 <replaceable class=
"parameter">action
</replaceable> [, ... ]
26 ALTER MATERIALIZED VIEW
<replaceable class=
"parameter">name
</replaceable>
27 [ NO ] DEPENDS ON EXTENSION
<replaceable class=
"parameter">extension_name
</replaceable>
28 ALTER MATERIALIZED VIEW [ IF EXISTS ]
<replaceable class=
"parameter">name
</replaceable>
29 RENAME [ COLUMN ]
<replaceable class=
"parameter">column_name
</replaceable> TO
<replaceable class=
"parameter">new_column_name
</replaceable>
30 ALTER MATERIALIZED VIEW [ IF EXISTS ]
<replaceable class=
"parameter">name
</replaceable>
31 RENAME TO
<replaceable class=
"parameter">new_name
</replaceable>
32 ALTER MATERIALIZED VIEW [ IF EXISTS ]
<replaceable class=
"parameter">name
</replaceable>
33 SET SCHEMA
<replaceable class=
"parameter">new_schema
</replaceable>
34 ALTER MATERIALIZED VIEW ALL IN TABLESPACE
<replaceable class=
"parameter">name
</replaceable> [ OWNED BY
<replaceable class=
"parameter">role_name
</replaceable> [, ... ] ]
35 SET TABLESPACE
<replaceable class=
"parameter">new_tablespace
</replaceable> [ NOWAIT ]
37 <phrase>where
<replaceable class=
"parameter">action
</replaceable> is one of:
</phrase>
39 ALTER [ COLUMN ]
<replaceable class=
"parameter">column_name
</replaceable> SET STATISTICS
<replaceable class=
"parameter">integer
</replaceable>
40 ALTER [ COLUMN ]
<replaceable class=
"parameter">column_name
</replaceable> SET (
<replaceable class=
"parameter">attribute_option
</replaceable> =
<replaceable class=
"parameter">value
</replaceable> [, ... ] )
41 ALTER [ COLUMN ]
<replaceable class=
"parameter">column_name
</replaceable> RESET (
<replaceable class=
"parameter">attribute_option
</replaceable> [, ... ] )
42 ALTER [ COLUMN ]
<replaceable class=
"parameter">column_name
</replaceable> SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN | DEFAULT }
43 ALTER [ COLUMN ]
<replaceable class=
"parameter">column_name
</replaceable> SET COMPRESSION
<replaceable class=
"parameter">compression_method
</replaceable>
44 CLUSTER ON
<replaceable class=
"parameter">index_name
</replaceable>
46 SET ACCESS METHOD
<replaceable class=
"parameter">new_access_method
</replaceable>
47 SET TABLESPACE
<replaceable class=
"parameter">new_tablespace
</replaceable>
48 SET (
<replaceable class=
"parameter">storage_parameter
</replaceable> [=
<replaceable class=
"parameter">value
</replaceable>] [, ... ] )
49 RESET (
<replaceable class=
"parameter">storage_parameter
</replaceable> [, ... ] )
50 OWNER TO {
<replaceable class=
"parameter">new_owner
</replaceable> | CURRENT_ROLE | CURRENT_USER | SESSION_USER }
55 <title>Description
</title>
58 <command>ALTER MATERIALIZED VIEW
</command> changes various auxiliary
59 properties of an existing materialized view.
63 You must own the materialized view to use
<command>ALTER MATERIALIZED
64 VIEW
</command>. To change a materialized view's schema, you must also have
65 <literal>CREATE
</literal> privilege on the new schema.
66 To alter the owner, you must be able to
<literal>SET ROLE
</literal> to the
67 new owning role, and that role must have
<literal>CREATE
</literal>
68 privilege on the materialized view's schema.
69 (These restrictions enforce that altering
70 the owner doesn't do anything you couldn't do by dropping and recreating the
71 materialized view. However, a superuser can alter ownership of any view
76 The statement subforms and actions available for
77 <command>ALTER MATERIALIZED VIEW
</command> are a subset of those available
78 for
<command>ALTER TABLE
</command>, and have the same meaning when used for
79 materialized views. See the descriptions for
80 <link linkend=
"sql-altertable"><command>ALTER TABLE
</command></link>
86 <title>Parameters
</title>
91 <term><replaceable class=
"parameter">name
</replaceable></term>
94 The name (optionally schema-qualified) of an existing materialized view.
100 <term><replaceable class=
"parameter">column_name
</replaceable></term>
103 Name of an existing column.
109 <term><replaceable class=
"parameter">extension_name
</replaceable></term>
112 The name of the extension that the materialized view is to depend on (or no longer
113 dependent on, if
<literal>NO
</literal> is specified). A materialized view
114 that's marked as dependent on an extension is automatically dropped when
115 the extension is dropped.
121 <term><replaceable class=
"parameter">new_column_name
</replaceable></term>
124 New name for an existing column.
130 <term><replaceable class=
"parameter">new_owner
</replaceable></term>
133 The user name of the new owner of the materialized view.
139 <term><replaceable class=
"parameter">new_name
</replaceable></term>
142 The new name for the materialized view.
148 <term><replaceable class=
"parameter">new_schema
</replaceable></term>
151 The new schema for the materialized view.
159 <title>Examples
</title>
162 To rename the materialized view
<literal>foo
</literal> to
163 <literal>bar
</literal>:
165 ALTER MATERIALIZED VIEW foo RENAME TO bar;
166 </programlisting></para>
170 <title>Compatibility
</title>
173 <command>ALTER MATERIALIZED VIEW
</command> is a
174 <productname>PostgreSQL
</productname> extension.
179 <title>See Also
</title>
181 <simplelist type=
"inline">
182 <member><xref linkend=
"sql-creatematerializedview"/></member>
183 <member><xref linkend=
"sql-dropmaterializedview"/></member>
184 <member><xref linkend=
"sql-refreshmaterializedview"/></member>