View Single Post

   
  #4 (permalink)  
Old 04-24-2008, 06:12 PM
Tom Lane
 
Posts: n/a
Default Re: BUG #4120: ERROR: cache lookup failed for function 0

Pedro Gimeno <pgsql-002@personal.formauri.es> writes:
> Tom Lane wrote:
> Here's a minimal test case:


> pruebas=# CREATE FUNCTION vc_gt(varchar,varchar) RETURNS boolean
> IMMUTABLE STRICT LANGUAGE SQL AS 'SELECT CAST($1 AS TEXT) > CAST($2 AS
> TEXT);';
> CREATE FUNCTION
> pruebas=# CREATE OPERATOR > (
> PROCEDURE = vc_gt,
> LEFTARG = character varying,
> RIGHTARG = character varying,
> COMMUTATOR = <,
> RESTRICT = scalargtsel,
> JOIN = scalargtjoinsel
> );
> CREATE OPERATOR
> pruebas=# SELECT ''::varchar < ''::varchar;
> ERROR: cache lookup failed for function 0


Ah. You have actually created a "shell" operator varchar < varchar
by having written the commutator link. The error message could be
more helpful, perhaps, but I can't get too excited about it considering
that it's a consequence of a bogus operator definition. Either provide
the < operator or drop the COMMUTATOR property.

> This was part of my workaround for bug #4083. I only needed MAX so I
> only wrote the > operator. BTW, has #4083 been dismissed?


I don't think we'll do anything about it, no.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply With Quote