Re: [PATCH] expand the units that pg_size_pretty supports on output

From: David Christensen <david(dot)christensen(at)crunchydata(dot)com>
To: Shinya11(dot)Kato(at)nttdata(dot)com
Cc: dgrowleyml(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: [PATCH] expand the units that pg_size_pretty supports on output
Date: 2021-06-29 17:11:12
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

Shinya11(dot)Kato(at)nttdata(dot)com writes:

>>I had not really looked at the patch, but if there's a cleanup portion to the same
>>patch as you're adding the YB too, then maybe it's worth separating those out
>>into another patch so that the two can be considered independently.
> I agree with this opinion. It seems to me that we should think about units and refactoring separately.
> Sorry for the confusion.
> Best regards,
> Shinya Kato

Hi folks,

Had some time to rework this patch from the two that had previously been
here into two separate parts:

1) A basic refactor of the existing code to easily handle expanding the
units we use into a table-based format. This also includes changing the
return value of `pg_size_bytes()` from an int64 into a numeric, and
minor test adjustments to reflect this.

2) Expanding the units that both pg_size_bytes() and pg_size_pretty()
recognize up through Yottabytes. This includes documentation and test
updates to reflect the changes made here. How many additional units we
add here is up for discussion (inevitably), but my opinion remains that
there is no harm in supporting all units available.



Attachment Content-Type Size
0001-Refactor-pg_size_pretty-and-pg_size_bytes-to-allow-f.patch text/x-patch 6.7 KB
0002-Full-expansion-of-all-units.patch text/x-patch 15.8 KB

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-06-29 17:15:30 Re: Preventing abort() and exit() calls in libpq
Previous Message Alvaro Herrera 2021-06-29 16:50:56 Re: Pipeline mode and PQpipelineSync()