Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
Cc: pgsql-committers(at)postgresql(dot)org
Subject: Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
Date: 2016-02-20 10:33:00
Message-ID: CAB7nPqSzz-RJVA_CE_c2_UDEHyphqXuRb1sOKWPEWnoiZTpzmQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

On Sat, Feb 20, 2016 at 7:17 PM, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> wrote:
> On 20 February 2016 at 10:12, Michael Paquier <michael(dot)paquier(at)gmail(dot)com> wrote:
>> Happy first commit.
>
> Arg. Not so much.
>
> Looks like I broke something -- looking into it now :-(

The terabyte conversion is at fault:
Expected:
! -1tb | -1099511627776
Result:
! -1tb | -1

+ else if (pg_strcasecmp(strptr, "gb") == 0)
+ multiplier = 1024 * 1024 * 1024;
+ else if (pg_strcasecmp(strptr, "tb") == 0)
+ multiplier = 1024 * 1024 * 1024 * 1024L;
Why adding an 'L' here?
--
Michael

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Dean Rasheed 2016-02-20 10:48:04 Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.
Previous Message Vik Fearing 2016-02-20 10:32:51 Re: pgsql: Add pg_size_bytes() to parse human-readable size strings.