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 CAFj8pRAcJ+4xoxkRyZJNJ7dPbwtb42EPaogPH5BfZWoxx44Ysg@mail.gmail.com
Whole thread Raw
In response to Re: custom function for converting human readable sizes to bytes  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: custom function for converting human readable sizes to bytes  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
Hi

new update:

1. unit searching is case insensitive

2. initial support for binary byte prefixes - KiB, MiB, ..  (IEC standard), change behave for SI units

Second point is much more complex then it is looking - if pg_size_bytes should be consistent with pg_size_pretty.

The current pg_size_pretty and transformations in guc.c are based on JEDEC standard. Using this standard for GUC has sense - using it for object sizes is probably unhappy.

I tried to fix (and enhance) pg_size_pretty - now reports correct units, and via second parameter it allows to specify base: 2 (binary, IEC  - default) or 10 (SI).

I think it is good to have it. These standards are generic and wide used, but should to be pretty explained in documentation if we will use JEDEC for configuration. Probably better to leave JEDEC and prefer SI and IEC.

Plan B is fix Postgres on JEDEC only - it is trivial, simple - but it can look like archaic in next years.

Comments, notices?

Regards

Pavel





Attachment

pgsql-hackers by date:

Previous
From: David Rowley
Date:
Subject: Re: [PATCH] Equivalence Class Filters
Next
From: Michael Paquier
Date:
Subject: Re: Re: BUG #13685: Archiving while idle every archive_timeout with wal_level hot_standby