[HACKERS] proposal: enhanced stack trace for PL - print param args

Поиск
Список
Период
Сортировка
От Pavel Stehule
Тема [HACKERS] proposal: enhanced stack trace for PL - print param args
Дата
Msg-id CAFj8pRBd+Crr2VTUM+xz_yeFD5nK+i80jGUQZ8S1UQxfZLYu5Q@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] proposal: enhanced stack trace for PL - print param args  (Corey Huinker <corey.huinker@gmail.com>)
Список pgsql-hackers
Hi

In last discussion related to PLpgSQL was mentioned weak of stack trace PLpgSQL. The function parameters are not printed. 

CREATE OR REPLACE FUNCTION public.foo(a double precision, b double precision)
 RETURNS double precision
 LANGUAGE plpgsql
AS $function$
begin
  return 100/a;
end;
$function$

Current:

postgres=# select foo(0, 100);
ERROR:  division by zero
CONTEXT:  PL/pgSQL function foo(double precision) line 3 at RETURN

Proposed result:
postgres=# select foo(0, 100);
ERROR:  division by zero
CONTEXT:  PL/pgSQL function foo(double precision) line 3 at RETURN
ARGUMENTS: a=0, b=100

* only function parameters are printed - no local parameters
* the line of arguments will be limited - X chars ?
* the content of variable should be limited - X chars ? - maybe 40 chars

This function can has impact on performance - so it should be explicitly enabled with some GUC - like extra_back_trace or some similar. Probably before any call the function parameters and related out functions should be copied to safe memory context. More it can increase press on Error Memory Context and possibly on log size.

Is a interest about this feature? Comments, notes?

Regards

Pavel 

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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] Patch to implement pg_current_logfile() function
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: [HACKERS] patch: function xmltable