Re: custom function for converting human readable sizes to bytes
| От | Corey Huinker |
|---|---|
| Тема | Re: custom function for converting human readable sizes to bytes |
| Дата | |
| Msg-id | CADkLM=fSCYg0UAYxx3pZC5zrkYJr5he1NcjHPnjrheSP+Dz42Q@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: custom function for converting human readable sizes to bytes (Pavel Stehule <pavel.stehule@gmail.com>) |
| Ответы |
Re: custom function for converting human readable sizes to
bytes
|
| Список | pgsql-hackers |
On Sun, Nov 22, 2015 at 11:24 PM, Pavel Stehule <pavel.stehule@gmail.com> wrote:
2015-11-22 23:54 GMT+01:00 Corey Huinker <corey.huinker@gmail.com>:I was going to suggest pg_size_ugly(), but unpretty does emphasize the inverse (rather than opposite) nature of the function.What about pg_size_unpretty()?
"unpretty", "ugly" aren't good namesmaybe pg_size_bytes or different approachwe can introduce data type - bytesize - default input/output is human readable text - and conversion to bigint is implicitSome likeselect .. where pg_table_size(oid) > bytesize '3.5GB'and instead pg_size_pretty(pg_table_size(oid)) we can write pg_table_size(oid)::bytesizeRegardsPavel
+1 to both pg_size_bytes() and ::bytesize. Both contribute to making the statements more self-documenting.
В списке pgsql-hackers по дате отправления: