Log query parameters for terminated execute

Поиск
Список
Период
Сортировка
От Sergei Kornilov
Тема Log query parameters for terminated execute
Дата
Msg-id 4686111529783659@web43o.yandex.ru
обсуждение исходный текст
Ответы Re: Log query parameters for terminated execute  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Hello all
We already have feature to logging query parameters. If we use log_statement = 'all' we write parameters before
executionand all is fine here. If we use log_min_duration_statement statement is logged obviously after execution, but
currentlywe 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.

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
OidOutputFunctionCallin all cases, right?
 

Another small question is why errdetail_params uses errdetail instead errdetail_log? We assume that the user wants to
gettheir own parameters back (if he set client_min_messages to LOG)?
 

Any feedback is strongly appreciated. Thank you!

regards, Sergei
Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Chris Howard
Дата:
Сообщение: comma to delimit fractional seconds
Следующее
От: Lars Kanis
Дата:
Сообщение: Retrieve memory size allocated by libpq