]> granicus.if.org Git - postgresql/commit
Fix pg_size_pretty() to avoid overflow for inputs close to INT64_MAX.
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 25 Apr 2011 20:22:24 +0000 (16:22 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 25 Apr 2011 20:22:24 +0000 (16:22 -0400)
commit049e8b07fa076ac20662180152f122ba59f96f9f
treedda8b7b98c15f299e3c95a7c1e82dcd5ec8cf8e5
parent3c34d7ee8e4617efd3d18999a4453f76bce93f55
Fix pg_size_pretty() to avoid overflow for inputs close to INT64_MAX.

The expression that tried to round the value to the nearest TB could
overflow, leading to bogus output as reported in bug #5993 from Nicola
Cossu.  This isn't likely to ever happen in the intended usage of the
function (if it could, we'd be needing to use a wider datatype instead);
but it's not hard to give the expected output, so let's do so.
src/backend/utils/adt/dbsize.c