From: | Jacob Champion <pchampion(at)vmware(dot)com> |
---|---|
To: | "tgl(at)sss(dot)pgh(dot)pa(dot)us" <tgl(at)sss(dot)pgh(dot)pa(dot)us>, "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz> |
Cc: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Dependency to logging in jsonapi.c |
Date: | 2021-06-30 15:47:19 |
Message-ID: | c31af0d7bfe02fe122531e5d4e8b4bb618edff68.camel@vmware.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, 2021-06-30 at 11:03 -0400, Tom Lane wrote:
> 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.
FWIW this is one of the fixes (patch 0002) in the JSON-for-libpq thread
[1]. It ensures that all returned error strings are freeable by the
caller. That in turn was the impetus for the asprintf port suggestion.
But until/unless that is changed, an #ifndef seems like a good way to
prevent issues for the current code.
--Jacob
From | Date | Subject | |
---|---|---|---|
Next Message | Laurenz Albe | 2021-06-30 15:55:21 | Re: Removing unneeded self joins |
Previous Message | Tom Lane | 2021-06-30 15:45:27 | Re: trivial improvement to system_or_bail |