Re: Frontend error logging style

From: Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Frontend error logging style
Date: 2022-02-24 13:06:18
Message-ID: 6fdb3ab3-f093-27b9-dfdc-c391e69163fc@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 23.02.22 00:23, Tom Lane wrote:
> This conversation seems to have tailed off without full resolution,
> but I observe that pretty much everyone except Peter is on board
> with defining pg_log_fatal as pg_log_error + exit(1). So I think
> we should just do that, unless Peter wants to produce a finished
> alternative proposal.
>
> I've now gone through and fleshed out the patch I sketched upthread.

This patch already illustrates a couple of things that are wrong with
this approach:

- It doesn't allow any other way of exiting. For example, in pg_dump,
you have removed a few exit_nicely() calls. It's not clear why that is
valid or whether it would always be valid for all call sites.

- It doesn't allow other exit codes. For example, in psql, you have
changed a pg_log_fatal() call to pg_log_error() because it needed
another exit code. This slides us right back into that annoying
situation where in the backend we have to log error messages using
elog(LOG) because the flow control is tangled up with the log level.

My suggestion is to just get rid of pg_log_fatal() and replace them all
with pg_log_error().

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2022-02-24 13:08:40 Re: PATCH: add "--config-file=" option to pg_rewind
Previous Message Masahiko Sawada 2022-02-24 13:00:16 Re: Optionally automatically disable logical replication subscriptions on error