custom function for converting human readable sizes to bytes

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: custom function for converting human readable sizes to bytes
Date: 2015-11-21 06:49:33
Message-ID: CAFj8pRD-tGoDKnxdYgECzA4On01_uRqPrwF-8LdkSE-6bDHp0w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi

I have to write some filters, and filtering by size is "unfriendly" due
calculation in bytes.

I propose inversion function to pg_size_pretty function - like
pg_human_size.

Usage:

SELECT * FROM pg_class
WHERE pg_table_size(oid) > pg_human_size('2GB');

Ideas, comments?

Regards

Pavel

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Emre Hasegeli 2015-11-21 09:26:04 Re: new full text search configurations
Previous Message Pavel Stehule 2015-11-21 06:14:23 Re: CreateFunction Statement