Re: Dependency to logging in jsonapi.c
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Michael Paquier <michael@paquier.xyz>
Cc: Postgres hackers <pgsql-hackers@lists.postgresql.org>
Date: 2021-06-30T15:03:12Z
Lists: 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
Commits
-
Simplify error handing of jsonapi.c for the frontend
- b44669b2ca6a 15.0 landed