Re: Turn around !! Permissions on FUNCTIONS

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Marco Tulio <anjo(dot)doce(dot)marilia(at)bol(dot)com(dot)br>
Cc: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Turn around !! Permissions on FUNCTIONS
Date: 2002-02-12 00:08:44
Message-ID: Pine.LNX.4.30.0202111905350.1903-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Marco Tulio writes:

> OK, the below is impossible yet...
>
> but anyone can give-me a TURN AROUND this problem ?
>
> Example:
>
> I have a tb_log thats registers all DELETES over another
> table. I did it using a trigger and a function, because
> a simple RULE can´t do ever I need.
>
> BUT, I don´t want the user that makes the DELETE could
> make INSERTS, OR DELETES by hand over the tb_log...

If you want to write the trigger function in C, you can surround the
critical SQL statements (probably done via SPI interface) with calls like
this:

Oid saved = GetUserId();
SetUserId(something);
/* do work */
SetUserId(saved);

where "something" is the ID of the user you want to execute the "work"
section as. This is effectively what would need to be done to implement
this feature for real. Now that I see your problem I'm convinced it's
urgent and it should get done for 7.3.

--
Peter Eisentraut peter_e(at)gmx(dot)net

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Raghav Suryam.K 2002-02-12 06:25:15 Problem
Previous Message Marco Tulio 2002-02-11 22:25:24 Turn around !! Permissions on FUNCTIONS