Re: custom function for converting human readable sizes to bytes

Pavel Stehule <pavel.stehule@gmail.com>

From: Pavel Stehule <pavel.stehule@gmail.com>
To: Jim Nasby <Jim.Nasby@bluetreble.com>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Date: 2015-11-22T20:27:08Z
Lists: pgsql-hackers
2015-11-22 21:19 GMT+01:00 Jim Nasby <Jim.Nasby@bluetreble.com>:

> On 11/22/15 2:11 PM, Pavel Stehule wrote:
>
>> What about pg_size(text), pg_size(value bigint, unit text) ?
>>
>
> I like, though I'd make it numeric or float. pg_size(3.5, 'GB') certainly
> seems like a reasonable use case...


yes, good note.

Regards

Pavel


>
> --
> Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
> Experts in Analytics, Data Architecture and PostgreSQL
> Data in Trouble? Get it in Treble! http://BlueTreble.com
>

Commits

  1. Add pg_size_bytes() to parse human-readable size strings.

  2. Refactor check_functional_grouping() to use get_primary_key_attnos().

  3. Correct comment in GetConflictingVirtualXIDs()

  4. Make extract() do something more reasonable with infinite datetimes.

  5. pg_size_pretty: Format negative values similar to positive ones.

  6. pg_size_pretty(numeric)