From: | Peter Eisentraut <peter(dot)eisentraut(at)enterprisedb(dot)com> |
---|---|
To: | David Rowley <dgrowleyml(at)gmail(dot)com> |
Cc: | Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: Add support for unit "B" to pg_size_pretty() |
Date: | 2023-02-27 08:34:10 |
Message-ID: | c5fa9c81-f53d-8fd9-dfba-bc8c7091d5db@enterprisedb.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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.)
Attachment | Content-Type | Size |
---|---|---|
v3-0001-Add-support-for-unit-B-to-pg_size_bytes.patch | text/plain | 6.4 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Drouvot, Bertrand | 2023-02-27 08:36:50 | Re: Change xl_hash_vacuum_one_page.ntuples from int to uint16 |
Previous Message | Kyotaro Horiguchi | 2023-02-27 08:32:17 | Real config values for bytes needs quotes? |