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.