Re: custom function for converting human readable sizes to bytes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: "Shulgin, Oleksandr" <oleksandr(dot)shulgin(at)zalando(dot)de>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: custom function for converting human readable sizes to bytes
Date: 2016-01-04 15:51:20
Message-ID: CA+TgmoZMbwq-Lb_E06pDXttUf9LhWu2q+7JLqev2nphbEvTFCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jan 4, 2016 at 10:17 AM, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> wrote:
> [ new patch ]

+ case '-':
+ ereport(ERROR,
+ (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
+ errmsg("size cannot be negative")));

Why not? I bet if you copy any - sign to the buffer, this will Just Work.

+ if ( conv->base_unit == GUC_UNIT_KB &&

Whitespace.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2016-01-04 15:51:25 Re: Building pg_xlogdump reproducibly
Previous Message Tom Lane 2016-01-04 15:49:37 Re: Some 9.5beta2 backend processes not terminating properly?