Server IP : 103.119.228.120 / Your IP : 3.137.169.56 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/ssl/local/ssl/local/ssl/share/doc/postgresql-9.2.24/html/ |
Upload File : |
<!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 9.2.24 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="2017-11-06T22:43:11"></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" ><A HREF="index.html" >PostgreSQL 9.2.24 Documentation</A ></TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A TITLE="ALTER OPERATOR CLASS" HREF="sql-alteropclass.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="10%" ALIGN="left" VALIGN="top" ><A HREF="sql-commands.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="60%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="20%" ALIGN="right" VALIGN="top" ><A TITLE="ALTER ROLE" 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="AEN64164" ></A ><H2 >Name</H2 >ALTER OPERATOR FAMILY -- change the definition of an operator family</DIV ><DIV CLASS="REFSYNOPSISDIV" ><A NAME="AEN64169" ></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 > ) [ FOR SEARCH | FOR ORDER BY <TT CLASS="REPLACEABLE" ><I >sort_family_name</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 > ] ) ] <TT CLASS="REPLACEABLE" ><I >function_name</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 >new_name</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 >new_owner</I ></TT > ALTER OPERATOR FAMILY <TT CLASS="REPLACEABLE" ><I >name</I ></TT > USING <TT CLASS="REPLACEABLE" ><I >index_method</I ></TT > SET SCHEMA <TT CLASS="REPLACEABLE" ><I >new_schema</I ></TT ></PRE ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN64200" ></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" >CREATE OPERATOR CLASS</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 35.14</A > for further information. </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN64215" ></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 comparison functions and hash functions 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 B-tree sort support 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. </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="REPLACEABLE" ><I >sort_family_name</I ></TT ></DT ><DD ><P > The name (optionally schema-qualified) of an existing <TT CLASS="LITERAL" >btree</TT > operator family that describes the sort ordering associated with an ordering operator. </P ><P > If neither <TT CLASS="LITERAL" >FOR SEARCH</TT > nor <TT CLASS="LITERAL" >FOR ORDER BY</TT > is specified, <TT CLASS="LITERAL" >FOR SEARCH</TT > is the default. </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 >function_name</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_type</I ></TT ></DT ><DD ><P > The parameter data type(s) of the function. </P ></DD ><DT ><TT CLASS="REPLACEABLE" ><I >new_name</I ></TT ></DT ><DD ><P > The new name of the operator family. </P ></DD ><DT ><TT CLASS="REPLACEABLE" ><I >new_owner</I ></TT ></DT ><DD ><P > The new owner of the operator family. </P ></DD ><DT ><TT CLASS="REPLACEABLE" ><I >new_schema</I ></TT ></DT ><DD ><P > The new schema for 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="AEN64294" ></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 GiST, SP-GiST and GIN 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 ><P > Before <SPAN CLASS="PRODUCTNAME" >PostgreSQL</SPAN > 8.4, the <TT CLASS="LITERAL" >OPERATOR</TT > clause could include a <TT CLASS="LITERAL" >RECHECK</TT > option. This is no longer supported because whether an index operator is <SPAN CLASS="QUOTE" >"lossy"</SPAN > is now determined on-the-fly at run time. This allows efficient handling of cases where an operator might or might not be lossy. </P ></DIV ><DIV CLASS="REFSECT1" ><A NAME="AEN64307" ></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 < (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) ;</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="AEN64315" ></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="AEN64319" ></A ><H2 >See Also</H2 ><A HREF="sql-createopfamily.html" >CREATE OPERATOR FAMILY</A >, <A HREF="sql-dropopfamily.html" >DROP OPERATOR FAMILY</A >, <A HREF="sql-createopclass.html" >CREATE OPERATOR CLASS</A >, <A HREF="sql-alteropclass.html" >ALTER OPERATOR CLASS</A >, <A HREF="sql-dropopclass.html" >DROP OPERATOR CLASS</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 >