Re: custom function for converting human readable sizes to bytes

From: Gavin Flower <GavinFlower(at)archidevsys(dot)co(dot)nz>
To: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Jim Nasby <Jim(dot)Nasby(at)bluetreble(dot)com>, Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Guillaume Lelarge <guillaume(at)lelarge(dot)info>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: custom function for converting human readable sizes to bytes
Date: 2015-11-23 18:43:46
Message-ID: 56535E62.6040805@archidevsys.co.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 24/11/15 06:31, Pavel Stehule wrote:
>
>
> 2015-11-23 18:04 GMT+01:00 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us
> <mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us>>:
>
> Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> writes:
> > On 11/23/15 3:11 AM, Corey Huinker wrote:
> >> +1 to both pg_size_bytes() and ::bytesize. Both contribute to
> making the
> >> statements more self-documenting.
>
> > The function seems like overkill to me if we have the type. Just my
> > opinion though. I'm thinking the type could just be called
> 'size' too
> > (or prettysize?). No reason it has to be tied to bytes (in
> particular
> > this would work for bits too).
>
> Please, no. That's *way* too generic a name.
>
> I do not actually agree with making a type for this anyway. I can
> tolerate a function, but adding a datatype is overkill; and it will
> introduce far more definitional issues than it's worth. (eg, which
> other types should have casts to/from it, and at what level)
>
>
> so pg_size_bytes is good enough for everybody?
>
> Regards
>
> Pavel
>
>
> regards, tom lane
>
>
perhaps pg_size_bites for those people who want: KiB, MiB, GiB, TiB,
PiB, ,.. ??? :-)

Cheers,
Gavin

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2015-11-23 18:44:22 Re: Declarative partitioning
Previous Message Kevin Grittner 2015-11-23 18:41:42 New email address