<refsect1>
<title>Notes</title>
<para>
Notice that the <literal>DROP</literal> syntax only specifies the <quote>slot</quote>
in the operator family, by strategy or support number and input data
type(s). The name of the operator or function occupying the slot is not
mentioned. Also, for <literal>DROP FUNCTION</literal> the type(s) to specify
are the input data type(s) the function is intended to support; for
GiST, SP-GiST and GIN indexes this might have nothing to do with the actual
input argument types of the function.
</para>
<para>
Because the index machinery does not check access permissions on functions
before using them, including a function or operator in an operator family
is tantamount to granting public execute permission on it. This is usually
not an issue for the sorts of functions that are useful in an operator
family.
</para>
<para>
The operators should not be defined by SQL functions. An SQL function
is likely to be inlined into the calling query, which will prevent
the optimizer from recognizing that the query matches an index.
</para>
</refsect1>
<refsect1>
<title>Examples</title>
<para>
The following example command adds cross-data-type operators and
support functions to an operator family that already contains B-tree
operator classes for data types <type>int4</type> and <type>int2</type>.
</para>
<programlisting>
ALTER OPERATOR FAMILY integer_ops USING btree ADD
-- int4 vs int2
OPERATOR 1 < (int4, int2) ,
OPERATOR 2 <= (int4, int2) ,
OPERATOR 3 = (int4, int2) ,
OPERATOR 4 >= (int4, int2) ,
OPERATOR 5 > (int4, int2) ,
FUNCTION 1 btint42cmp(int4, int2) ,
-- int2 vs int4
OPERATOR 1 < (int2, int4) ,
OPERATOR 2 <= (int2, int4) ,
OPERATOR 3 = (int2, int4) ,
OPERATOR 4 >= (int2, int4) ,
OPERATOR 5 > (int2, int4) ,
FUNCTION 1 btint24cmp(int2, int4) ;
</programlisting>
<para>
To remove these entries again:
</para>
<programlisting>
ALTER OPERATOR FAMILY integer_ops USING btree DROP
-- int4 vs int2
OPERATOR 1 (int4, int2) ,
OPERATOR 2 (int4, int2) ,
OPERATOR 3 (int4, int2) ,
OPERATOR 4 (int4, int2) ,
OPERATOR 5 (int4, int2) ,
FUNCTION 1 (int4, int2) ,
-- int2 vs int4
OPERATOR 1 (int2, int4) ,
OPERATOR 2 (int2, int4) ,
OPERATOR 3 (int2, int4) ,
OPERATOR 4 (int2, int4) ,
OPERATOR 5 (int2, int4) ,
FUNCTION 1 (int2, int4) ;
</programlisting>
</refsect1>
<refsect1>
<title>Compatibility</title>
<para>
There is no <command>ALTER OPERATOR FAMILY</command> statement in
the SQL standard.
</para>
</refsect1>
<refsect1>
<title>See Also</title>
<simplelist type="inline">
<member><xref linkend="sql-createopfamily"/></member>
<member><xref linkend="sql-dropopfamily"/></member>
<member><xref linkend="sql-createopclass"/></member>
<member><xref linkend="sql-alteropclass"/></member>
<member><xref linkend="sql-dropopclass"/></member>
</simplelist>
</refsect1>
</refentry>