Re: Proposal: add new API to stringinfo

Tatsuo Ishii <ishii@postgresql.org>

From: Tatsuo Ishii <ishii@postgresql.org>
To: dgrowleyml@gmail.com
Cc: pgsql-hackers@postgresql.org
Date: 2025-01-05T01:51:29Z
Lists: pgsql-hackers

Attachments

> If you have trouble convincing people we need this for some new
> reason, then maybe you could review the existing callers to see if
> some of the existing call sites make it any more convincing.
> 
> A very quick review, I found:
> 
> send_message_to_frontend() initStringInfo(&buf) 1024 is probably too big
> HandleParallelMessages() seems to know exactly how many bytes are
> needed. Can this use a read-only StringInfo?
> send_feedback() seems to know what size of the buffer it needs

I looked into send_feedback(). Maybe with the new API we could do
something like attached?

> buf_init() knows the exact size.
> 
> I didn't review the patch in detail, but I think "initsize" would be a
> better parameter name than "size".
> 
> David
> 
> 

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add new StringInfo APIs to allow callers to specify the buffer size.