COMMUTATOR doesn't seem to work

From: D'Arcy Cain <darcy(at)druid(dot)net>
To: pgsql-hackers(at)PostgreSQL(dot)org
Subject: COMMUTATOR doesn't seem to work
Date: 2012-06-21 15:46:54
Message-ID: 4FE341EE.5000302@druid.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)druid(dot)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(at)Vex(dot)Net

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2012-06-21 15:56:11 Re: Catalog/Metadata consistency during changeset extraction from wal
Previous Message Andres Freund 2012-06-21 15:40:08 Re: Catalog/Metadata consistency during changeset extraction from wal