Re: custom function for converting human readable sizes to bytes - Mailing list pgsql-hackers

From Pavel Stehule
Subject Re: custom function for converting human readable sizes to bytes
Date
Msg-id CAFj8pRBRzZDE3=o+s_x_LuB+62LEuZ8iJK59XumtuC=Beb61dw@mail.gmail.com
Whole thread Raw
In response to Re: custom function for converting human readable sizes to bytes  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Responses Re: custom function for converting human readable sizes to bytes  (Jim Nasby <Jim.Nasby@BlueTreble.com>)
Re: custom function for converting human readable sizes to bytes  (Pavel Stehule <pavel.stehule@gmail.com>)
List pgsql-hackers
Hi

2015-11-23 19:47 GMT+01:00 Alvaro Herrera <alvherre@2ndquadrant.com>:
Pavel Stehule wrote:

> so pg_size_bytes is good enough for everybody?

That seems good enough to me.

I would have it accept GiB and GB and have both transform to base 2, and
have an optional boolean flag whose non-default value turns the GB
interpretation into base 10, leaving the GiB interpretation unaffected.

attached proof concept based on parser "parse_int" from guc.c

It works well to 1TB what is enough for memory setting, but too low for proposed target.

There are two ways

1. enhance the "parse_int"

2. using independent implementation - there is some redundant code, but we can support duble insted int, and we can support some additional units.

Regards

Pavel


--
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

Attachment

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: problem with msvc linker - cannot build orafce
Next
From: Craig Ringer
Date:
Subject: Re: problem with msvc linker - cannot build orafce