How to log query parameters instead of variables with log_min_duration_statement

From: Max Williams <Max(dot)Williams(at)mflow(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: How to log query parameters instead of variables with log_min_duration_statement
Date: 2010-06-28 09:29:29
Message-ID: 0357196CB603794BB76F4F6B373F27330506EACE98@SERVER.ddnglobal.local
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
I am logging long queries with log_min_duration_statement but would like to see the parameters for parameterized queries. Eg...

Jun 28 10:21:49 dbs1 postgres[20866]: [2-1] LOG: duration: 6625.543 ms execute PRSTMT1405204512-1371060978/PORTAL1405204512-1371060978: SELECT COUNT(*)
Jun 28 10:21:49 dbs1 postgres[20866]: [2-2] FROM "XYZ123" AS "T0"
Jun 28 10:21:49 dbs1 postgres[20866]: [2-3] WHERE ("T0"."Id" = $1)

I'd like to log or find out what $1 was from the postgresql server side, not the application side. Is this possible?
Best Regards,
Max Williams

Responses

Browse pgsql-general by date

  From Date Subject
Next Message zhong ming wu 2010-06-28 09:43:24 Re: How to log query parameters instead of variables with log_min_duration_statement
Previous Message Konstantin Izmailov 2010-06-28 08:00:50 Re: PQprepare in PostgreSQL 7.4 (lack of SAVEPOINTs)