Re: [PATCH] expand the units that pg_size_pretty supports on output - Mailing list pgsql-hackers

From David Christensen
Subject Re: [PATCH] expand the units that pg_size_pretty supports on output
Date
Msg-id lz7di1vqwx.fsf@veeddrois.attlocal.net
Whole thread Raw
In response to Re: [PATCH] expand the units that pg_size_pretty supports on output  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane writes:

> David Christensen <david.christensen@crunchydata.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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [PATCH] expand the units that pg_size_pretty supports on output
Next
From: Daniel Gustafsson
Date:
Subject: Re: Enhanced error message to include hint messages for redundant options error