Re: Add support for unit "B" to pg_size_pretty()
| От | Justin Pryzby |
|---|---|
| Тема | Re: Add support for unit "B" to pg_size_pretty() |
| Дата | |
| Msg-id | 20230220143452.GM1653@telsasoft.com обсуждение исходный текст |
| Ответ на | Add support for unit "B" to pg_size_pretty() (Peter Eisentraut <peter.eisentraut@enterprisedb.com>) |
| Ответы |
Re: Add support for unit "B" to pg_size_pretty()
|
| Список | pgsql-hackers |
On Mon, Feb 20, 2023 at 07:44:15AM +0100, Peter Eisentraut wrote:
> This patch adds support for the unit "B" to pg_size_pretty(). This makes it
It seems like what it actually does is to support "B" in pg_size_bytes()
- is that what you meant ?
pg_size_pretty() already supports "bytes", so this doesn't actually make
sizes any more pretty, or evidently change its output at all.
> diff --git a/src/backend/utils/adt/dbsize.c b/src/backend/utils/adt/dbsize.c
> index dbd404101f..9ecd5428c3 100644
> --- a/src/backend/utils/adt/dbsize.c
> +++ b/src/backend/utils/adt/dbsize.c
> @@ -49,6 +49,7 @@ struct size_pretty_unit
> /* When adding units here also update the error message in pg_size_bytes */
> static const struct size_pretty_unit size_pretty_units[] = {
> {"bytes", 10 * 1024, false, 0},
> + {"B", 10 * 1024, false, 0},
This adds a duplicate line (unitbits=0) where no other existing line
uses duplicates. If that's intentional, I think it deserves a comment
highlighting that it's an /*alias*/, and about why that does the right
thing, either here about or in the commit message.
> {"kB", 20 * 1024 - 1, true, 10},
> {"MB", 20 * 1024 - 1, true, 20},
> {"GB", 20 * 1024 - 1, true, 30},
--
Justin
В списке pgsql-hackers по дате отправления: