public inbox for [email protected]  
help / color / mirror / Atom feed
From: David G. Johnston <[email protected]>
To: [email protected]
To: [email protected]
Subject: Re: BUG #19456: # Unit-Labeling Issue: `pg_size_pretty()` Incorrectly Labels Binary Units as Decimal Units
Date: Wed, 15 Apr 2026 08:19:02 -0700
Message-ID: <CAKFQuwa+ax2T6V1+FRf2CriNJVRKk-Md2eWYWRiGXxMompTRhg@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Wed, Apr 15, 2026 at 7:48 AM PG Bug reporting form <
[email protected]> wrote:

> The following bug has been logged on the website:
>
> Bug reference:      19456
> Logged by:          GAUTAM KUMAR
> Email address:      [email protected]
> PostgreSQL version: 16.8
> Operating system:   LINUX
> Description:
>
> The function appears to calculate sizes using binary (base-2) division
>

You don't need to infer this, you can just read the documentation.

"Converts a size in bytes into a more easily human-readable format with
size units (bytes, kB, MB, GB, TB, or PB as appropriate). Note that the
units are powers of 2 rather than powers of 10, so 1kB is 1024 bytes, 1MB
is 10242 = 1048576 bytes, and so on."

https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADMIN-DBOBJECT

Which means it is not a bug.  And it's not the kind of behavior we are
going to change on people.

Maybe go write and submit a pg_size_iso(byte_count [, basis 2|10 default
10]) function.  I agree this is a gap that could be addressed.

I'd probably drop the pg_ prefix as well - that always just seemed odd to
me.  We have plenty of functions that are non-standard that we don't prefix
like this.

David J.


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: BUG #19456: # Unit-Labeling Issue: `pg_size_pretty()` Incorrectly Labels Binary Units as Decimal Units
  In-Reply-To: <CAKFQuwa+ax2T6V1+FRf2CriNJVRKk-Md2eWYWRiGXxMompTRhg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox