On Thu, 8 Jul 2021 at 07:31, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> 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.
That's a good point. We should probably leave it alone then. I had
had it in mind that it might be ok since we did this for extract() in
14. At least we have date_part() as a backup there. I'm fine to leave
the return value of pg_size_bytes as-is.
> 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.
I'm fine with that too. In [1] I mentioned my concerns with adding
all the defined units up to Yottabyte. David reduced that down to just
exabytes, but I think if we're keeping pg_size_bytes returning bigint
then drawing the line at PB seems ok to me. Anything more than
pg_size_bytes('8 EB') would overflow.
David
[1] https://www.postgresql.org/message-id/CAApHDvp9ym+RSQNGoSRPjH+j6TJ1tFBhfT+JoLFf_RbZq1EszQ@mail.gmail.com