From: | Antonin Houska <ah(at)cybertec(dot)at> |
---|---|
To: | Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: pg_log_fatal vs pg_log_error |
Date: | 2019-07-10 08:58:57 |
Message-ID: | 9743.1562749137@spoje.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com> wrote:
> On 2019-06-17 14:19, Antonin Houska wrote:
> > Can anyone please give me a hint (and possibly add some comments to the code)
> > when pg_log_fatal() should be used in frontend code and when it's appropriate
> > to call pg_log_error()? The current use does not seem very consistent.
>
> For a program that runs in a loop, like for example psql or
> pg_receivewal, use error if the program keeps running and fatal if not.
> For one-shot programs like for example createdb, there is no difference,
> so we have used error in those cases.
That makes sense, but shouldn't then pg_log_fatal() perform exit(EXIT_FAILURE)
internally? Just like elog(FATAL) does on backend side.
Actually there are indications that someone would appreciate such behaviour
even in frontends.
In pg_rewind.h I see:
/* logging support */
#define pg_fatal(...) do { pg_log_fatal(__VA_ARGS__); exit(1); } while(0)
or this in pg_upgrade/util.c:
void
pg_fatal(const char *fmt,...)
{
va_list args;
va_start(args, fmt);
pg_log_v(PG_FATAL, fmt, args);
va_end(args);
printf(_("Failure, exiting\n"));
exit(1);
}
--
Antonin Houska
Web: https://www.cybertec-postgresql.com
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2019-07-10 09:40:59 | Re: Custom table AMs need to include heapam.h because of BulkInsertState |
Previous Message | Antonin Houska | 2019-07-10 08:47:02 | Re: [Proposal] Table-level Transparent Data Encryption (TDE) and Key Management Service (KMS) |