Re: Improve a few appendStringInfo calls new to v18

2025-04-11 Thread Tom Lane
Peter Eisentraut writes: > Would it be useful to augment appendStringInfo() something like this: > if (VA_ARGS_NARGS() == 0) > return appendStringInfoString(str, fmt); That would change the behavior in edge cases, for instance appendStringInfo(str, "foo%%bar"). Maybe we'd never hit those,

Re: Improve a few appendStringInfo calls new to v18

2025-04-11 Thread Nathan Bossart
On Fri, Apr 11, 2025 at 10:40:57AM +1200, David Rowley wrote: > On Fri, 11 Apr 2025 at 02:51, Nathan Bossart wrote: >> This probably isn't v18 material, but this reminds me of my idea to change >> appendStringInfoString() into a macro for appendBinaryStringInfo() so that >> the compiler can remove

Re: Improve a few appendStringInfo calls new to v18

2025-04-11 Thread Peter Eisentraut
On 10.04.25 05:51, David Rowley wrote: Looks like v18 has grown a few appendStringInfo misusages, e.g. using appendStringInfo() when no formatting is needed or just using format "%s" instead of using appendStringInfoString(). Would it be useful to augment appendStringInfo() something like this:

Re: Improve a few appendStringInfo calls new to v18

2025-04-10 Thread David Rowley
On Fri, 11 Apr 2025 at 02:51, Nathan Bossart wrote: > This probably isn't v18 material, but this reminds me of my idea to change > appendStringInfoString() into a macro for appendBinaryStringInfo() so that > the compiler can remove the runtime strlen() calls for string literals [0]. > In most case

Re: Improve a few appendStringInfo calls new to v18

2025-04-10 Thread David Rowley
On Thu, 10 Apr 2025 at 20:24, Heikki Linnakangas wrote: > > On 10/04/2025 06:51, David Rowley wrote: > > Any objections to doing this soonish? Or in a few weeks? > > Sure, let's do it. Why would we wait? Great. Pushed. Was considering waiting as I didn't know if there was a revert-fest looming o

Re: Improve a few appendStringInfo calls new to v18

2025-04-10 Thread Nathan Bossart
On Thu, Apr 10, 2025 at 11:24:36AM +0300, Heikki Linnakangas wrote: > On 10/04/2025 06:51, David Rowley wrote: >> Any objections to doing this soonish? Or in a few weeks? > > Sure, let's do it. Why would we wait? +1. You did something similar for v17 (commit 8461424), and it seems like an entire

Re: Improve a few appendStringInfo calls new to v18

2025-04-10 Thread Heikki Linnakangas
On 10/04/2025 06:51, David Rowley wrote: Looks like v18 has grown a few appendStringInfo misusages, e.g. using appendStringInfo() when no formatting is needed or just using format "%s" instead of using appendStringInfoString(). I've attached a couple of patches. The 0001 is just my method for fi

Improve a few appendStringInfo calls new to v18

2025-04-09 Thread David Rowley
Looks like v18 has grown a few appendStringInfo misusages, e.g. using appendStringInfo() when no formatting is needed or just using format "%s" instead of using appendStringInfoString(). I've attached a couple of patches. The 0001 is just my method for finding these, not for commit. 0002 contains