Re: Add support for unit "B" to pg_size_pretty()
От | Peter Eisentraut |
---|---|
Тема | Re: Add support for unit "B" to pg_size_pretty() |
Дата | |
Msg-id | e465dc9e-2d88-6ff7-9fa6-d41ab78dd56e@enterprisedb.com обсуждение исходный текст |
Ответ на | Re: Add support for unit "B" to pg_size_pretty() (Justin Pryzby <pryzby@telsasoft.com>) |
Ответы |
Re: Add support for unit "B" to pg_size_pretty()
|
Список | pgsql-hackers |
On 20.02.23 15:34, Justin Pryzby wrote: > 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 ? yes > pg_size_pretty() already supports "bytes", so this doesn't actually make > sizes any more pretty, or evidently change its output at all. Right, this is for the input side. >> 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. I have added a comment about that.
Вложения
В списке pgsql-hackers по дате отправления: