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.g.johnston@gmail.com>:
> On Mon, Apr 6, 2015 at 10:30 AM, <cbalmeida@gmail.com> wrote:
>
>> The following bug has been logged on the website:
>>
>> Bug reference: 12989
>> Logged by: Christian Almeida
>> Email address: cbalmeida@gmail.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.
>