Kristian Larsson wrote:
> And poking in pg_operator / pg_type seems to confirm this:
>
> nils=# SELECT (SELECT typname FROM pg_type WHERE typelem=oprleft), oprname, (SELECT typname FROM pg_type WHERE
typelem=oprright)FROM pg_operator WHERE oprleft=(SELECT typelem FROM pg_type WHERE typname='_inet') AND oprname='+';
> ?column? | oprname | ?column?
> ----------+---------+----------
> _inet | + | _int8
> (1 row)
That query is wrong -- type _inet is actually another way to spell
inet[]. What you want is this, that also confirms your problem:
alvherre=# SELECT oprleft::regtype, oprname, oprright::regtype, oprresult::regtype FROM pg_operator WHERE
(oprleft='inet'::regtypeOR oprright = 'inet'::regtype) AND oprname='+';
oprleft | oprname | oprright | oprresult
---------+---------+----------+-----------
inet | + | bigint | inet
bigint | + | inet | inet
(2 filas)
> Am I doing it the wrong way? Bug?
I'd say this is just a missing feature.
--
Alvaro Herrera http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support