Re: BUG #12989: pg_size_pretty with negative values

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Christian Almeida <cbalmeida(at)gmail(dot)com>
Cc: "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org>
Subject: Re: BUG #12989: pg_size_pretty with negative values
Date: 2015-04-06 18:33:51
Message-ID: CAKFQuwbYY0sOcTStnjrwNBmzWcFP+vjK36VtTyx5TUX+Pi32ZA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

That's what I get for being quippy...my bad.

I'll let a hacker determine whether this is a bug or a feature request
though it is a POLA violation in either case.

David J.

On Mon, Apr 6, 2015 at 10:54 AM, Christian Almeida <cbalmeida(at)gmail(dot)com>
wrote:

> Of course a file size will never be negative, but a size "delta" can be
> and considering the function purpose, I think it should output "-118 MB".
>
> Christian Almeida
>
>
> 2015-04-06 14:45 GMT-03:00 David G. Johnston <david(dot)g(dot)johnston(at)gmail(dot)com>:
>
> On Mon, Apr 6, 2015 at 10:30 AM, <cbalmeida(at)gmail(dot)com> wrote:
>>
>>> The following bug has been logged on the website:
>>>
>>> Bug reference: 12989
>>> Logged by: Christian Almeida
>>> Email address: cbalmeida(at)gmail(dot)com
>>> PostgreSQL version: 9.3.6
>>> Operating system: Ubuntu 14.04 LTS
>>> Description:
>>>
>>> The function "pg_size_pretty" is not formatting negative numbers.
>>>
>>>
>>> Example:
>>> select pg_size_pretty(+123456789::bigint),
>>> pg_size_pretty(-123456789::bigint)
>>>
>>> Output:
>>> ----------------------------
>>> 118 MB -123456789 bytes
>>>
>>>
>> Do you want the result to be "-118 MB" or "ERROR: invalid input - size
>> cannot be negative (-123456789)"?
>>
>> David J.
>>
>
>

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2015-04-06 18:52:18 Re: BUG #12989: pg_size_pretty with negative values
Previous Message Christian Almeida 2015-04-06 17:54:52 Re: BUG #12989: pg_size_pretty with negative values

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-04-06 18:35:37 Re: Freeze avoidance of very large table.
Previous Message Josh Berkus 2015-04-06 18:28:16 Re: Freeze avoidance of very large table.