Re: BUG #4120: ERROR: cache lookup failed for function 0 - Mailing list pgsql-bugs

From Tom Lane
Subject Re: BUG #4120: ERROR: cache lookup failed for function 0
Date
Msg-id 608.1208803167@sss.pgh.pa.us
Whole thread Raw
In response to Re: BUG #4120: ERROR: cache lookup failed for function 0  (Pedro Gimeno <pgsql-002@personal.formauri.es>)
List pgsql-bugs
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

pgsql-bugs by date:

Previous
From: Pedro Gimeno
Date:
Subject: Re: BUG #4120: ERROR: cache lookup failed for function 0
Next
From: Tom Lane
Date:
Subject: Re: BUG #4113: server closed the connection unexpectedly