Re: Add support for unit "B" to pg_size_pretty()
Peter Eisentraut <peter.eisentraut@enterprisedb.com>
From: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
To: David Rowley <dgrowleyml@gmail.com>
Cc: Justin Pryzby <pryzby@telsasoft.com>, pgsql-hackers@postgresql.org
Date: 2023-03-06T08:13:41Z
Lists: pgsql-hackers
Attachments
- v4-0001-Add-support-for-unit-B-to-pg_size_bytes.patch (text/plain) patch v4-0001
On 02.03.23 20:58, David Rowley wrote: > On Mon, 27 Feb 2023 at 21:34, Peter Eisentraut > <peter.eisentraut@enterprisedb.com> wrote: >> >> On 22.02.23 03:39, David Rowley wrote: >>> 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.) > > I think I'd prefer to see the size_bytes_unit_alias struct have an > index into size_pretty_units[] array. i.e: Ok, done that way. (I had thought about that, but I was worried that that would be too error-prone to maintain. But I suppose the tables don't change that often, and test cases would easily catch mistakes.) I also updated the documentation a bit more.
Commits
-
Add support for unit "B" to pg_size_bytes()
- ce1215d9b05b 16.0 landed
-
doc: Update pg_size_pretty documentation about petabytes support
- af4d5715fc73 16.0 landed
- ae4860183213 15.3 landed