Re: Simplify the way of appending comma to stringInfo

2025-12-08 Thread Tom Lane
Heikki Linnakangas writes: > On 08/12/2025 10:37, Chao Li wrote: >> The old patterns are used in a lot of places, and there are some usages >> of the new pattern as well. Instead of creating a big cleanup patch, I >> just applied the new pattern to a single file for now to see if the >> hacker

Re: Simplify the way of appending comma to stringInfo

2025-12-08 Thread David Geier
On 08.12.2025 09:43, Heikki Linnakangas wrote: > On 08/12/2025 10:37, Chao Li wrote: >> Hi Hackers, >> >> In a lot places, there are logic of appending comma separators in a >> pattern like: >> >> ``` >> for (int i = 0; i < len; i ++) >> { >>      if (i > 0) >>         appendStringInfoString(",

Re: Simplify the way of appending comma to stringInfo

2025-12-08 Thread Heikki Linnakangas
On 08/12/2025 10:37, Chao Li wrote: Hi Hackers, In a lot places, there are logic of appending comma separators in a pattern like: ``` for (int i = 0; i < len; i ++) {     if (i > 0)        appendStringInfoString(", ");     appendStringInfo(some-item); } ``` This pattern uses an "if" check

Re: Simplify the way of appending comma to stringInfo

2025-12-08 Thread Pavel Stehule
Hi po 8. 12. 2025 v 9:37 odesílatel Chao Li napsal: > Hi Hackers, > > In a lot places, there are logic of appending comma separators in a > pattern like: > > ``` > for (int i = 0; i < len; i ++) > { > if (i > 0) >appendStringInfoString(", "); > appendStringInfo(some-item); > } >

Simplify the way of appending comma to stringInfo

2025-12-08 Thread Chao Li
Hi Hackers, In a lot places, there are logic of appending comma separators in a pattern like: ``` for (int i = 0; i < len; i ++) { if (i > 0) appendStringInfoString(", "); appendStringInfo(some-item); } ``` This pattern uses an "if" check and two appendStringInfoString() to build