Revert "Add GUC backtrace_on_internal_error"
authorPeter Eisentraut <[email protected]>
Mon, 29 Apr 2024 08:49:42 +0000 (10:49 +0200)
committerPeter Eisentraut <[email protected]>
Mon, 29 Apr 2024 08:49:42 +0000 (10:49 +0200)
This reverts commit a740b213d4b4d3360ad0cac696e47e5ec0eb8864.

Subsequent discussion showed that there was interest in a more general
facility to configure when server log events would produce backtraces,
and this existing limited way couldn't be extended in a compatible
way.  So the consensus was to revert this for PostgreSQL 17 and
reconsider this topic for PostgreSQL 18.

Discussion: https://www.postgresql.org/message-id/flat/CAGECzQTChkvn5Xj772LB3%3Dxo2x_LcaO5O0HQvXqobm1xVp6%2B4w%40mail.gmail.com#764bcdbb73e162787e1ad984935e51e3

doc/src/sgml/config.sgml
src/backend/utils/error/elog.c
src/backend/utils/misc/guc_tables.c
src/include/utils/guc.h

index d8e1282e128d7fefc6acc327a1107f01f5fbda2e..ffb6b023fd68d027d53f9a0dc38bbf4823a704f3 100644 (file)
@@ -11381,33 +11381,6 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
       </listitem>
      </varlistentry>
 
-     <varlistentry id="guc-backtrace-on-internal-error" xreflabel="backtrace_on_internal_error">
-      <term><varname>backtrace_on_internal_error</varname> (<type>boolean</type>)
-      <indexterm>
-        <primary><varname>backtrace_on_internal_error</varname> configuration parameter</primary>
-      </indexterm>
-      </term>
-      <listitem>
-       <para>
-        If this parameter is on and an error with error code XX000 (internal
-        error; see also <xref linkend="errcodes-appendix"/>) 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.
-       </para>
-
-       <para>
-        Backtrace support is not available on all platforms, and the quality
-        of the backtraces depends on compilation options.
-       </para>
-
-       <para>
-        Only superusers and users with the appropriate <literal>SET</literal>
-        privilege can change this setting.
-       </para>
-      </listitem>
-     </varlistentry>
-
      <varlistentry id="guc-debug-discard-caches" xreflabel="debug_discard_caches">
       <term><varname>debug_discard_caches</varname> (<type>integer</type>)
       <indexterm>
index 605ff3b04535478e086e8cb8c9ddec011a92dcb0..d91a85cb2d7b397b36876e0411d296f2f67ec1ad 100644 (file)
@@ -497,11 +497,9 @@ errfinish(const char *filename, int lineno, const char *funcname)
 
    /* Collect backtrace, if enabled and we didn't already */
    if (!edata->backtrace &&
-       ((edata->funcname &&
-         backtrace_functions &&
-         matches_backtrace_functions(edata->funcname)) ||
-        (edata->sqlerrcode == ERRCODE_INTERNAL_ERROR &&
-         backtrace_on_internal_error)))
+       edata->funcname &&
+       backtrace_functions &&
+       matches_backtrace_functions(edata->funcname))
        set_backtrace(edata, 2);
 
    /*
index c68fdc008b65b8d2bb3f3f8236a94148e98b83aa..3fd0b14dd8d7997bf8a222489a8a68f2900bb0a0 100644 (file)
@@ -531,7 +531,6 @@ int         log_temp_files = -1;
 double     log_statement_sample_rate = 1.0;
 double     log_xact_sample_rate = 0;
 char      *backtrace_functions;
-bool       backtrace_on_internal_error = false;
 
 int            temp_file_limit = -1;
 
@@ -770,16 +769,6 @@ StaticAssertDecl(lengthof(config_type_names) == (PGC_ENUM + 1),
 
 struct config_bool ConfigureNamesBool[] =
 {
-   {
-       {"backtrace_on_internal_error", PGC_SUSET, DEVELOPER_OPTIONS,
-           gettext_noop("Log backtrace for any error with error code XX000 (internal error)."),
-           NULL,
-           GUC_NOT_IN_SAMPLE
-       },
-       &backtrace_on_internal_error,
-       false,
-       NULL, NULL, NULL
-   },
    {
        {"enable_seqscan", PGC_USERSET, QUERY_TUNING_METHOD,
            gettext_noop("Enables the planner's use of sequential-scan plans."),
index 8d1fe04078a49b842bf2267f0236ea845c74842f..e4a594b5e80104c9262446d06d77587ae3a8757b 100644 (file)
@@ -267,7 +267,6 @@ extern PGDLLIMPORT int log_temp_files;
 extern PGDLLIMPORT double log_statement_sample_rate;
 extern PGDLLIMPORT double log_xact_sample_rate;
 extern PGDLLIMPORT char *backtrace_functions;
-extern PGDLLIMPORT bool backtrace_on_internal_error;
 
 extern PGDLLIMPORT int temp_file_limit;