Re: [BUG] views and functions on relations - Mailing list pgsql-hackers

From Alex Pilosov
Subject Re: [BUG] views and functions on relations
Date
Msg-id Pine.BSO.4.10.10104181255360.7431-100000@spider.pilosoft.com
Whole thread Raw
In response to Re: [BUG] views and functions on relations  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [BUG] views and functions on relations
List pgsql-hackers
On Wed, 18 Apr 2001, Tom Lane wrote:

> The ruleutils.c bug cannot explain this however, since ruleutils won't
> even be invoked.  Can you find a sequence to reproduce it?
Sorry, I was mistaken. The error I get for select is this:
ERROR:  cache lookup for type 0 failed

This is a far harder to trigger bug, and actually, it doesn't happen in
this simple case (oops), and the only test case I have involves 2 tables
and 3 stored procedures. It is not related to views at all, just doing the
underlying select causes the problem. Taking out _any_ stored procedure
from the query removes the problem. 

FWIW, this is what I see in server error log:

ERROR:  cache lookup for type 0 failed
DEBUG:  Last error occured while executing PL/pgSQL function cust_name
DEBUG:  while putting call arguments to local variables

And this is the query:
SELECT
cust_name(a)
FROM customers AS a, addresses AS b
WHERE
b.cust_id=a.cust_id
and b.oid=get_billing_record(a.cust_id)
and cust_balance(a.cust_id)>0

Removing either get_billing_record or cust_balance conditions or cust_name
selection leaves the problem. Unfortunately, each function is very long,
and involves lots of tables and it'd make no sense to post this all to the
list, so I'm going to try to narrow down the problem more to get a good
reproducible result, but if the above helps any in diagnostic, it'd be
great ;)




pgsql-hackers by date:

Previous
From: "Mikheev, Vadim"
Date:
Subject: RE: AW: timeout on lock feature
Next
From: Peter Eisentraut
Date:
Subject: Re: [PATCHES] Fix for psql core dumping on bad user