Re: capturing and storing query statement with rules - Mailing list pgsql-general

From Mike Mascari
Subject Re: capturing and storing query statement with rules
Date
Msg-id 3EF8BD15.9070001@mascari.com
Whole thread Raw
In response to Re: capturing and storing query statement with rules  (Joe Conway <mail@joeconway.com>)
List pgsql-general
Joe Conway wrote:

> Guillaume LELARGE wrote:
>
>> Le Mardi 24 Juin 2003 20:17, Andrew Gould a écrit :
>>
>>> I would like to create a audit log of update and
>>> delete queries against a table.  I want the log on the
>>> server side, since access will be done using various
>>> clients via ODBC.  I would like to capture the user,
>>> current datetime and the query statement.  My thought
>>> was to accomplish this by creating a rule that will
>>> insert the information into a log table.
>>
>> And you'll find at the end of the page how to get current user
>> (current_user keyword) and current datetime (function now).
>>
>>> How can I captures the query statement so that I can
>>> place it in a insert query?  Is there a variable in
>>> the server that holds the query statement as a string?
>
> I think this shows how to do what you want:
> http://archives.postgresql.org/pgsql-sql/2003-05/msg00301.php

Maybe debug_query_string should be mapped into a variable like
CURRENT_USER? Perhaps something like CURRENT_QUERY?

Mike Mascari
mascarm@mascari.com



pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: A creepy story about dates. How to prevent it?
Next
From: wsheldah@lexmark.com
Date:
Subject: Re: Failure to install 7.3.3