Re: Dependency to logging in jsonapi.c - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Dependency to logging in jsonapi.c
Date
Msg-id 605718.1625065392@sss.pgh.pa.us
Whole thread Raw
In response to Dependency to logging in jsonapi.c  (Michael Paquier <michael@paquier.xyz>)
Responses Re: Dependency to logging in jsonapi.c
List pgsql-hackers
Michael Paquier <michael@paquier.xyz> writes:
> Attached is a suggestion of patch to rework that a bit.  Some extra
> elog()s could be added for the backend, as well as a new error code to
> use as default of report_parse_error(), but that does not seem to gain
> much.  And this item looks independent of switching this code to use
> pqexpbuffer.h to be more portable with issues like OOM problems.

> Thoughts?

+1 in general, but I think I'd replace the one in report_parse_error
with "Assert(false)", rather than just dropping it.

It does not look to me like json_errdetail can sensibly be used in
frontend, since it returns palloc'd strings in some paths and
constants in others.  There'd be no way to avoid a memory leak
in a frontend usage.  So I think the dependency on psprintf there
is not really a problem, but maybe we should make the entire function
"#ifndef FRONTEND" to clarify the intended usage and avoid building
useless code into clients.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Yugo NAGATA
Date:
Subject: Re: [HACKERS] WIP aPatch: Pgbench Serialization and deadlock errors
Next
From: Tomas Vondra
Date:
Subject: Re: Merging statistics from children instead of re-sampling everything