Debian Codegraph @

doc/src/sgml/ref/drop_opclass.sgml

raw
1 <!--
2 doc/src/sgml/ref/drop_opclass.sgml
3 PostgreSQL documentation
4 -->
5
6 <refentry id="sql-dropopclass">
7 <indexterm zone="sql-dropopclass">
8 <primary>DROP OPERATOR CLASS</primary>
9 </indexterm>
10
11 <refmeta>
12 <refentrytitle>DROP OPERATOR CLASS</refentrytitle>
13 <manvolnum>7</manvolnum>
14 <refmiscinfo>SQL - Language Statements</refmiscinfo>
15 </refmeta>
16
17 <refnamediv>
18 <refname>DROP OPERATOR CLASS</refname>
19 <refpurpose>remove an operator class</refpurpose>
20 </refnamediv>
21
22 <refsynopsisdiv>
23 <synopsis>
24 DROP OPERATOR CLASS [ IF EXISTS ] <replaceable class="parameter">name</replaceable> USING <replaceable class="parameter">index_method</replaceable> [ CASCADE | RESTRICT ]
25 </synopsis>
26 </refsynopsisdiv>
27
28 <refsect1>
29 <title>Description</title>
30
31 <para>
32 <command>DROP OPERATOR CLASS</command> drops an existing operator class.
33 To execute this command you must be the owner of the operator class.
34 </para>
35
36 <para>
37 <command>DROP OPERATOR CLASS</command> does not drop any of the operators
38 or functions referenced by the class. If there are any indexes depending
39 on the operator class, you will need to specify
40 <literal>CASCADE</literal> for the drop to complete.
41 </para>
42 </refsect1>
43
44 <refsect1>
45 <title>Parameters</title>
46
47 <variablelist>
48
49 <varlistentry>
50 <term><literal>IF EXISTS</literal></term>
51 <listitem>
52 <para>
53 Do not throw an error if the operator class does not exist. A notice is issued
54 in this case.
55 </para>
56 </listitem>
57 </varlistentry>
58
59 <varlistentry>
60 <term><replaceable class="parameter">name</replaceable></term>
61 <listitem>
62 <para>
63 The name (optionally schema-qualified) of an existing operator class.
64 </para>
65 </listitem>
66 </varlistentry>
67
68 <varlistentry>
69 <term><replaceable class="parameter">index_method</replaceable></term>
70 <listitem>
71 <para>
72 The name of the index access method the operator class is for.
73 </para>
74 </listitem>
75 </varlistentry>
76
77 <varlistentry>
78 <term><literal>CASCADE</literal></term>
79 <listitem>
80 <para>
81 Automatically drop objects that depend on the operator class (such as
82 indexes), and in turn all objects that depend on those objects
83 (see <xref linkend="ddl-depend"/>).
84 </para>
85 </listitem>
86 </varlistentry>
87
88 <varlistentry>
89 <term><literal>RESTRICT</literal></term>
90 <listitem>
91 <para>
92 Refuse to drop the operator class if any objects depend on it.
93 This is the default.
94 </para>
95 </listitem>
96 </varlistentry>
97 </variablelist>
98 </refsect1>
99
100 <refsect1>
101 <title>Notes</title>
102
103 <para>
104 <command>DROP OPERATOR CLASS</command> will not drop the operator family
105 containing the class, even if there is nothing else left in the
106 family (in particular, in the case where the family was implicitly
107 created by <command>CREATE OPERATOR CLASS</command>). An empty operator
108 family is harmless, but for the sake of tidiness you might wish to
109 remove the family with <command>DROP OPERATOR FAMILY</command>; or perhaps
110 better, use <command>DROP OPERATOR FAMILY</command> in the first place.
111 </para>
112 </refsect1>
113
114 <refsect1>
115 <title>Examples</title>
116
117 <para>
118 Remove the B-tree operator class <literal>widget_ops</literal>:
119
120 <programlisting>
121 DROP OPERATOR CLASS widget_ops USING btree;
122 </programlisting>
123
124 This command will not succeed if there are any existing indexes
125 that use the operator class. Add <literal>CASCADE</literal> to drop
126 such indexes along with the operator class.
127 </para>
128 </refsect1>
129
130 <refsect1>
131 <title>Compatibility</title>
132
133 <para>
134 There is no <command>DROP OPERATOR CLASS</command> statement in the
135 SQL standard.
136 </para>
137 </refsect1>
138
139 <refsect1>
140 <title>See Also</title>
141
142 <simplelist type="inline">
143 <member><xref linkend="sql-alteropclass"/></member>
144 <member><xref linkend="sql-createopclass"/></member>
145 <member><xref linkend="sql-dropopfamily"/></member>
146 </simplelist>
147 </refsect1>
148
149 </refentry>