Re: Connected user in a triggerfunction

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Dick Kniep <dick(at)kniep(dot)nl>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Connected user in a triggerfunction
Date: 2006-01-20 07:07:11
Message-ID: 20060120070711.GA32488@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message DB Subscriptions 2006-01-20 08:16:59 Create User
Previous Message A. Kretschmer 2006-01-20 07:07:05 Re: Connected user in a triggerfunction