COMMUTATOR doesn't seem to work - Mailing list pgsql-hackers

From D'Arcy Cain
Subject COMMUTATOR doesn't seem to work
Date
Msg-id 4FE341EE.5000302@druid.net
Whole thread Raw
Responses Re: COMMUTATOR doesn't seem to work
Re: COMMUTATOR doesn't seem to work
List pgsql-hackers
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:

CREATE OPERATOR = (        PROCEDURE = eq,        LEFTARG = chkpass,        RIGHTARG = text,        COMMUTATOR = =,
  NEGATOR = <>
 
);

This works;

cosmostest=# SELECT 'aaa'::chkpass = 'aaa'; ?column?
---------- t
(1 row)

But...

cosmostest=# SELECT 'aaa' = 'aaa'::chkpass;
ERROR:  operator is only a shell: text = chkpass
LINE 1: SELECT 'aaa' = 'aaa'::chkpass;

When I look at the operators I see why, sort of...
 public | =    | chkpass       | text           | boolean     | public | =    | text          | chkpass        | -
    |
 

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?

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
IM: darcy@Vex.Net


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: Catalog/Metadata consistency during changeset extraction from wal
Next
From: Andres Freund
Date:
Subject: Re: Catalog/Metadata consistency during changeset extraction from wal