1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
5
>CREATE OPERATOR</TITLE
8
CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK
10
HREF="mailto:pgsql-docs@postgresql.org"><LINK
12
TITLE="PostgreSQL 9.1beta1 Documentation"
13
HREF="index.html"><LINK
16
HREF="sql-commands.html"><LINK
18
TITLE="CREATE LANGUAGE"
19
HREF="sql-createlanguage.html"><LINK
21
TITLE="CREATE OPERATOR CLASS"
22
HREF="sql-createopclass.html"><LINK
25
HREF="stylesheet.css"><META
26
HTTP-EQUIV="Content-Type"
27
CONTENT="text/html; charset=ISO-8859-1"><META
29
CONTENT="2011-04-27T21:20:33"></HEAD
35
SUMMARY="Header navigation table"
47
>PostgreSQL 9.1beta1 Documentation</A
56
TITLE="CREATE LANGUAGE"
57
HREF="sql-createlanguage.html"
66
TITLE="CREATE LANGUAGE"
67
HREF="sql-createlanguage.html"
80
TITLE="CREATE OPERATOR CLASS"
81
HREF="sql-createopclass.html"
89
TITLE="CREATE OPERATOR CLASS"
90
HREF="sql-createopclass.html"
101
NAME="SQL-CREATEOPERATOR"
111
>CREATE OPERATOR -- define a new operator</DIV
113
CLASS="REFSYNOPSISDIV"
138
> ] [, RIGHTARG = <TT
166
[, HASHES ] [, MERGES ]
180
> defines a new operator,
187
defines an operator becomes its owner. If a schema name is given
188
then the operator is created in the specified schema. Otherwise it
189
is created in the current schema.
192
> The operator name is a sequence of up to <TT
196
(63 by default) characters from the following list:
198
CLASS="LITERALLAYOUT"
199
>+ - * / < > = ~ ! @ # % ^ & | ` ?</P
202
There are a few restrictions on your choice of name:
214
> cannot appear anywhere in an operator name,
215
since they will be taken as the start of a comment.
220
> A multicharacter operator name cannot end in <TT
228
unless the name also contains at least one of these characters:
230
CLASS="LITERALLAYOUT"
231
>~ ! @ # % ^ & | ` ?</P
236
> is an allowed operator name,
241
This restriction allows <SPAN
245
parse SQL-compliant commands without requiring spaces between tokens.
253
> as an operator name is deprecated. It may
254
be disallowed altogether in a future release.
268
> on input, so these two names are always
272
> At least one of <TT
278
> must be defined. For
279
binary operators, both must be defined. For right unary
283
> should be defined, while for left
284
unary operators only <TT
296
procedure must have been previously defined using <TT
300
> and must be defined to accept the correct number
301
of arguments (either one or two) of the indicated types.
304
> The other clauses specify optional operator optimization clauses.
305
Their meaning is detailed in <A
306
HREF="xoper-optimization.html"
332
> The name of the operator to be defined. See above for allowable
333
characters. The name can be schema-qualified, for example
336
>CREATE OPERATOR myschema.+ (...)</TT
338
the operator is created in the current schema. Two operators
339
in the same schema can have the same name if they operate on
340
different data types. This is called
356
> The function used to implement this operator.
368
> The data type of the operator's left operand, if any.
369
This option would be omitted for a left-unary operator.
381
> The data type of the operator's right operand, if any.
382
This option would be omitted for a right-unary operator.
394
> The commutator of this operator.
406
> The negator of this operator.
418
> The restriction selectivity estimator function for this operator.
430
> The join selectivity estimator function for this operator.
440
> Indicates this operator can support a hash join.
450
> Indicates this operator can support a merge join.
456
> To give a schema-qualified operator name in <TT
461
> or the other optional
462
arguments, use the <TT
465
> syntax, for example:
467
CLASS="PROGRAMLISTING"
468
>COMMUTATOR = OPERATOR(myschema.===) ,</PRE
483
> for further information.
486
> It is not possible to specify an operator's lexical precedence in
490
>, because the parser's precedence behavior
491
is hard-wired. See <A
492
HREF="sql-syntax-lexical.html#SQL-PRECEDENCE"
494
> for precedence details.
497
> The obsolete options <TT
510
> were formerly used to
511
specify the names of sort operators associated with a merge-joinable
512
operator. This is no longer necessary, since information about
513
associated operators is found by looking at B-tree operator families
514
instead. If one of these options is given, it is ignored except
515
for implicitly setting <TT
522
HREF="sql-dropoperator.html"
524
> to delete user-defined operators
525
from a database. Use <A
526
HREF="sql-alteroperator.html"
528
> to modify operators in a
540
> The following command defines a new operator, area-equality, for
546
CLASS="PROGRAMLISTING"
547
>CREATE OPERATOR === (
550
PROCEDURE = area_equal_procedure,
553
RESTRICT = area_restriction_procedure,
554
JOIN = area_join_procedure,
575
> extension. There are no
576
provisions for user-defined operators in the SQL standard.
587
HREF="sql-alteroperator.html"
590
HREF="sql-createopclass.html"
591
>CREATE OPERATOR CLASS</A
593
HREF="sql-dropoperator.html"
601
SUMMARY="Footer navigation table"
612
HREF="sql-createlanguage.html"
630
HREF="sql-createopclass.html"
646
HREF="sql-commands.html"
654
>CREATE OPERATOR CLASS</TD
b'\\ No newline at end of file'