How to access statement text in Postgres trigger

Viewed 39

I'm attempting to put together what I thought would be a simple audit ability in Postgres. I intend to log session_id/user_id etc., but what I'm really after is logging the actual statement, in full. I know I can get the operation with TG_OP, but does anybody know the secret sauce to get the actual text of the current statement?

1 Answers

This information can be retrieved with the current_query()function.

Related