<!--
doc/src/sgml/ref/drop_dynamic_table.sgml
PostgreSQL documentation
-->

<refentry id="sql-dropdynamictable">
 <indexterm zone="sql-dropdynamictable">
  <primary>DROP DYNAMIC TABLE</primary>
 </indexterm>

 <refmeta>
  <refentrytitle>DROP DYNAMIC TABLE</refentrytitle>
  <manvolnum>7</manvolnum>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>

 <refnamediv>
  <refname>DROP DYNAMIC TABLE</refname>
  <refpurpose>remove a dynamic table</refpurpose>
 </refnamediv>

 <refsynopsisdiv>
<synopsis>
DROP DYNAMIC TABLE [ IF EXISTS ] <replaceable class="parameter">name</replaceable> [, ...] [ CASCADE | RESTRICT ]
</synopsis>
 </refsynopsisdiv>

 <refsect1>
  <title>Description</title>

  <para>
   <command>DROP DYNAMIC TABLE</command> drops an existing dynamic
   table. To execute this command you must be the owner of the dynamic
   table. Since every dynamic table has a auto refresh process of pg_task
   job, drop a dynamic table will drop that job too.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
   <varlistentry>
    <term><literal>IF EXISTS</literal></term>
    <listitem>
     <para>
      Do not throw an error if the dynamic table does not exist. A notice
      is issued in this case.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">name</replaceable></term>
    <listitem>
     <para>
      The name (optionally schema-qualified) of the dynamic table to
      remove.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>CASCADE</literal></term>
    <listitem>
     <para>
      Automatically drop objects that depend on the dynamic table (such as
      other materialized views, or regular views or pg_task jobs),
      and in turn all objects that depend on those objects
      (see <xref linkend="ddl-depend"/>).
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><literal>RESTRICT</literal></term>
    <listitem>
     <para>
      Refuse to drop the dynamic table if any objects depend on it.  This
      is the default.
     </para>
    </listitem>
   </varlistentry>
  </variablelist>
 </refsect1>

 <refsect1>
  <title>Examples</title>

  <para>
   This command will remove the dynamic table called
   <literal>order_summary</literal>:
<programlisting>
DROP DYNAMIC TABLE order_summary;
</programlisting></para>
 </refsect1>

 <refsect1>
  <title>Compatibility</title>

  <para>
   <command>DROP DYNAMIC TABLE</command> is a
   <productname>Cloudberry</productname> extension.
  </para>
 </refsect1>

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

  <simplelist type="inline">
   <member><xref linkend="sql-createdynamictable"/></member>
   <member><xref linkend="sql-refreshdynamictable"/></member>
  </simplelist>
 </refsect1>

</refentry>
