1<!-- 2doc/src/sgml/ref/create_opfamily.sgml 3PostgreSQL documentation 4--> 5 6<refentry id="sql-createopfamily"> 7 <indexterm zone="sql-createopfamily"> 8 <primary>CREATE OPERATOR FAMILY</primary> 9 </indexterm> 10 11 <refmeta> 12 <refentrytitle>CREATE OPERATOR FAMILY</refentrytitle> 13 <manvolnum>7</manvolnum> 14 <refmiscinfo>SQL - Language Statements</refmiscinfo> 15 </refmeta> 16 17 <refnamediv> 18 <refname>CREATE OPERATOR FAMILY</refname> 19 <refpurpose>define a new operator family</refpurpose> 20 </refnamediv> 21 22 <refsynopsisdiv> 23<synopsis> 24CREATE OPERATOR FAMILY <replaceable class="parameter">name</replaceable> USING <replaceable class="parameter">index_method</replaceable> 25</synopsis> 26 </refsynopsisdiv> 27 28 <refsect1> 29 <title>Description</title> 30 31 <para> 32 <command>CREATE OPERATOR FAMILY</command> creates a new operator family. 33 An operator family defines a collection of related operator classes, 34 and perhaps some additional operators and support functions that are 35 compatible with these operator classes but not essential for the 36 functioning of any individual index. (Operators and functions that 37 are essential to indexes should be grouped within the relevant operator 38 class, rather than being <quote>loose</quote> in the operator family. 39 Typically, single-data-type operators are bound to operator classes, 40 while cross-data-type operators can be loose in an operator family 41 containing operator classes for both data types.) 42 </para> 43 44 <para> 45 The new operator family is initially empty. It should be populated 46 by issuing subsequent <command>CREATE OPERATOR CLASS</command> commands 47 to add contained operator classes, and optionally 48 <command>ALTER OPERATOR FAMILY</command> commands to add <quote>loose</quote> 49 operators and their corresponding support functions. 50 </para> 51 52 <para> 53 If a schema name is given then the operator family is created in the 54 specified schema. Otherwise it is created in the current schema. 55 Two operator families in the same schema can have the same name only if they 56 are for different index methods. 57 </para> 58 59 <para> 60 The user who defines an operator family becomes its owner. Presently, 61 the creating user must be a superuser. (This restriction is made because 62 an erroneous operator family definition could confuse or even crash the 63 server.) 64 </para> 65 66 <para> 67 Refer to <xref linkend="xindex"/> for further information. 68 </para> 69 </refsect1> 70 71 <refsect1> 72 <title>Parameters</title> 73 74 <variablelist> 75 <varlistentry> 76 <term><replaceable class="parameter">name</replaceable></term> 77 <listitem> 78 <para> 79 The name of the operator family to be created. The name can be 80 schema-qualified. 81 </para> 82 </listitem> 83 </varlistentry> 84 85 <varlistentry> 86 <term><replaceable class="parameter">index_method</replaceable></term> 87 <listitem> 88 <para> 89 The name of the index method this operator family is for. 90 </para> 91 </listitem> 92 </varlistentry> 93 </variablelist> 94 </refsect1> 95 96 <refsect1> 97 <title>Compatibility</title> 98 99 <para> 100 <command>CREATE OPERATOR FAMILY</command> is a 101 <productname>PostgreSQL</productname> extension. There is no 102 <command>CREATE OPERATOR FAMILY</command> statement in the SQL 103 standard. 104 </para> 105 </refsect1> 106 107 <refsect1> 108 <title>See Also</title> 109 110 <simplelist type="inline"> 111 <member><xref linkend="sql-alteropfamily"/></member> 112 <member><xref linkend="sql-dropopfamily"/></member> 113 <member><xref linkend="sql-createopclass"/></member> 114 <member><xref linkend="sql-alteropclass"/></member> 115 <member><xref linkend="sql-dropopclass"/></member> 116 </simplelist> 117 </refsect1> 118</refentry> 119