Re: (BUG ?) unprefixed oid -> ERROR: cache lookup failed for function

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Marc Mamin" <M(dot)Mamin(at)intershop(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: (BUG ?) unprefixed oid -> ERROR: cache lookup failed for function
Date: 2012-06-21 16:05:24
Message-ID: 26831.1340294724@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Marc Mamin" <M(dot)Mamin(at)intershop(dot)de> writes:
> following query is wrong in my understanding, as it doesn't specify
> which oid to use (pg_proc or pg_roles ?)
> but it is accepted by the parser

> select pg_get_functiondef(oid) -- should be
> pg_get_functiondef(pg_proc.oid)
> from pg_proc join pg_roles
> on ( pg_proc.proowner=pg_roles.oid )
> LIMIT 1

The reason that happens is that pg_roles has an explicit oid column (ie,
oid is a regular not system column in the view) so that name takes
precedence over the system column available from pg_proc. Having to
have an explicit oid column in pg_roles isn't very nice, because of
precisely this type of inconsistency, but since it's a view not a table
there's not a lot of alternatives.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Steve Atkins 2012-06-21 17:03:39 Re: Conditional cast for eg sorting?
Previous Message Kris Deugau 2012-06-21 15:45:21 Conditional cast for eg sorting?