Re: BUG #4120: ERROR: cache lookup failed for function 0

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Pedro Gimeno <pgsql-002(at)personal(dot)formauri(dot)es>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #4120: ERROR: cache lookup failed for function 0
Date: 2008-04-21 18:39:27
Message-ID: 608.1208803167@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Pedro Gimeno <pgsql-002(at)personal(dot)formauri(dot)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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-04-21 20:55:15 Re: BUG #4113: server closed the connection unexpectedly
Previous Message Pedro Gimeno 2008-04-21 18:17:00 Re: BUG #4120: ERROR: cache lookup failed for function 0