StringInfo fixes, v19 edition. Plus a few oddities

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Subject: StringInfo fixes, v19 edition. Plus a few oddities
Date: 2026-04-12 00:40:53
Message-ID: CAApHDvohYOdrvhVxXzCJNX_GYMSWBfjTTtB6hgDauEtZ8Nar2A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Just like in 8461424fd and 928394b66, which fixed up some StringInfo
usages that crept in during v17 and v18. The attached patches are for
the v19 ones.

All of these changes in 0003 are in code that was touched since the
last time I fixed these in 928394b66. However, the test_escape.c one
added in 627acc3ca is in v18 as it was added after 928394b66 and
before we branched for v19. Almost all of the describe.c ones were
introduced in 41d69e6dc. These ones technically did exist in prior
versions. They're only being highlighted now because the function
changed from printfPQExpBuffer to appendPQExpBuffer, and I must not
have made my StaticAsserts work for printfPQExpBuffer. I left these
in anyway since that code was touched in v19, and future bug fixes
might conflict because of those changes anyway.

The 0002 patch contains a few things I'm less sure about.
append_tuple_value_detail() contains some pretty weird translation
strings. The code currently does:

/* translator: This is the terminator of a conflict message */
appendStringInfoString(buf, _("."));

I'm not a translator, but isn't that going to be pretty hard to know
what to do with, given that the same string could be used for anything
else in the code and need something completely different done? That
same function also contains a _(": ") and _(", ") which seem equally
hard to deal with.

The 0002 patch also contains some:

- HELP0("\n");
+ HELPC('\n');

which I did mostly to make 0001 compile. I didn't check why I didn't
find those last year. I was unsure if it was worth making those
changes or not. It seems fairly pointless apart from just not having
to rediscover them again next year. Likewise for the change in
fe-auth-oauth.c.

0001 is the code changes I used to find all these anomalies. It's not
for commit, but attached for reference, or for anyone else who wants
to play around with it.

I don't see any reason not to push 0003, but will happily take
comments in the meantime. I'm not planning on pushing 0002, but things
there might be worth discussing. I'm including Amit for the
append_tuple_value_detail() translation string part from 48efefa6ca.

David

Attachment Content-Type Size
v1-0001-Adjust-code-to-highlight-appendStringInfo-misusag.patch application/octet-stream 16.3 KB
v1-0002-Oddities.patch application/octet-stream 7.3 KB
v1-0003-Improve-various-new-to-v19-appendStringInfo-calls.patch application/octet-stream 25.0 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-04-12 01:12:08 Re: StringInfo fixes, v19 edition. Plus a few oddities
Previous Message Sami Imseih 2026-04-11 20:10:42 Re: Add missing CHECK_FOR_INTERRUPTS in autovacuum catalog scan loops