Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 415a9558429d583fc9b2617edd1d24a6 > files > 715

postgresql8.3-docs-8.3.8-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<HTML
><HEAD
><TITLE
>ALTER OPERATOR FAMILY</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
REV="MADE"
HREF="mailto:pgsql-docs@postgresql.org"><LINK
REL="HOME"
TITLE="PostgreSQL 8.3.8 Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SQL Commands"
HREF="sql-commands.html"><LINK
REL="PREVIOUS"
TITLE="ALTER OPERATOR CLASS"
HREF="sql-alteropclass.html"><LINK
REL="NEXT"
TITLE="ALTER ROLE"
HREF="sql-alterrole.html"><LINK
REL="STYLESHEET"
TYPE="text/css"
HREF="stylesheet.css"><META
HTTP-EQUIV="Content-Type"
CONTENT="text/html; charset=ISO-8859-1"><META
NAME="creation"
CONTENT="2009-09-04T05:13:45"></HEAD
><BODY
CLASS="REFENTRY"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="5"
ALIGN="center"
VALIGN="bottom"
>PostgreSQL 8.3.8 Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="sql-alteropclass.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="top"
><A
HREF="sql-alteropclass.html"
>Fast Backward</A
></TD
><TD
WIDTH="60%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="sql-alterrole.html"
>Fast Forward</A
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="top"
><A
HREF="sql-alterrole.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><H1
><A
NAME="SQL-ALTEROPFAMILY"
></A
>ALTER OPERATOR FAMILY</H1
><DIV
CLASS="REFNAMEDIV"
><A
NAME="AEN48938"
></A
><H2
>Name</H2
>ALTER OPERATOR FAMILY&nbsp;--&nbsp;change the definition of an operator family</DIV
><A
NAME="AEN48941"
></A
><DIV
CLASS="REFSYNOPSISDIV"
><A
NAME="AEN48943"
></A
><H2
>Synopsis</H2
><PRE
CLASS="SYNOPSIS"
>ALTER OPERATOR FAMILY <TT
CLASS="REPLACEABLE"
><I
>name</I
></TT
> USING <TT
CLASS="REPLACEABLE"
><I
>index_method</I
></TT
> ADD
  {  OPERATOR <TT
CLASS="REPLACEABLE"
><I
>strategy_number</I
></TT
> <TT
CLASS="REPLACEABLE"
><I
>operator_name</I
></TT
> ( <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
>, <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
> ) [ RECHECK ]
   | FUNCTION <TT
CLASS="REPLACEABLE"
><I
>support_number</I
></TT
> [ ( <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
> [ , <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
> ] ) ] <TT
CLASS="REPLACEABLE"
><I
>funcname</I
></TT
> ( <TT
CLASS="REPLACEABLE"
><I
>argument_type</I
></TT
> [, ...] )
  } [, ... ]
ALTER OPERATOR FAMILY <TT
CLASS="REPLACEABLE"
><I
>name</I
></TT
> USING <TT
CLASS="REPLACEABLE"
><I
>index_method</I
></TT
> DROP
  {  OPERATOR <TT
CLASS="REPLACEABLE"
><I
>strategy_number</I
></TT
> ( <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
> [ , <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
> ] )
   | FUNCTION <TT
CLASS="REPLACEABLE"
><I
>support_number</I
></TT
> ( <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
> [ , <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
> ] )
  } [, ... ]
ALTER OPERATOR FAMILY <TT
CLASS="REPLACEABLE"
><I
>name</I
></TT
> USING <TT
CLASS="REPLACEABLE"
><I
>index_method</I
></TT
> RENAME TO <TT
CLASS="REPLACEABLE"
><I
>newname</I
></TT
>
ALTER OPERATOR FAMILY <TT
CLASS="REPLACEABLE"
><I
>name</I
></TT
> USING <TT
CLASS="REPLACEABLE"
><I
>index_method</I
></TT
> OWNER TO <TT
CLASS="REPLACEABLE"
><I
>newowner</I
></TT
></PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN48970"
></A
><H2
>Description</H2
><P
>   <TT
CLASS="COMMAND"
>ALTER OPERATOR FAMILY</TT
> changes the definition of
   an operator family.  You can add operators and support functions
   to the family, remove them from the family,
   or change the family's name or owner.
  </P
><P
>   When operators and support functions are added to a family with
   <TT
CLASS="COMMAND"
>ALTER OPERATOR FAMILY</TT
>, they are not part of any
   specific operator class within the family, but are just <SPAN
CLASS="QUOTE"
>"loose"</SPAN
>
   within the 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 <A
HREF="sql-createopclass.html"
><I
>CREATE OPERATOR CLASS</I
></A
>.)
   <SPAN
CLASS="PRODUCTNAME"
>PostgreSQL</SPAN
> 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.
  </P
><P
>   You must be a superuser to use <TT
CLASS="COMMAND"
>ALTER OPERATOR FAMILY</TT
>.
   (This restriction is made because an erroneous operator family definition
   could confuse or even crash the server.)
  </P
><P
>   <TT
CLASS="COMMAND"
>ALTER OPERATOR FAMILY</TT
> 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.
  </P
><P
>   Refer to <A
HREF="xindex.html"
>Section 34.14</A
> for further information.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN48985"
></A
><H2
>Parameters</H2
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
><TT
CLASS="REPLACEABLE"
><I
>name</I
></TT
></DT
><DD
><P
>      The name (optionally schema-qualified) of an existing operator
      family.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>index_method</I
></TT
></DT
><DD
><P
>      The name of the index method this operator family is for.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>strategy_number</I
></TT
></DT
><DD
><P
>      The index method's strategy number for an operator
      associated with the operator family.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>operator_name</I
></TT
></DT
><DD
><P
>      The name (optionally schema-qualified) of an operator associated
      with the operator family.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
></DT
><DD
><P
>      In an <TT
CLASS="LITERAL"
>OPERATOR</TT
> clause,
      the operand data type(s) of the operator, or <TT
CLASS="LITERAL"
>NONE</TT
> to
      signify a left-unary or right-unary operator.  Unlike the comparable
      syntax in <TT
CLASS="COMMAND"
>CREATE OPERATOR CLASS</TT
>, the operand data types
      must always be specified.
     </P
><P
>      In an <TT
CLASS="LITERAL"
>ADD FUNCTION</TT
> 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 and hash indexes
      it is not necessary to specify <TT
CLASS="REPLACEABLE"
><I
>op_type</I
></TT
> since the function's input
      data type(s) are always the correct ones to use.  For GIN and GiST
      indexes it is necessary to specify the input data type the function
      is to be used with.
     </P
><P
>      In a <TT
CLASS="LITERAL"
>DROP FUNCTION</TT
> clause, the operand data type(s) the
      function is intended to support must be specified.
     </P
></DD
><DT
><TT
CLASS="LITERAL"
>RECHECK</TT
></DT
><DD
><P
>      If present, the index is <SPAN
CLASS="QUOTE"
>"lossy"</SPAN
> for this operator, and
      so the rows retrieved using the index must be rechecked to
      verify that they actually satisfy the qualification clause
      involving this operator.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>support_number</I
></TT
></DT
><DD
><P
>      The index method's support procedure number for a
      function associated with the operator family.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>funcname</I
></TT
></DT
><DD
><P
>      The name (optionally schema-qualified) of a function that is an
      index method support procedure for the operator family.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>argument_types</I
></TT
></DT
><DD
><P
>      The parameter data type(s) of the function.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>newname</I
></TT
></DT
><DD
><P
>      The new name of the operator family.
     </P
></DD
><DT
><TT
CLASS="REPLACEABLE"
><I
>newowner</I
></TT
></DT
><DD
><P
>      The new owner of the operator family.
     </P
></DD
></DL
></DIV
><P
>   The <TT
CLASS="LITERAL"
>OPERATOR</TT
> and <TT
CLASS="LITERAL"
>FUNCTION</TT
>
   clauses can appear in any order.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN49055"
></A
><H2
>Notes</H2
><P
>   Notice that the <TT
CLASS="LITERAL"
>DROP</TT
> syntax only specifies the <SPAN
CLASS="QUOTE"
>"slot"</SPAN
>
   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 <TT
CLASS="LITERAL"
>DROP FUNCTION</TT
> the type(s) to specify
   are the input data type(s) the function is intended to support; for
   GIN and GiST indexes this might have nothing to do with the actual input
   argument types of the function.
  </P
><P
>   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.
  </P
><P
>   The operators should not be defined by SQL functions.  A SQL function
   is likely to be inlined into the calling query, which will prevent
   the optimizer from recognizing that the query matches an index.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN49063"
></A
><H2
>Examples</H2
><P
>   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 <TT
CLASS="TYPE"
>int4</TT
> and <TT
CLASS="TYPE"
>int2</TT
>.
  </P
><PRE
CLASS="PROGRAMLISTING"
>ALTER OPERATOR FAMILY integer_ops USING btree ADD

  -- int4 vs int2
  OPERATOR 1 &lt; (int4, int2) ,
  OPERATOR 2 &lt;= (int4, int2) ,
  OPERATOR 3 = (int4, int2) ,
  OPERATOR 4 &gt;= (int4, int2) ,
  OPERATOR 5 &gt; (int4, int2) ,
  FUNCTION 1 btint42cmp(int4, int2) ,

  -- int2 vs int4
  OPERATOR 1 &lt; (int2, int4) ,
  OPERATOR 2 &lt;= (int2, int4) ,
  OPERATOR 3 = (int2, int4) ,
  OPERATOR 4 &gt;= (int2, int4) ,
  OPERATOR 5 &gt; (int2, int4) ,
  FUNCTION 1 btint24cmp(int2, int4) ;</PRE
><P
>   To remove these entries again:
  </P
><PRE
CLASS="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) ;</PRE
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN49071"
></A
><H2
>Compatibility</H2
><P
>   There is no <TT
CLASS="COMMAND"
>ALTER OPERATOR FAMILY</TT
> statement in
   the SQL standard.
  </P
></DIV
><DIV
CLASS="REFSECT1"
><A
NAME="AEN49075"
></A
><H2
>See Also</H2
><A
HREF="sql-createopfamily.html"
><I
>CREATE OPERATOR FAMILY</I
></A
>, <A
HREF="sql-dropopfamily.html"
><I
>DROP OPERATOR FAMILY</I
></A
>, <A
HREF="sql-createopclass.html"
><I
>CREATE OPERATOR CLASS</I
></A
>, <A
HREF="sql-alteropclass.html"
><I
>ALTER OPERATOR CLASS</I
></A
>, <A
HREF="sql-dropopclass.html"
><I
>DROP OPERATOR CLASS</I
></A
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sql-alteropclass.html"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sql-alterrole.html"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>ALTER OPERATOR CLASS</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="sql-commands.html"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>ALTER ROLE</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>