1<!-- 2doc/src/sgml/ref/drop_sequence.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="SQL-DROPSEQUENCE"> 7 <indexterm zone="sql-dropsequence"> 8 <primary>DROP SEQUENCE</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>DROP SEQUENCE</refentrytitle> 13 <manvolnum>7</manvolnum> 14 <refmiscinfo>SQL - Language Statements</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>DROP SEQUENCE</refname> 19 <refpurpose>remove a sequence</refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23<synopsis> 24DROP SEQUENCE [ IF EXISTS ] <replaceable class="PARAMETER">name</replaceable> [, ...] [ CASCADE | RESTRICT ] 25</synopsis> 26 </refsynopsisdiv> 27 28 <refsect1> 29 <title>Description</title> 30 31 <para> 32 <command>DROP SEQUENCE</command> removes sequence number 33 generators. A sequence can only be dropped by its owner or a superuser. 34 </para> 35 </refsect1> 36 37 <refsect1> 38 <title>Parameters</title> 39 40 <variablelist> 41 <varlistentry> 42 <term><literal>IF EXISTS</literal></term> 43 <listitem> 44 <para> 45 Do not throw an error if the sequence does not exist. A notice is issued 46 in this case. 47 </para> 48 </listitem> 49 </varlistentry> 50 51 <varlistentry> 52 <term><replaceable class="PARAMETER">name</replaceable></term> 53 <listitem> 54 <para> 55 The name (optionally schema-qualified) of a sequence. 56 </para> 57 </listitem> 58 </varlistentry> 59 60 <varlistentry> 61 <term><literal>CASCADE</literal></term> 62 <listitem> 63 <para> 64 Automatically drop objects that depend on the sequence, 65 and in turn all objects that depend on those objects 66 (see <xref linkend="ddl-depend">). 67 </para> 68 </listitem> 69 </varlistentry> 70 71 <varlistentry> 72 <term><literal>RESTRICT</literal></term> 73 <listitem> 74 <para> 75 Refuse to drop the sequence if any objects depend on it. This 76 is the default. 77 </para> 78 </listitem> 79 </varlistentry> 80 </variablelist> 81 </refsect1> 82 83 <refsect1> 84 <title>Examples</title> 85 86 <para> 87 To remove the sequence <literal>serial</literal>: 88 89<programlisting> 90DROP SEQUENCE serial; 91</programlisting></para> 92 </refsect1> 93 94 <refsect1> 95 <title>Compatibility</title> 96 97 <para> 98 <command>DROP SEQUENCE</command> conforms to the <acronym>SQL</acronym> 99 standard, except that the standard only allows one 100 sequence to be dropped per command, and apart from the 101 <literal>IF EXISTS</> option, which is a <productname>PostgreSQL</> 102 extension. 103 </para> 104 </refsect1> 105 106 <refsect1> 107 <title>See Also</title> 108 109 <simplelist type="inline"> 110 <member><xref linkend="sql-createsequence"></member> 111 <member><xref linkend="sql-altersequence"></member> 112 </simplelist> 113 </refsect1> 114 115</refentry> 116