On Mon, Mar 27, 2017 at 8:24 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
Pushed with minor adjustments.
Excellent - thanks for your review and all the discussion here!
The main non-cosmetic thing I did was to replace the floor(log10()) business with plain constant "10" as I suggested before. That's what we do in other places --- see int4out for an example --- and frankly I did not feel that a small space savings in a transient string buffer was worth the intellectual effort to verify whether that calculation was correct or not, never mind whatever runtime cycles it would take. I don't believe the argument that it's safer your way: if you had an off-by-one thinko in the calculation, or even just roundoff error in the log10() call, it could result in an actual reachable buffer overrun, because there's no safety margin.