Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bUBVo-0003Ri-LA for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Aug 2016 11:36:00 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bUBVn-0000iu-Rd for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Aug 2016 11:35:59 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUBVm-0000i8-LP for pgsql-hackers@postgresql.org; Mon, 01 Aug 2016 11:35:58 +0000 Received: from feynman.df7cb.de ([195.49.152.168]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bUBVj-0006IQ-AH for pgsql-hackers@postgresql.org; Mon, 01 Aug 2016 11:35:57 +0000 Received: from msg.df7cb.de (benz.df7cb.de [IPv6:2001:6f8:10ee:e:134::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by feynman.df7cb.de (Postfix) with ESMTPSA id 3s2y2K3hgKz3DxB; Mon, 1 Aug 2016 13:35:53 +0200 (CEST) Date: Mon, 1 Aug 2016 13:35:53 +0200 From: Christoph Berg To: Bruce Momjian Cc: Tom Lane , Greg Stark , "David G. Johnston" , thomas.berger@1und1.de, PostgreSQL-development Subject: pg_size_pretty, SHOW, and spaces Message-ID: <20160801113552.ntkqnz77l6yvwpjx@msg.df7cb.de> Mail-Followup-To: Christoph Berg , Bruce Momjian , Tom Lane , Greg Stark , "David G. Johnston" , thomas.berger@1und1.de, PostgreSQL-development References: <20160712133638.1409.99068@wrigleys.postgresql.org> <20160730001838.GA22405@momjian.us> <794.1469889358@sss.pgh.pa.us> <20160730181643.GD22405@momjian.us> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20160730181643.GD22405@momjian.us> User-Agent: Mutt/1.6.2-neo (2016-07-23) X-Pg-Spam-Score: -3.1 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org 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