From: Alvaro Herrera [mailto:alvherre@2ndquadrant.com]
> I have no idea how expensive backtrace() and libunwind are, but I doubt
> we want to pay the cost for every message before we know that error
> requires the backtrace to be collected. Something like PGC_USERSET
> server_min_backtraces=PANIC
> might be a possible interface.
+1
In addition, it would be nicer if we could have some filtering based on the error condition. Sometimes I wanted to
knowwhere the "out of memory" or "invalid memory alloc request size ..." was thrown.
How about adding a GUC like the -e option of strace? strace allows to specify which system calls and groups of them to
capture. We can use the SQL state and class code/name to list the conditions to capture. In the out-of-memory case, I
wantto specify 53200, but don't want to get stack traces for other errors in class 53.
https://www.postgresql.org/docs/devel/static/errcodes-appendix.html
Regards
Takayuki Tsunakawa