From a740b213d4b4d3360ad0cac696e47e5ec0eb8864 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Sat, 30 Dec 2023 11:11:26 +0100 Subject: Add GUC backtrace_on_internal_error When enabled (default off), this logs a backtrace anytime elog() or an equivalent ereport() for internal errors is called. This is not well covered by the existing backtrace_functions, because there are many equally-worded low-level errors in many functions. And if you find out where the error is, then you need to manually rewrite the elog() to ereport() to attach the errbacktrace(), which is annoying. Having a backtrace automatically on every elog() call could be very helpful during development for various kinds of common errors from palloc, syscache, node support, etc. Discussion: https://www.postgresql.org/message-id/flat/ba76c6bc-f03f-4285-bf16-47759cfcab9e@eisentraut.org --- doc/src/sgml/config.sgml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'doc/src') diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml index b5624ca8847..f323bba018f 100644 --- a/doc/src/sgml/config.sgml +++ b/doc/src/sgml/config.sgml @@ -11086,6 +11086,33 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir' + + backtrace_on_internal_error (boolean) + + backtrace_on_internal_error configuration parameter + + + + + If this parameter is on and an error with error code XX000 (internal + error; see also ) is raised, then a + backtrace is written to the server log together with the error + message. This can be used to debug such internal errors (which should + normally not happen in production). The default is off. + + + + Backtrace support is not available on all platforms, and the quality + of the backtraces depends on compilation options. + + + + Only superusers and users with the appropriate SET + privilege can change this setting. + + + + debug_discard_caches (integer) -- cgit v1.2.3