pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Jacob Champion <pchampion@vmware.com>
Cc: daniel@yesql.se <daniel@yesql.se>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Cc: michael@paquier.xyz <michael@paquier.xyz>
Subject: Re: [PATCH] Make jsonapi usable from libpq
Date: Tue, 29 Jun 2021 15:34:29 -0400
Message-ID: <499672.1624995269@sss.pgh.pa.us> (raw)
In-Reply-To: <ea0cdb0974cca85805c6d8131e8eeba0fd811444.camel@vmware.com>
References: <a250d475ba1c0cc0efb7dfec8e538fcc77cdcb8e.camel@vmware.com>
	<YNQedHwheUaTnnGt@paquier.xyz>
	<daeb22ec6ca8ef61e94d766a9b35fb03cabed38e.camel@vmware.com>
	<YNZ2mnsbDVJQrA/a@paquier.xyz>
	<c475057da66fdc5ae707a89f5b44dd8508b86f7e.camel@vmware.com>
	<497374.1624992620@sss.pgh.pa.us>
	<ea0cdb0974cca85805c6d8131e8eeba0fd811444.camel@vmware.com>

Jacob Champion <pchampion@vmware.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





view thread (21+ messages)  latest in thread

Message-ID: <499672.1624995269@sss.pgh.pa.us>
Permalink:  ../499672.1624995269@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/499672.1624995269@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pchampion@vmware.com, daniel@yesql.se, michael@paquier.xyz
  Subject: Re: [PATCH] Make jsonapi usable from libpq
  In-Reply-To: <499672.1624995269@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox