COMMUTATOR doesn't seem to work
D'Arcy Cain <darcy@druid.net>
From: D'Arcy Cain <darcy@druid.net>
To: pgsql-hackers@PostgreSQL.org
Date: 2012-06-21T15:46:54Z
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@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