Thread: Current Query from Trigger

Current Query from Trigger

From
Michael Fork
Date:
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


Escape chars

From
"Luiz Rafael Culik Guimaraes"
Date:
Dear Friends

Does postgresql api has some function similar to mysql_real_escape_string()
?

Regards
Luiz



Re: Escape chars

From
"CN"
Date:
> Does postgresql api has some function similar to
> mysql_real_escape_string()
> ?

Manual 27.3.4 says that libpq has C function PQescapeString(). If that
function is not globally accessible, you might be able to build it from
its source code.

Regards,
CN