Re: pg_croak, or something like it?

2020-01-27 Thread Robert Haas
On Mon, Jan 27, 2020 at 11:07 AM Tom Lane wrote: > I have not, but I'm still going to stand by that point. It is not > credible that the code we will want to share between frontend and > backend will never contain any user-facing error reports. It's hard to refute a statement this general; it ca

Re: pg_croak, or something like it?

2020-01-27 Thread Tom Lane
Robert Haas writes: > On Mon, Jan 27, 2020 at 10:50 AM Tom Lane wrote: >> What it sounds to me like you want to do is implement (some equivalent of) >> elog() but not ereport() for this environment. I'm going to resist that >> pretty strongly, because I think it will lead directly to abuse of el

Re: pg_croak, or something like it?

2020-01-27 Thread Robert Haas
On Mon, Jan 27, 2020 at 10:50 AM Tom Lane wrote: > So? elog() is just a specific degenerate case of ereport(). If we have > a way to implement ereport() on frontend side then we can surely do > elog() too. I suppose that's true. > What it sounds to me like you want to do is implement (some equ

Re: pg_croak, or something like it?

2020-01-27 Thread Tom Lane
Robert Haas writes: > On Mon, Jan 27, 2020 at 10:08 AM Tom Lane wrote: >> What I keep thinking is that we should stick with ereport() as the >> reporting notation, and invent a frontend-side implementation of it >> that covers the cases you mention (ie WARNING and ERROR ... and maybe >> DEBUG?),

Re: pg_croak, or something like it?

2020-01-27 Thread Robert Haas
On Mon, Jan 27, 2020 at 10:08 AM Tom Lane wrote: > > Something like: > > #ifdef FRONTEND > > #define pg_croak(...) do { pg_log_fatal(__VA_ARGS__); exit(1) } while (0) > > #define pg_carp(...) pg_log_warning(__VA_ARGS__); > > #else > > #define pg_croak(...) elog(ERROR, __VA_ARGS__) > > #define pg_c

Re: pg_croak, or something like it?

2020-01-27 Thread Tom Lane
Robert Haas writes: > Probably the thorniest problem is the backend's widespread dependence > on ereport() and elog(). Now, it would not be enormously difficult to > code up something that will sigsetjmp() and siglongjmp() in front-end > code just as we do in backend code, but I think it would be

pg_croak, or something like it?

2020-01-27 Thread Robert Haas
Hi, Recent developments on the "backup manifest" thread and others have caused me to take an interest in making more code that has historically been backend-only accessible in frontend environments also. I'm pretty sure I'm not alone in having often wished for more backend-only facilities to be av