pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #5993: pg_size_pretty overflow
2+ messages / 2 participants
[nested] [flat]

* BUG #5993: pg_size_pretty overflow
@ 2011-04-24 18:17 nicola75ss <nicola75ss@gmail.com>
  2011-04-25 20:23 ` Re: BUG #5993: pg_size_pretty overflow Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 2+ messages in thread

From: nicola75ss @ 2011-04-24 18:17 UTC (permalink / raw)
  To: pgsql-bugs


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



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: BUG #5993: pg_size_pretty overflow
  2011-04-24 18:17 BUG #5993: pg_size_pretty overflow nicola75ss <nicola75ss@gmail.com>
@ 2011-04-25 20:23 ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 2+ messages in thread

From: Tom Lane @ 2011-04-25 20:23 UTC (permalink / raw)
  To: nicola75ss <nicola75ss@gmail.com>; +Cc: pgsql-bugs

"nicola75ss" <nicola75ss@gmail.com> writes:
> 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"

Yeah, that's a bug.  Fixed, thanks for the report!

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2011-04-25 20:23 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2011-04-24 18:17 BUG #5993: pg_size_pretty overflow nicola75ss <nicola75ss@gmail.com>
2011-04-25 20:23 ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox