2

I'm doing a trigger Each Statement and I would like to access the Query Statement that triggered the trigger. Is this possible ?

Something like this:

update table_1 where id> 300;

This query triggers an update event in table table_1 and this event triggers a function associated with the update trigger. This trigger is configured as Each Statement and inside the trigger I would like to do something like this:

raise info 'Query Statement that fired this trigger:%', last_query();

Would this be possible?

Thank you!

Julio

1
  • I have not found a system function or view to do this in PostgreSQL. Commented Jun 10, 2020 at 16:05

1 Answer 1

2

Call the function current_query().

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.