How to log query parameters instead of variables with log_min_duration_statement - Mailing list pgsql-general

From Max Williams
Subject How to log query parameters instead of variables with log_min_duration_statement
Date
Msg-id 0357196CB603794BB76F4F6B373F27330506EACE98@SERVER.ddnglobal.local
Whole thread Raw
Responses Re: How to log query parameters instead of variables with log_min_duration_statement  (zhong ming wu <mr.z.m.wu@gmail.com>)
Re: How to log query parameters instead of variables with log_min_duration_statement  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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

pgsql-general by date:

Previous
From: Konstantin Izmailov
Date:
Subject: Re: PQprepare in PostgreSQL 7.4 (lack of SAVEPOINTs)
Next
From: zhong ming wu
Date:
Subject: Re: How to log query parameters instead of variables with log_min_duration_statement