The following bug has been logged online:
Bug reference: 5993
Logged by: nicola75ss
Email address: nicola75ss@gmail.com
PostgreSQL version: 8.4
Operating system: windows 7
Description: pg_size_pretty overflow
Details:
Good morning. I'm totally newbie with postgresql. I was studying
pg_size_pretty() and I've discovered that if I pass it a great value it
returns negative value.
This is an example
select pg_size_pretty(9223372000000000000); -- "-8388607 TB"
I've asked on stackoverflow
http://stackoverflow.com/questions/5768097/why-does-pg-size-pretty-return-ne
gative-value
and users suggest me to report this as a bug.
They say that the problem in the source code is here
else
{
mult *= 1024;
snprintf(buf, sizeof(buf), INT64_FORMAT " TB",
(size + mult / 2) / mult); /* OVERFLOW! */
}
Regards. Nicola Cossu