Current Query from Trigger - Mailing list pgsql-general

From Michael Fork
Subject Current Query from Trigger
Date
Msg-id 20040619024721.56502.qmail@web52401.mail.yahoo.com
Whole thread Raw
List pgsql-general
All,

I am trying to create a basic auditing mechanism using
triggers and would like to create a table that
contains the following information:

audit_operation = TG_OP
audit_username = CURRENT_USER
audit_time = CURRENT_TIMESTAMP
audit_table = TG_RELNAME
audit_key = NEW.key_field (or OLD.key_field)
audit_statement = ??????

How can I get the SQL statement that triggered the
trigger?

Thanks.

Michael


pgsql-general by date:

Previous
From: "Scot L. Harris"
Date:
Subject: Re: RHEL 2.1 rpms for 7.4.2
Next
From: "Luiz Rafael Culik Guimaraes"
Date:
Subject: Escape chars