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

From Iande
Subject Re: Function and Tables Privilege
Date
Msg-id E19krTD-0006uX-EM@mail5.br.inter.net
Whole thread Raw
In response to Function and Tables Privilege  (Iande <iande@br.inter.net>)
List pgsql-novice
Well, a view is the easiest thing, grant permissions to the view
andrevoke them from the base table.However, if you actually want
functions, you should be able to saysomething like:create table
testtable(a text, b int);create function gettesttable() returns setof
testtable as ' select * fromtesttable where a = SESSION_USER;' language
'SQL' security definer;This example is one that really would make
more sense as a view, butimagine that the function was plpgsql and
actually did somethinginteresting.What have you tried so
far?----------------------
What I was thinking, would be something on the line of enable privilege
at the begining of the function and disable privilege and the end to restore
the currente_user privileges, from wot i understand, this way the function
would execute with it´s onwer´s privileges.
would it not be advisable not to use a view?.. i want to insert into a
table via a function, so that, i can only access the especific table through
the functions parameters. is this any clear?
thanks once again
Iandé
 
 

pgsql-novice by date:

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