Re: Per session variables

From: Steve Atkins <steve(at)blighty(dot)com>
To: pgsql general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Per session variables
Date: 2006-05-27 21:31:04
Message-ID: BE9CE319-00DA-4EC1-B6CD-1C488129F950@blighty.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


On May 27, 2006, at 12:13 PM, Richard Smith wrote:

> Hi guys,
>
> I've googled about a bit, and found some ideas for solving this
> problem, but I thought I'd pose the question, in the hope that
> someone can suggest something.
>
> I've got a web application that needs to do audit logging, taking
> some information provided by the webapp such as user, request path,
> remote IP etc...
>
> Since I can't create users in postgres, and would like to be able
> to do the audit logging transparently, would anyone have any ideas
> as to a way I can do this kind of thing.
>
> I need to avoid using external libraries if possible so if anyone
> has any tricks I'd appreciate it.
>
> I did find a mention of some features in 8.0 that I might be able
> to exploit, however there was no details of what those features
> were, your typical useless reply to a mailing list post. There was
> also a myfunc module that would fill my needs, but I don't really
> want to load external modules into the db.
>
> I'm running PG8.1

I do it using a temporary table with one row that the webapp populates
with the username (and any other session information) when it connects
or changes user. I also have an underlying permanent table with generic
information in it, so that triggers and suchlike still work when
accessing the
DB by hand.

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chris Browne 2006-05-27 22:44:13 Re: Invoke diff from plpgsql?
Previous Message Matthew Peter 2006-05-27 21:25:02 Re: Invoke diff from plpgsql?