> On Oct 15, 2026, at 18:43, David Rowley <[email protected]> wrote:
> 
> On Thu, 15 Oct 2026 at 23:20, Japin Li <[email protected]> wrote:
>> I believe the current patch is the smallest correct fix.  Introducing 
>> StringInfo
>> would be unnecessary over-engineering.
> 
> I'm assuming this is master only, so why does it need to be a minimal
> fix? StringInfo is just the way we normally do incremental building of
> strings. It's an API that most people who work on our code understand.
> Manually calling repalloc() is tedious and more likely to have bugs.
> 
> Using StringInfo will also cut down on the number of reallocs due to
> the size doubling. It'll also allow the
> PG_RETURN_TEXT_P(cstring_to_text(result)); to be updated to use
> cstring_to_text_with_len using the StringInfo's len field.
> 
> David

I tried StringInfo first. A few minor reasons led me to choose the v1 approach:

* v1 made fewer changes to the existing code.
* v1 was slightly faster in my test. With debug and assertions disabled, v1 
took about 20 ms and StringInfo about 24 ms, averaged over multiple runs.

I agree that using the usual API outweigh these minor considerations. I've 
updated the patch to use StringInfo in v2.

Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/




Attachment: v2-0001-Use-StringInfo-to-build-the-result-in-oidvectorty.patch
Description: Binary data

Reply via email to