Re: Dependency to logging in jsonapi.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Postgres hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Dependency to logging in jsonapi.c
Date: 2021-06-30 15:03:12
Message-ID: 605718.1625065392@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Michael Paquier <michael(at)paquier(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2021-06-30 15:15:11 Re: Merging statistics from children instead of re-sampling everything
Previous Message Yugo NAGATA 2021-06-30 15:02:13 Re: [HACKERS] WIP aPatch: Pgbench Serialization and deadlock errors