Permissions + Views + Functions = relation not exist when not owner

Lists: pgsql-sql
From: "Adie" <adie_xp(at)klub(dot)chip(dot)pl>
To: pgsql-sql(at)postgresql(dot)org
Subject: Permissions + Views + Functions = relation not exist when not owner
Date: 2005-05-25 12:55:03
Message-ID: 55336.213.77.90.234.1117025703.squirrel@klub.chip.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

HI!
I got a View which calls function which uses table.
It works fine when selecting from view by owner (postgres) of table,
function and view.
Problem is when another user is sellecting view. There is an error:
ERROR: relation "XXX" does not exist
CONTEXT: PL/pgSQL function "XXX" line 4 at select into variables

User has rights to select from view, use schema AND function is declared as
IMMUTABLE
CALLED ON NULL INPUT
SECURITY DEFINER

It is strange it looks like problem with permission but error is not about
permissions. Calling function directly also produces error. Functions and
Views are in separate schema but tables are in "public". Any idea why this
is happening?
Using pg7.4.6

Martin Domanski


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Adie" <adie_xp(at)klub(dot)chip(dot)pl>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Permissions + Views + Functions = relation not exist when not owner
Date: 2005-05-25 13:58:31
Message-ID: 11686.1117029511@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-sql

"Adie" <adie_xp(at)klub(dot)chip(dot)pl> writes:
> I got a View which calls function which uses table.
> It works fine when selecting from view by owner (postgres) of table,
> function and view.
> Problem is when another user is sellecting view. There is an error:
> ERROR: relation "XXX" does not exist

Perhaps the other user is running with a different search_path setting?

regards, tom lane