From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Jacob Champion <pchampion(at)vmware(dot)com> |
Cc: | "daniel(at)yesql(dot)se" <daniel(at)yesql(dot)se>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>, "michael(at)paquier(dot)xyz" <michael(at)paquier(dot)xyz> |
Subject: | Re: [PATCH] Make jsonapi usable from libpq |
Date: | 2021-06-29 19:34:29 |
Message-ID: | 499672.1624995269@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Jacob Champion <pchampion(at)vmware(dot)com> writes:
> On Tue, 2021-06-29 at 14:50 -0400, Tom Lane wrote:
>> The existing convention is to use pqexpbuffer.c, which seems strictly
>> cleaner and more robust than asprintf. In particular its behavior under
>> OOM conditions is far easier/safer to work with. Maybe we should consider
>> moving that into src/common/ so that it can be used by code that's not
>> tightly bound into libpq?
> I will take a look. Were you thinking we'd (hypothetically) migrate all
> string allocation code under src/common to pqexpbuffer as part of that
> move? Or just have it there to use as needed, when nm complains?
Actually, I'd forgotten that the PQExpBuffer functions are already
exported by libpq, and much of our frontend code already uses them
from there. So we don't really need to move anything unless there's
a call to use this code in clients that don't use libpq, which are
a pretty small set.
Also, having them be available both from libpq.so and from libpgcommon.a
would be a tad problematic I think; it'd be hard to tell which way the
linker would choose to resolve that.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Dean Rasheed | 2021-06-29 19:58:38 | WIP: Relaxing the constraints on numeric scale |
Previous Message | Jacob Champion | 2021-06-29 19:26:47 | Re: [PATCH] Make jsonapi usable from libpq |