Re: Function and Tables Privilege - Mailing list pgsql-novice

From Avi Schwartz
Subject Re: Function and Tables Privilege
Date
Msg-id 8F06705A-C917-11D7-AA3E-000393AE5044@CFFtechnologies.com
Whole thread Raw
In response to Re: Function and Tables Privilege  (Iande <iande@br.inter.net>)
List pgsql-novice
If I understand your question correctly, what you are trying to achieve
is to have the function execute with the creator permission and not the
user who executes it.  If this is the case then it is easy.  Use

security definer

when you create your function as in the following example:

create or replace function func_name(parameters)
returns ...
security definer
as '
declare
...


As long as the creator has permission to modify data in the table, so
would the user who executes this function.

Avi

On Thursday, Aug 7, 2003, at 15:26 America/Chicago, Iande wrote:

> Thanks for the reply, I think I wasn´t too clear on wot I was
> intending to do... `
> here is an example, I hope this helps..
>  
> Thanks for the reply, I think I wasn´t too clear on wot I was
> intending to do... `
> here is an example, I hope this helps..
>  
>  I have a Table let´s say tb_test with admin as the onwer and the only
> user with all privilege for  that table, I want to create a function
> that user usr1 has permission to execute. Within that function all i
> want to do is to update tb_test, but i get  permission denied for that
> table when i try to execute the function as usr1. Basically I want to
> insert or update a table via a function restricting insert and
> update privilege to that table. I´ve heard that there is a way of
> setting the privileges to the level of the onwer of the function, can
> anyone give be a pratical example?
> thanks again


pgsql-novice by date:

Previous
From: Iande
Date:
Subject: Re: Function and Tables Privilege
Next
From: Iande
Date:
Subject: Re: Function and Tables Privilege