"Marko Kreen" <markokr@gmail.com> writes:
> Attached patch moves decision how much more room to allocate
> from callers of appendStringInfoVA to inside the function,
> where more info is available.
This is by no stretch of the imagination "cleaner".
> On systems with broken vsnprintf() it falls back
> to doubleing the buffer.
The problem with this is that you are defining one particular vsnprintf
behavior as "non broken", without any evidence for that opinion.
(Indeed, one could argue that that behavior is contradictory to what
the Single Unix Spec says, although the SUS is a bit vague about it.)
Our own vsnprintf doesn't follow that behavior, for instance, so we
couldn't even get there by forcing it to be used always.
I'd want to see some significant evidence of a performance issue
before considering hacking this up like this.
regards, tom lane