Home Explore Blog CI



postgresql

3rd chunk of `doc/src/sgml/ref/alter_materialized_view.sgml`
411f275f3ed08aae4402b9d4662d5a1a0ac914a758e6d69f0000000100000cb6
  privilege on the materialized view's schema.
   (These restrictions enforce that altering
   the owner doesn't do anything you couldn't do by dropping and recreating the
   materialized view.  However, a superuser can alter ownership of any view
   anyway.)
  </para>

  <para>
   The statement subforms and actions available for
   <command>ALTER MATERIALIZED VIEW</command> are a subset of those available
   for <command>ALTER TABLE</command>, and have the same meaning when used for
   materialized views.  See the descriptions for
   <link linkend="sql-altertable"><command>ALTER TABLE</command></link>
   for details.
  </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 materialized view.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="parameter">column_name</replaceable></term>
     <listitem>
      <para>
       Name of an existing column.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="parameter">extension_name</replaceable></term>
     <listitem>
      <para>
       The name of the extension that the materialized view is to depend on (or no longer
       dependent on, if <literal>NO</literal> is specified).  A materialized view
       that's marked as dependent on an extension is automatically dropped when
       the extension is dropped.
      </para>
     </listitem>
    </varlistentry>

    <varlistentry>
     <term><replaceable class="parameter">new_column_name</replaceable></term>
     <listitem>
      <para>
       New name for an existing column.
      </para>
     </listitem>
    </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">new_owner</replaceable></term>
    <listitem>
     <para>
      The user name of the new owner of the materialized view.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">new_name</replaceable></term>
    <listitem>
     <para>
      The new name for the materialized view.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">new_schema</replaceable></term>
    <listitem>
     <para>
      The new schema for the materialized view.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   To rename the materialized view <literal>foo</literal> to
   <literal>bar</literal>:
<programlisting>
ALTER MATERIALIZED VIEW foo RENAME TO bar;
</programlisting></para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   <command>ALTER MATERIALIZED VIEW</command> is a
   <productname>PostgreSQL</productname> extension.
  </para>
 </refsect1>

 <refsect1>
  <title>See Also</title>

  <simplelist type="inline">
   <member><xref linkend="sql-creatematerializedview"/></member>
   <member><xref linkend="sql-dropmaterializedview"/></member>
   <member><xref linkend="sql-refreshmaterializedview"/></member>
  </simplelist>
 </refsect1>
</refentry>

Title: ALTER MATERIALIZED VIEW - Parameters, Examples, Compatibility, and See Also
Summary
This section details various parameters for the ALTER MATERIALIZED VIEW command, including name, column_name, extension_name, new_column_name, new_owner, new_name, and new_schema. It then provides an example of renaming a materialized view. It also notes that ALTER MATERIALIZED VIEW is a PostgreSQL extension and lists related commands like CREATE MATERIALIZED VIEW, DROP MATERIALIZED VIEW, and REFRESH MATERIALIZED VIEW.