Home Explore Blog CI



postgresql

2nd chunk of `doc/src/sgml/ref/alter_opfamily.sgml`
fd79addc4ae1d924304a5f2aebafd51752eed2c8f0d225100000000100000fa1
 family.  This indicates that these operators and functions
   are compatible with the family's semantics, but are not required for
   correct functioning of any specific index.  (Operators and functions
   that are so required should be declared as part of an operator class,
   instead; see <xref linkend="sql-createopclass"/>.)
   <productname>PostgreSQL</productname> will allow loose members of a
   family to be dropped from the family at any time, but members of an
   operator class cannot be dropped without dropping the whole class and
   any indexes that depend on it.
   Typically, single-data-type operators
   and functions are part of operator classes because they are needed to
   support an index on that specific data type, while cross-data-type
   operators and functions are made loose members of the family.
  </para>

  <para>
   You must be a superuser to use <command>ALTER OPERATOR FAMILY</command>.
   (This restriction is made because an erroneous operator family definition
   could confuse or even crash the server.)
  </para>

  <para>
   <command>ALTER OPERATOR FAMILY</command> does not presently check
   whether the operator family definition includes all the operators and
   functions required by the index method, nor whether the operators and
   functions form a self-consistent set.  It is the user's
   responsibility to define a valid operator family.
  </para>

  <para>
   Refer to <xref linkend="xindex"/> for further information.
  </para>
 </refsect1>

 <refsect1>
  <title>Parameters</title>

  <variablelist>
   <varlistentry>
    <term><replaceable class="parameter">name</replaceable></term>
    <listitem>
     <para>
      The name (optionally schema-qualified) of an existing operator
      family.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">index_method</replaceable></term>
    <listitem>
     <para>
      The name of the index method this operator family is for.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">strategy_number</replaceable></term>
    <listitem>
     <para>
      The index method's strategy number for an operator
      associated with the operator family.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">operator_name</replaceable></term>
    <listitem>
     <para>
      The name (optionally schema-qualified) of an operator associated
      with the operator family.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">op_type</replaceable></term>
    <listitem>
     <para>
      In an <literal>OPERATOR</literal> clause,
      the operand data type(s) of the operator, or <literal>NONE</literal> to
      signify a prefix operator.  Unlike the comparable
      syntax in <command>CREATE OPERATOR CLASS</command>, the operand data types
      must always be specified.
     </para>

     <para>
      In an <literal>ADD FUNCTION</literal> clause, the operand data type(s) the
      function is intended to support, if different from
      the input data type(s) of the function.  For B-tree comparison functions
      and hash functions it is not necessary to specify <replaceable
      class="parameter">op_type</replaceable> since the function's input
      data type(s) are always the correct ones to use.  For B-tree sort
      support functions, B-Tree equal image functions, and all
      functions in GiST, SP-GiST and GIN operator classes, it is
      necessary to specify the operand data type(s) the function is to
      be used with.
     </para>

     <para>
      In a <literal>DROP FUNCTION</literal> clause, the operand data type(s) the
      function is intended to support must be specified.
     </para>
    </listitem>
   </varlistentry>

   <varlistentry>
    <term><replaceable class="parameter">sort_family_name</replaceable></term>
    <listitem>
     <para>

Title: ALTER OPERATOR FAMILY - Restrictions and Parameters
Summary
Using `ALTER OPERATOR FAMILY` requires superuser privileges due to the potential for server instability from erroneous definitions. The command does not validate the completeness or consistency of the operator family definition, leaving this responsibility to the user. Key parameters include: the name of the operator family and index method, strategy number and name of associated operators, and operand data types (`op_type`). When adding or dropping functions, the operand data types that the function is intended to support must be specified.