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

From: David Christensen <david(dot)christensen(at)crunchydata(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Rowley <dgrowleyml(at)gmail(dot)com>, Shinya11(dot)Kato(at)nttdata(dot)com, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] expand the units that pg_size_pretty supports on output
Date: 2021-07-07 19:56:46
Message-ID: lz7di1vqwx.fsf@veeddrois.attlocal.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Tom Lane writes:

> David Christensen <david(dot)christensen(at)crunchydata(dot)com> writes:
>> Enclosed is the patch to change the return type to numeric, as well as one for expanding units to
>> add PB and EB.
>
> Can we really get away with changing the return type? That would
> by no stretch of the imagination be free; one could expect breakage
> of a few user views, for example.

Hmm, that's a good point, and we can't really make the return type polymorphic (being as there isn't
a source type of the given return value).

> Independently of that, I'm pretty much -1 on going further than PB.
> Even if the additional abbreviations you mention are actually recognized
> standards, I think not that many people are familiar with them, and such
> input is way more likely to be a typo than intended data.

If we do go ahead and restrict the expansion to just PB, the return value of pg_size_bytes() would
still support up to 8192 PB before running into range limitations. I assume it's not worth creating
a pg_size_bytes_numeric() with the full range of supported units, but that is presumably an option
as well.

Best,

David

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-07-07 20:22:09 Re: Enhanced error message to include hint messages for redundant options error
Previous Message Tom Lane 2021-07-07 19:31:00 Re: [PATCH] expand the units that pg_size_pretty supports on output