|
| 1 | +<!-- |
| 2 | +doc/src/sgml/ref/alter_materialized_view.sgml |
| 3 | +PostgreSQL documentation |
| 4 | +--> |
| 5 | + |
| 6 | +<refentry id="SQL-ALTERMATERIALIZEDVIEW"> |
| 7 | + <refmeta> |
| 8 | + <refentrytitle>ALTER MATERIALIZED VIEW</refentrytitle> |
| 9 | + <manvolnum>7</manvolnum> |
| 10 | + <refmiscinfo>SQL - Language Statements</refmiscinfo> |
| 11 | + </refmeta> |
| 12 | + |
| 13 | + <refnamediv> |
| 14 | + <refname>ALTER MATERIALIZED VIEW</refname> |
| 15 | + <refpurpose>change the definition of a materialized view</refpurpose> |
| 16 | + </refnamediv> |
| 17 | + |
| 18 | + <indexterm zone="sql-alterview"> |
| 19 | + <primary>ALTER MATERIALIZED VIEW</primary> |
| 20 | + </indexterm> |
| 21 | + |
| 22 | + <refsynopsisdiv> |
| 23 | +<synopsis> |
| 24 | +ALTER MATERIALIZED VIEW [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> |
| 25 | + <replaceable class="PARAMETER">action</replaceable> [, ... ] |
| 26 | +ALTER MATERIALIZED VIEW [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> |
| 27 | + RENAME [ COLUMN ] <replaceable class="PARAMETER">column_name</replaceable> TO <replaceable class="PARAMETER">new_column_name</replaceable> |
| 28 | +ALTER MATERIALIZED VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> |
| 29 | + RENAME TO <replaceable class="parameter">new_name</replaceable> |
| 30 | +ALTER MATERIALIZED VIEW [ IF EXISTS ] <replaceable class="parameter">name</replaceable> |
| 31 | + SET SCHEMA <replaceable class="parameter">new_schema</replaceable> |
| 32 | + |
| 33 | +<phrase>where <replaceable class="PARAMETER">action</replaceable> is one of:</phrase> |
| 34 | + |
| 35 | + ALTER [ COLUMN ] <replaceable class="PARAMETER">column_name</replaceable> SET STATISTICS <replaceable class="PARAMETER">integer</replaceable> |
| 36 | + ALTER [ COLUMN ] <replaceable class="PARAMETER">column_name</replaceable> SET ( <replaceable class="PARAMETER">attribute_option</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] ) |
| 37 | + ALTER [ COLUMN ] <replaceable class="PARAMETER">column_name</replaceable> RESET ( <replaceable class="PARAMETER">attribute_option</replaceable> [, ... ] ) |
| 38 | + ALTER [ COLUMN ] <replaceable class="PARAMETER">column_name</replaceable> SET STORAGE { PLAIN | EXTERNAL | EXTENDED | MAIN } |
| 39 | + CLUSTER ON <replaceable class="PARAMETER">index_name</replaceable> |
| 40 | + SET WITHOUT CLUSTER |
| 41 | + SET ( <replaceable class="PARAMETER">storage_parameter</replaceable> = <replaceable class="PARAMETER">value</replaceable> [, ... ] ) |
| 42 | + RESET ( <replaceable class="PARAMETER">storage_parameter</replaceable> [, ... ] ) |
| 43 | + OWNER TO <replaceable class="PARAMETER">new_owner</replaceable> |
| 44 | + SET TABLESPACE <replaceable class="PARAMETER">new_tablespace</replaceable> |
| 45 | +</synopsis> |
| 46 | + </refsynopsisdiv> |
| 47 | + |
| 48 | + <refsect1> |
| 49 | + <title>Description</title> |
| 50 | + |
| 51 | + <para> |
| 52 | + <command>ALTER MATERIALIZED VIEW</command> changes various auxiliary |
| 53 | + properties of an existing materialized view. |
| 54 | + </para> |
| 55 | + |
| 56 | + <para> |
| 57 | + You must own the materialized view to use <command>ALTER MATERIALIZED |
| 58 | + VIEW</>. To change a materialized view's schema, you must also have |
| 59 | + <literal>CREATE</> privilege on the new schema. |
| 60 | + To alter the owner, you must also be a direct or indirect member of the new |
| 61 | + owning role, and that role must have <literal>CREATE</literal> privilege on |
| 62 | + the materialized view's schema. (These restrictions enforce that altering |
| 63 | + the owner doesn't do anything you couldn't do by dropping and recreating the |
| 64 | + materialized view. However, a superuser can alter ownership of any view |
| 65 | + anyway.) |
| 66 | + </para> |
| 67 | + |
| 68 | + <para> |
| 69 | + The statement subforms and actions available for |
| 70 | + <command>ALTER MATERIALIZED VIEW</command> are a subset of those available |
| 71 | + for <command>ALTER TABLE</command>, and have the same meaning when used for |
| 72 | + materialized views. See the descriptions for <xref linkend="sql-altertable"> |
| 73 | + for details. |
| 74 | + </para> |
| 75 | + </refsect1> |
| 76 | + |
| 77 | + <refsect1> |
| 78 | + <title>Parameters</title> |
| 79 | + |
| 80 | + <variablelist> |
| 81 | + |
| 82 | + <varlistentry> |
| 83 | + <term><replaceable class="parameter">name</replaceable></term> |
| 84 | + <listitem> |
| 85 | + <para> |
| 86 | + The name (optionally schema-qualified) of an existing materialized view. |
| 87 | + </para> |
| 88 | + </listitem> |
| 89 | + </varlistentry> |
| 90 | + |
| 91 | + <varlistentry> |
| 92 | + <term><replaceable class="PARAMETER">column_name</replaceable></term> |
| 93 | + <listitem> |
| 94 | + <para> |
| 95 | + Name of a new or existing column. |
| 96 | + </para> |
| 97 | + </listitem> |
| 98 | + </varlistentry> |
| 99 | + |
| 100 | + <varlistentry> |
| 101 | + <term><replaceable class="PARAMETER">new_column_name</replaceable></term> |
| 102 | + <listitem> |
| 103 | + <para> |
| 104 | + New name for an existing column. |
| 105 | + </para> |
| 106 | + </listitem> |
| 107 | + </varlistentry> |
| 108 | + |
| 109 | + <varlistentry> |
| 110 | + <term><replaceable class="PARAMETER">new_owner</replaceable></term> |
| 111 | + <listitem> |
| 112 | + <para> |
| 113 | + The user name of the new owner of the materialized view. |
| 114 | + </para> |
| 115 | + </listitem> |
| 116 | + </varlistentry> |
| 117 | + |
| 118 | + <varlistentry> |
| 119 | + <term><replaceable class="parameter">new_name</replaceable></term> |
| 120 | + <listitem> |
| 121 | + <para> |
| 122 | + The new name for the materialized view. |
| 123 | + </para> |
| 124 | + </listitem> |
| 125 | + </varlistentry> |
| 126 | + |
| 127 | + <varlistentry> |
| 128 | + <term><replaceable class="parameter">new_schema</replaceable></term> |
| 129 | + <listitem> |
| 130 | + <para> |
| 131 | + The new schema for the materialized view. |
| 132 | + </para> |
| 133 | + </listitem> |
| 134 | + </varlistentry> |
| 135 | + </variablelist> |
| 136 | + </refsect1> |
| 137 | + |
| 138 | + <refsect1> |
| 139 | + <title>Examples</title> |
| 140 | + |
| 141 | + <para> |
| 142 | + To rename the materialized view <literal>foo</literal> to |
| 143 | + <literal>bar</literal>: |
| 144 | +<programlisting> |
| 145 | +ALTER MATERIALIZED VIEW foo RENAME TO bar; |
| 146 | +</programlisting></para> |
| 147 | + </refsect1> |
| 148 | + |
| 149 | + <refsect1> |
| 150 | + <title>Compatibility</title> |
| 151 | + |
| 152 | + <para> |
| 153 | + <command>ALTER MATERIALIZED VIEW</command> is a |
| 154 | + <productname>PostgreSQL</productname> extension. |
| 155 | + </para> |
| 156 | + </refsect1> |
| 157 | + |
| 158 | + <refsect1> |
| 159 | + <title>See Also</title> |
| 160 | + |
| 161 | + <simplelist type="inline"> |
| 162 | + <member><xref linkend="sql-creatematerializedview"></member> |
| 163 | + <member><xref linkend="sql-dropmaterializedview"></member> |
| 164 | + <member><xref linkend="sql-refreshmaterializedview"></member> |
| 165 | + </simplelist> |
| 166 | + </refsect1> |
| 167 | +</refentry> |
0 commit comments