Get parameters for current queries in PostgreSQL

We wrote a small tool that displays all currently running queries. We get current requests from pg_stat_activity.

The problem is this: we do not know the parameters provided to the request. We can only see placeholders $ 1, $ 2, etc.

Is there a way to get the parameters for the currently executing request?

The only workaround is to turn on the query log and analyze the parameters from the query log, but it will be a very dirty and slow solution.

+7
source share
2 answers

I do not think that's possible. I ran into the same problem.

+3
source

I use to run all requests through stored procedures / functions. Thus, you can add code to create a log at the beginning of each function.

+1
source

All Articles