Re: [BUGS] BUG #14244: wrong suffix for pg_size_pretty()

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
Cc: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, thomas(dot)berger(at)1und1(dot)de, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] BUG #14244: wrong suffix for pg_size_pretty()
Date: 2016-08-02 05:57:23
Message-ID: CAFj8pRB-AUqz=LTxmNneeEPP1N_8MX1S3ge+MyVY5bUPr2nBQw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

2016-08-01 20:51 GMT+02:00 Peter Eisentraut <
peter(dot)eisentraut(at)2ndquadrant(dot)com>:

> On 7/30/16 1:18 AM, Pavel Stehule wrote:
> > We talked about this issue, when I wrote function pg_size_bytes. It is
> > hard to fix these functions after years of usage. The new set of
> > functions can be better
> >
> > pg_iso_size_pretty();
> > pg_iso_size_bytes();
>
> One thing that would actually be nice for other reasons as well is a
> version of pg_size_pretty() that lets you specify the output unit, say,
> as a second argument. Because sometimes you want to compare two tables
> or something, and tells you one is 3GB and the other is 783MB, which
> doesn't really help. If I tell it to use 'MB' as the output unit, I
> could get comparable output.
>

It is looks like some convert function

pg_size_to(size, unit, [others ... rounding, truncating]) returns numeric

select pg_size_to(1024*1024, 'KB')

Regards

Pavel

> --
> Peter Eisentraut http://www.2ndQuadrant.com/
> PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
>

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message John R Pierce 2016-08-02 06:05:08 Re: Create language plperlu Error
Previous Message Om Prakash Jaiswal 2016-08-02 05:47:19 Create language plperlu Error

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-08-02 06:11:31 Re: Increasing timeout of poll_query_until for TAP tests
Previous Message Noah Misch 2016-08-02 05:49:09 Re: Reviewing freeze map code