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

Started by Andre Lopesalmost 16 years ago2 messagesgeneral
Jump to latest
#1Andre Lopes
lopes80andre@gmail.com

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,

In reply to: Andre Lopes (#1)
Re: User with GRANTS only on Views. Lock table on function will work?

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