Re: Connected user in a triggerfunction - Mailing list pgsql-general

From Michael Fuhr
Subject Re: Connected user in a triggerfunction
Date
Msg-id 20060120070711.GA32488@winnie.fuhr.org
Whole thread Raw
In response to Connected user in a triggerfunction  (Dick Kniep <dick@kniep.nl>)
List pgsql-general
On Fri, Jan 20, 2006 at 07:56:38AM +0100, Dick Kniep wrote:
> We are using logging in a database based on triggers and plpgsql functions.
> This works OK. However, we want deletes to be recorded too, and there we want
> the user who connected to be recorded in the log. So, how can I get the
> connected user in a triggerfunction?

Use SESSION_USER or CURRENT_USER.  They're usually the same but see
the documentation for how they can differ:

http://www.postgresql.org/docs/8.1/interactive/functions-info.html

--
Michael Fuhr

pgsql-general by date:

Previous
From: "A. Kretschmer"
Date:
Subject: Re: Connected user in a triggerfunction
Next
From: "Peter Zeltins"
Date:
Subject: Re: Using rowtype parameter