Re: Log query parameters for terminated execute

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Sergei Kornilov <sk(at)zsrv(dot)org>
Cc: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Log query parameters for terminated execute
Date: 2018-06-23 20:08:21
Message-ID: CAFj8pRDfkBt60b9MA6vCiJS3-uxK85GzynW4Ti-VGFuRQUdbRA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2018-06-23 21:54 GMT+02:00 Sergei Kornilov <sk(at)zsrv(dot)org>:

> Hello all
> We already have feature to logging query parameters. If we use
> log_statement = 'all' we write parameters before execution and all is fine
> here. If we use log_min_duration_statement statement is logged obviously
> after execution, but currently we have no parameters if query was
> terminated by statement_timeout, lock_timeout or by pg_terminate_backend.
>
> I would like have parameters in logs at least for such three cases.
>

It is good idea - more times I would to see these values

Regards

Pavel

> Simple way achieve this is just add errdetail_params to such ereport as in
> attached patch.
> Another way is add something like printing global variable
> debug_query_string in send_message_to_server_log
> (src/backend/utils/error/elog.c). But i have no good idea how print
> ParamListInfo correctly. We can not use OidOutputFunctionCall in all cases,
> right?
>
> Another small question is why errdetail_params uses errdetail instead
> errdetail_log? We assume that the user wants to get their own parameters
> back (if he set client_min_messages to LOG)?
>
> Any feedback is strongly appreciated. Thank you!
>
> regards, Sergei

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2018-06-23 20:36:00 Re: Does logical replication supports cross platform servers?
Previous Message Lars Kanis 2018-06-23 19:58:43 Retrieve memory size allocated by libpq