<!--
$Header: /cvsroot/pgsql/doc/src/sgml/ref/drop_rule.sgml,v 1.16 2002/07/12 18:43:13 tgl Exp $
PostgreSQL documentation
-->

<refentry id="SQL-DROPRULE">
 <refmeta>
  <refentrytitle id="SQL-DROPRULE-TITLE">DROP RULE</refentrytitle>
  <refmiscinfo>SQL - Language Statements</refmiscinfo>
 </refmeta>
 <refnamediv>
  <refname>
   DROP RULE
  </refname>
  <refpurpose>
   remove a rewrite rule
  </refpurpose>
 </refnamediv>
 <refsynopsisdiv>
  <refsynopsisdivinfo>
   <date>1998-09-22</date>
  </refsynopsisdivinfo>
  <synopsis>
DROP RULE <replaceable class="PARAMETER">name</replaceable> ON <replaceable class="PARAMETER">relation</replaceable> [ CASCADE | RESTRICT ]
  </synopsis>
  
  <refsect2 id="R2-SQL-DROPRULE-1">
   <refsect2info>
    <date>1998-09-22</date>
   </refsect2info>
   <title>
    Inputs
   </title>
   <para>
    <variablelist>
     <varlistentry>
      <term><replaceable class="parameter">name</replaceable></term>
      <listitem>
       <para>
	The name of an existing rule to drop.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term><replaceable class="parameter">relation</replaceable></term>
      <listitem>
       <para>
	The name (optionally schema-qualified) of the relation the rule
	applies to.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term>CASCADE</term>
      <listitem>
       <para>
        Automatically drop objects that depend on the rule.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term>RESTRICT</term>
      <listitem>
       <para>
        Refuse to drop the rule if there are any dependent objects.
	This is the default.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>

   </para>
  </refsect2>

  <refsect2 id="R2-SQL-DROPRULE-2">
   <refsect2info>
    <date>1998-09-22</date>
   </refsect2info>
   <title>
    Outputs
   </title>
   <para>
    <variablelist>
     <varlistentry>
      <term><computeroutput>
DROP RULE
       </computeroutput></term>
      <listitem>
       <para>
	Message returned if successful.
       </para>
      </listitem>
     </varlistentry>
     <varlistentry>
      <term><computeroutput>
ERROR:  Rule "<replaceable class="parameter">name</replaceable>" not found
       </computeroutput></term>
      <listitem>
       <para>
	This message occurs if the specified rule does not exist.
       </para>
      </listitem>
     </varlistentry>
    </variablelist>
   </para>
  </refsect2>
 </refsynopsisdiv>

 <refsect1 id="R1-SQL-DROPRULE-1">
  <refsect1info>
   <date>1998-09-22</date>
  </refsect1info>
  <title>
   Description
  </title>
  <para>
   <command>DROP RULE</command> drops a rule from the specified
   <productname>PostgreSQL</productname> rule
   system. <productname>PostgreSQL</productname>
   will immediately cease enforcing it and
   will purge its definition from the system catalogs.
  </para>

  <refsect2 id="R2-SQL-DROPRULE-3">
   <refsect2info>
    <date>1998-09-22</date>
   </refsect2info>
   <title>
    Notes
   </title>
   <para>
    The <command>DROP RULE</command> statement is a
    <productname>PostgreSQL</productname>
    language extension.
   </para>

   <para>
    Refer to <command>CREATE RULE</command> for
    information on how to create rules.
   </para>
  </refsect2>
 </refsect1>
  
 <refsect1 id="R1-SQL-DROPRULE-2">
  <title>
   Usage
  </title>
  <para>
   To drop the rewrite rule <literal>newrule</literal>:

   <programlisting>
DROP RULE newrule ON mytable;
   </programlisting>
  </para>
 </refsect1>
 
 <refsect1 id="R1-SQL-DROPRULE-3">
  <title>
   Compatibility
  </title>

  <refsect2 id="R2-SQL-DROPRULE-5">
   <refsect2info>
    <date>1998-09-22</date>
   </refsect2info>
   <title>
    SQL92
   </title>
   <para>
    There is no <command>DROP RULE</command> in SQL92.
   </para>
  </refsect2>
 </refsect1>
</refentry>

<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:nil
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../reference.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:"/usr/lib/sgml/catalog"
sgml-local-ecat-files:nil
End:
-->
