2

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?

0

1 Answer 1

4

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.