Re: Function and Tables Privilege

From: Avi Schwartz <avi(at)CFFtechnologies(dot)com>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Function and Tables Privilege
Date: 2003-08-07 20:41:45
Message-ID: 8F06705A-C917-11D7-AA3E-000393AE5044@CFFtechnologies.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Iande 2003-08-07 20:49:14 Re: Function and Tables Privilege
Previous Message Iande 2003-08-07 20:34:46 Re: Function and Tables Privilege