Re: Add support for unit "B" to pg_size_pretty()

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: Add support for unit "B" to pg_size_pretty()
Дата
Msg-id c5fa9c81-f53d-8fd9-dfba-bc8c7091d5db@enterprisedb.com
обсуждение исходный текст
Ответ на Re: Add support for unit "B" to pg_size_pretty()  (David Rowley <dgrowleyml@gmail.com>)
Ответы Re: Add support for unit "B" to pg_size_pretty()
Список pgsql-hackers
On 22.02.23 03:39, David Rowley wrote:
> hmm. I didn't really code pg_size_pretty with aliases in mind. I don't
> think you can do this. There's code in pg_size_pretty() and
> pg_size_pretty_numeric() that'll not work correctly. We look ahead to
> the next unit to check if there is one so we know we must use this
> unit if there are no other units to convert to.

> I think you'll need to find another way to make the aliases work.
> Maybe another array with the name and an int to reference the
> corresponding index in size_pretty_units.

Ok, here is a new patch with a separate table of aliases.  (Might look 
like overkill, but I think the "PiB" etc. example you had could actually 
be a good use case for this as well.)

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Kyotaro Horiguchi
Дата:
Сообщение: Real config values for bytes needs quotes?
Следующее
От: "Drouvot, Bertrand"
Дата:
Сообщение: Re: Change xl_hash_vacuum_one_page.ntuples from int to uint16