On Jun21, 2012, at 17:46 , D'Arcy Cain wrote:
> Maybe I am using it wrong but I get no error message when I use it. I
> have a type called chkpass (a version is in the additional supplied
> modules) and I create the equality operator like this:
>
...
>
> So while it created the operator it didn't set a return type.
>
> I don't know if this is a new issue or I simply got lucky and never
> tried the opposite test before but I see this in 9.0.4 and 9.1.3.
> Am I using the command improperly?
COMMUTATOR (and also NEGATOR) only inform the planner/optimizer
about the relationship between operators, but you still have to create
all of them manually. What you see is the placeholder for that
to-be-created operator that CREATE OPERATOR fabricated. It does that
because if the COMMUTATOR or NEGATOR was required to already exist,
how would you ever be able to create a pair of commuting operators?
If you later use CREATE OPERATOR to actually create the COMMUTATOR
or NEGATOR you specified previously, it'll simply complete the
previously created placeholder.
Long story short, you need another CREATE OPERATOR command for the
COMMUTATOR (which argument types swapped), and it should in turn
name the original operator as it's COMMUTATOR.
best regards,
Florian Pflug