Re: Function and Tables Privilege

From: Iande <iande(at)br(dot)inter(dot)net>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Re: Function and Tables Privilege
Date: 2003-08-07 20:34:46
Message-ID: E19krTD-0006uX-EM@mail5.br.inter.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

<P>Well, a view is the easiest thing, grant permissions to the view
and<BR>revoke them from the base table.<BR><BR>However, if you actually want
functions, you should be able to say<BR>something like:<BR><BR>create table
testtable(a text, b int);<BR>create function gettesttable() returns setof
testtable as ' select * from<BR>testtable where a = SESSION_USER;' language
'SQL' security definer;<BR><BR>This example is one that really would make
more sense as a view, but<BR>imagine that the function was plpgsql and
actually did something<BR>interesting.<BR><BR>What have you tried so
far?<BR>----------------------</P>
<P>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.</P>
<P>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&nbsp;parameters. is this any clear?</P>
<P>thanks once again</P>
<P>Iandé</P>
<P>&nbsp;</P>
<P>&nbsp;</P>

Attachment Content-Type Size
unknown_filename text/html 1.1 KB

Browse pgsql-novice by date

  From Date Subject
Next Message Avi Schwartz 2003-08-07 20:41:45 Re: Function and Tables Privilege
Previous Message Iande 2003-08-07 20:26:52 Re: Function and Tables Privilege