Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 4BA781337C2B for ; Sun, 24 Apr 2011 15:18:12 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 08560-01-3 for ; Sun, 24 Apr 2011 18:18:12 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by mail.postgresql.org (Postfix) with ESMTP id 761461337BF2 for ; Sun, 24 Apr 2011 15:17:51 -0300 (ADT) Received: from wwwmaster.postgresql.org (wwwmaster.postgresql.org [217.196.146.204]) by wwwmaster.postgresql.org (8.14.3/8.14.3) with ESMTP id p3OIHofC039650 for ; Sun, 24 Apr 2011 18:17:50 GMT (envelope-from www@wwwmaster.postgresql.org) Received: (from www@localhost) by wwwmaster.postgresql.org (8.14.3/8.14.3/Submit) id p3OIHoZk039649; Sun, 24 Apr 2011 18:17:50 GMT (envelope-from www) Date: Sun, 24 Apr 2011 18:17:50 GMT Message-Id: <201104241817.p3OIHoZk039649@wwwmaster.postgresql.org> To: pgsql-bugs@postgresql.org Subject: BUG #5993: pg_size_pretty overflow From: "nicola75ss" Content-Type: text/plain; charset=utf-8 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 201104/190 X-Sequence-Number: 30109 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