Re: [BUG] views and functions on relations

From: Alex Pilosov <alex(at)pilosoft(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: [BUG] views and functions on relations
Date: 2001-04-18 17:11:09
Message-ID: Pine.BSO.4.10.10104181255360.7431-100000@spider.pilosoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 ;)

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alex Pilosov 2001-04-18 17:15:52 Re: [BUG] views and functions on relations
Previous Message Joel Burton 2001-04-18 17:08:06 [BUG?] tgconstrrelid doesn't survive a dump/restore