Re: pg_size_pretty, SHOW, and spaces

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Christoph Berg <myon(at)debian(dot)org>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Greg Stark <stark(at)mit(dot)edu>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, thomas(dot)berger(at)1und1(dot)de, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_size_pretty, SHOW, and spaces
Date: 2016-08-02 16:51:16
Message-ID: 20160802165116.GC32575@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On Tue, Aug 2, 2016 at 11:29:01AM +0200, Christoph Berg wrote:
> > The issue is that we output "10 bytes", not "10bytes", but for units we
> > use "977KB". That seems inconsistent, but it is the normal policy
> > people use. I think this is because "977KB" is really "977K bytes", but
> > we just append the "B" after the "K" for bevity.
>
> It's the other way round:
>
> https://en.wikipedia.org/wiki/International_System_of_Units#General_rules
>
> | The value of a quantity is written as a number followed by a space
> | (representing a multiplication sign) and a unit symbol; e.g., 2.21 kg
> [...]
>
> I'd opt to omit the space anywhere where the value is supposed to be
> fed back into the config (SHOW, --parameters), but use the "pretty"
> format with space everywhere otherwise (documentation, memory counts
> in explain output, pg_size_pretty() etc.)

Yes, that's a strong argument for using a space. I have adjusted the
patch to use spaces in all reasonable places. Patch attached, which I
have gzipped because it was 133 KB. (Ah, see what I did there?) :-)

I am thinking of leaving the 9.6 docs alone as I have already made them
consistent (no space) with minimal changes. We can make it consistent
the other way in PG 10.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

Attachment Content-Type Size
kilo2.diff.gz application/gzip 27.0 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Eisentraut 2016-08-02 17:48:10 Re: BUG #13810: cursor_to_xml ignores tableforest parameter
Previous Message Tom Lane 2016-08-02 16:05:57 Re: BUG #14271: Please fix 13804 bug

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2016-08-02 17:17:27 Re: parallel.c is not marked as test covered
Previous Message Andrew Gierth 2016-08-02 16:43:42 Re: Wanting to learn about pgsql design decision