Re: custom function for converting human readable sizes to bytes

From: Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com>
To: Corey Huinker <corey(dot)huinker(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Cc: 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 16:59:04
Message-ID: 565345D8.2090200@BlueTreble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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).

If we're going to add this, I suppose it should support the 'i prefixes'
too (GiB, MiB, etc).
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2015-11-23 17:04:29 Re: custom function for converting human readable sizes to bytes
Previous Message Jim Nasby 2015-11-23 16:50:17 Re: Truncating/vacuuming relations on full tablespaces