Обсуждение: User with GRANTS only on Views. Lock table on function will work?

Поиск
Список
Период
Сортировка

User with GRANTS only on Views. Lock table on function will work?

От
Andre Lopes
Дата:
Hi,

I have a database were the users only can do operations using views, they have not access to physical tables. But I have a function with a lock on a physical table. Can I allow this users to run a function that locks a physical table?

Best Regards,

Re: User with GRANTS only on Views. Lock table on function will work?

От
Raymond O'Donnell
Дата:
On 25/04/2010 13:24, Andre Lopes wrote:
> Hi,
>
> I have a database were the users only can do operations using views,
> they have not access to physical tables. But I have a function with a
> lock on a physical table. Can I allow this users to run a function that
> locks a physical table?

You can create a function with SECURITY DEFINER, allowing it to be run
with the privileges of the users who created it rather than the user who
is running it. See here:

  http://www.postgresql.org/docs/8.4/static/sql-createfunction.html

Would this do what you need?

Ray.


--
Raymond O'Donnell :: Galway :: Ireland
rod@iol.ie