Is the COMMUTATOR clause required for self commutative operators?

From: <btober(at)seaworthysys(dot)com>
To: <pgsql-general(at)postgresql(dot)org>
Subject: Is the COMMUTATOR clause required for self commutative operators?
Date: 2003-12-08 22:06:35
Message-ID: 64892.216.238.112.88.1070921195.squirrel@$HOSTNAME
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

In the command

CREATE OPERATOR name (
PROCEDURE = func_name
[, LEFTARG = lefttype ] [, RIGHTARG = righttype ]
[, COMMUTATOR = com_op ] [, NEGATOR = neg_op ]
[, RESTRICT = res_proc ] [, JOIN = join_proc ]
[, HASHES ] [, MERGES ]
[, SORT1 = left_sort_op ] [, SORT2 = right_sort_op ]
[, LTCMP = less_than_op ] [, GTCMP = greater_than_op ]
)

Is omitting the COMMUTATOR option a problem at all in case of
self-commutative operators? That is, if I define

CREATE OPERATOR public.+(
PROCEDURE = numeric_add_null,
LEFTARG = numeric,
RIGHTARG = numeric,
COMMUTATOR = +)

(where numeric_add_null is a function that handles in NULLs in a
non-standard, but more useful way), since "+" is self commutative, is it
necessary to include it here? Any advantage or disadvantage to ommitting
or including it?

~Berend Tober

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2003-12-08 22:25:59 Re: Is the COMMUTATOR clause required for self commutative operators?
Previous Message Peter Eisentraut 2003-12-08 20:38:54 Re: Inheritance and foreign keys