From: Christoph Berg <myon@debian.org>
To: Bruce Momjian <bruce@momjian.us>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Greg Stark <stark@mit.edu>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: thomas.berger@1und1.de, PostgreSQL-development <pgsql-hackers@postgresql.org>
Subject: Re: pg_size_pretty, SHOW, and spaces
Date: Tue, 2 Aug 2016 11:29:01 +0200
Message-ID: <20160802092901.xg5ag7emdxoajhds@msg.df7cb.de> (raw)
In-Reply-To: <f3e021d3-d843-04a5-d816-6921309b3bf1@2ndquadrant.com> <20160801162508.GA28246@momjian.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Re: Peter Eisentraut 2016-08-01 <f3e021d3-d843-04a5-d816-6921309b3bf1@2ndquadrant.com>
> > PostgreSQL uses the spaces inconsistently, though. pg_size_pretty uses spaces:
> >
> > # select pg_size_pretty((2^20)::bigint);
> > pg_size_pretty
> > ────────────────
> > 1024 kB
>
> because it's "pretty" :)
:)
> > SHOW does not:
> >
> > # show work_mem;
> > work_mem
> > ──────────
> > 1MB
>
> The original idea might have been to allow that value to be passed back
> into the settings system, without having to quote the space. I'm not
> sure, but I think changing that might cause some annoyance.
That's a good argument for keeping it that way, yes.
Re: Bruce Momjian 2016-08-01 <20160801162508.GA28246@momjian.us>
> Looking at the Wikipedia article I posted earlier, that also doesn't use
> spaces:
>
> https://en.wikipedia.org/wiki/Binary_prefix
That article has plenty of occurrences of "10 MB" "528 MB/s" and the
like.
> I think the only argument _for_ spaces is the output of pg_size_pretty()
> now looks odd, e.g.:
>
> 10 | 10 bytes | -10 bytes
> 1000 | 1000 bytes | -1000 bytes
> 1000000 | 977KB | -977KB
> 1000000000 | 954MB | -954MB
> 1000000000000 | 931GB | -931GB
> 1000000000000000 | 909TB | -909TB
> ^^^^^ ^^^^^
>
> 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.)
Christoph
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: myon@debian.org, bruce@momjian.us, peter.eisentraut@2ndquadrant.com, tgl@sss.pgh.pa.us, stark@mit.edu, david.g.johnston@gmail.com, pgsql-hackers@postgresql.org
Subject: Re: pg_size_pretty, SHOW, and spaces
In-Reply-To: <20160802092901.xg5ag7emdxoajhds@msg.df7cb.de>
References: <20160802092901.xg5ag7emdxoajhds@msg.df7cb.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox