diff options
author | Peter Eisentraut <peter_e@gmx.net> | 2018-08-15 18:05:46 +0200 |
---|---|---|
committer | Peter Eisentraut <peter_e@gmx.net> | 2018-08-22 14:44:49 +0200 |
commit | d12782898eb5979bef3c6dd0d80b93d1aaf53cac (patch) | |
tree | 6d795cc771c20c972f5eef4a05f7c2ac7576db9f /doc/src | |
parent | b19495772e48ecd32de9a906ddf8c25e16007575 (diff) |
Change PROCEDURE to FUNCTION in CREATE OPERATOR syntax
Since procedures are now a different thing from functions, change the
CREATE OPERATOR syntax to use FUNCTION in the clause that specifies the
function. PROCEDURE is still accepted for compatibility.
Reported-by: Peter Geoghegan <pg@bowt.ie>
Reviewed-by: Jonathan S. Katz <jonathan.katz@excoventures.com>
Diffstat (limited to 'doc/src')
-rw-r--r-- | doc/src/sgml/extend.sgml | 2 | ||||
-rw-r--r-- | doc/src/sgml/ref/create_operator.sgml | 12 | ||||
-rw-r--r-- | doc/src/sgml/xoper.sgml | 4 |
3 files changed, 13 insertions, 5 deletions
diff --git a/doc/src/sgml/extend.sgml b/doc/src/sgml/extend.sgml index a3cb064131b..d5731621e7b 100644 --- a/doc/src/sgml/extend.sgml +++ b/doc/src/sgml/extend.sgml @@ -1015,7 +1015,7 @@ CREATE TYPE pair AS ( k text, v text ); CREATE OR REPLACE FUNCTION pair(text, text) RETURNS pair LANGUAGE SQL AS 'SELECT ROW($1, $2)::@extschema@.pair;'; -CREATE OPERATOR ~> (LEFTARG = text, RIGHTARG = text, PROCEDURE = pair); +CREATE OPERATOR ~> (LEFTARG = text, RIGHTARG = text, FUNCTION = pair); -- "SET search_path" is easy to get right, but qualified names perform better. CREATE OR REPLACE FUNCTION lower(pair) diff --git a/doc/src/sgml/ref/create_operator.sgml b/doc/src/sgml/ref/create_operator.sgml index c8263437abd..d5c385c087f 100644 --- a/doc/src/sgml/ref/create_operator.sgml +++ b/doc/src/sgml/ref/create_operator.sgml @@ -22,7 +22,7 @@ PostgreSQL documentation <refsynopsisdiv> <synopsis> CREATE OPERATOR <replaceable>name</replaceable> ( - PROCEDURE = <replaceable class="parameter">function_name</replaceable> + {FUNCTION|PROCEDURE} = <replaceable class="parameter">function_name</replaceable> [, LEFTARG = <replaceable class="parameter">left_type</replaceable> ] [, RIGHTARG = <replaceable class="parameter">right_type</replaceable> ] [, COMMUTATOR = <replaceable class="parameter">com_op</replaceable> ] [, NEGATOR = <replaceable class="parameter">neg_op</replaceable> ] [, RESTRICT = <replaceable class="parameter">res_proc</replaceable> ] [, JOIN = <replaceable class="parameter">join_proc</replaceable> ] @@ -100,6 +100,14 @@ CREATE OPERATOR <replaceable>name</replaceable> ( </para> <para> + In the syntax of <literal>CREATE OPERATOR</literal>, the keywords + <literal>FUNCTION</literal> and <literal>PROCEDURE</literal> are + equivalent, but the referenced function must in any case be a function, not + a procedure. The use of the keyword <literal>PROCEDURE</literal> here is + historical and deprecated. + </para> + + <para> The other clauses specify optional operator optimization clauses. Their meaning is detailed in <xref linkend="xoper-optimization"/>. </para> @@ -264,7 +272,7 @@ COMMUTATOR = OPERATOR(myschema.===) , CREATE OPERATOR === ( LEFTARG = box, RIGHTARG = box, - PROCEDURE = area_equal_function, + FUNCTION = area_equal_function, COMMUTATOR = ===, NEGATOR = !==, RESTRICT = area_restriction_function, diff --git a/doc/src/sgml/xoper.sgml b/doc/src/sgml/xoper.sgml index 2aa7cf9b642..2f5560ac505 100644 --- a/doc/src/sgml/xoper.sgml +++ b/doc/src/sgml/xoper.sgml @@ -44,7 +44,7 @@ CREATE FUNCTION complex_add(complex, complex) CREATE OPERATOR + ( leftarg = complex, rightarg = complex, - procedure = complex_add, + function = complex_add, commutator = + ); </programlisting> @@ -66,7 +66,7 @@ SELECT (a + b) AS c FROM test_complex; <para> We've shown how to create a binary operator here. To create unary operators, just omit one of <literal>leftarg</literal> (for left unary) or - <literal>rightarg</literal> (for right unary). The <literal>procedure</literal> + <literal>rightarg</literal> (for right unary). The <literal>function</literal> clause and the argument clauses are the only required items in <command>CREATE OPERATOR</command>. The <literal>commutator</literal> clause shown in the example is an optional hint to the query |