From: Christoph Berg <myon@debian.org>
To: Bruce Momjian <bruce@momjian.us>
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: pg_size_pretty, SHOW, and spaces
Date: Mon, 1 Aug 2016 13:35:53 +0200
Message-ID: <20160801113552.ntkqnz77l6yvwpjx@msg.df7cb.de> (raw)
In-Reply-To: <20160730181643.GD22405@momjian.us>
References: <20160712133638.1409.99068@wrigleys.postgresql.org>
<20160730001838.GA22405@momjian.us>
<CAKFQuwabqqy-R76GnaCL+KWOmipC0mio=mFoZqoXqDQSw+YwTg@mail.gmail.com>
<CAM-w4HNRZmna6BFRQYDmXV_nH26YAJD-5m2yLHQWrRh08yb9hg@mail.gmail.com>
<794.1469889358@sss.pgh.pa.us>
<20160730181643.GD22405@momjian.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Re: Bruce Momjian 2016-07-30 <20160730181643.GD22405@momjian.us>
> I also just applied a doc patch that increases case and spacing
> consistency in the use of kB/MB/GB/TB.
Hi,
PostgreSQL uses the spaces inconsistently, though. pg_size_pretty uses spaces:
# select pg_size_pretty((2^20)::bigint);
pg_size_pretty
────────────────
1024 kB
SHOW does not:
# show work_mem;
work_mem
──────────
1MB
The SHOW output is formatted by _ShowOption() using 'INT64_FORMAT "%s"',
via convert_from_base_unit(). The latter has a comment attached...
/*
* Convert a value in some base unit to a human-friendly unit. The output
* unit is chosen so that it's the greatest unit that can represent the value
* without loss. For example, if the base unit is GUC_UNIT_KB, 1024 is
* converted to 1 MB, but 1025 is represented as 1025 kB.
*/
... where the spaces are present again.
General typesetting standard seems to be "1 MB", i.e. to include a
space between value and unit. (This would also be my preference.)
Opinions? (I'd opt to insert spaces in the docs now, and then see if
inserting a space in the SHOW output is acceptable for 10.0.)
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, 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: <20160801113552.ntkqnz77l6yvwpjx@msg.df7cb.de>
References: <20160712133638.1409.99068@wrigleys.postgresql.org> <20160730001838.GA22405@momjian.us> <CAKFQuwabqqy-R76GnaCL+KWOmipC0mio=mFoZqoXqDQSw+YwTg@mail.gmail.com> <CAM-w4HNRZmna6BFRQYDmXV_nH26YAJD-5m2yLHQWrRh08yb9hg@mail.gmail.com> <794.1469889358@sss.pgh.pa.us> <20160730181643.GD22405@momjian.us> <20160801113552.ntkqnz77l6yvwpjx@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