Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZdpZ-0002KN-En for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Mar 2023 20:22:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pZdpX-0004Uw-AB for pgsql-hackers@arkaria.postgresql.org; Tue, 07 Mar 2023 20:22:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZdpX-0004Um-03 for pgsql-hackers@lists.postgresql.org; Tue, 07 Mar 2023 20:22:39 +0000 Received: from new2-smtp.messagingengine.com ([66.111.4.224]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pZdpT-00029J-OX for pgsql-hackers@postgresql.org; Tue, 07 Mar 2023 20:22:38 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.nyi.internal (Postfix) with ESMTP id 048D4581EC8; Tue, 7 Mar 2023 15:22:33 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Tue, 07 Mar 2023 15:22:33 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1678220553; x=1678227753; bh=T0PIgGZuE6nI20d2gxd1od2Qk77MIpc/wkm MCuvb4Qc=; b=ciI0EeYuN18FPl4cMGFIe9gdd8uXfUX9a99qrSGSEKXf12iabhK GB/TkbD574OqiVqeCNi2fzYLRhdKheO6mJEhZamv0nkcBZPAFE8FdxwJg1a5HVi/ SIqzZL3eShzuknEs/DUGfzi0pCsxdIvxVjR6QiJMoXrZGvA+PXNo+6Upsv/j/YXr ihgzQ/OGgPQNww2sgufhWAlVUxxhvnzhRb72ZvC3MbRoLwVsYRwkJxRBohgObI8c J+sFwy01839W6/Qz1AKiGm+K6JjK809D8qxOhxIA/8Wb8eFWwsXjYmwirxcbDYtb aMDza1pC5COLJmZsQ+R5jrvTuG78jokTFqw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrvddutddgudeftdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpefkffggfgfuvfevfhfhjggtgfesthejredttdefjeenucfhrhhomheprfgv thgvrhcugfhishgvnhhtrhgruhhtuceophgvthgvrhdrvghishgvnhhtrhgruhhtsegvnh htvghrphhrihhsvggusgdrtghomheqnecuggftrfgrthhtvghrnhepheelffeggedujeet iefhleetuddvieffhfffvdejvdffgeejkeduleduheduieefnecuvehluhhsthgvrhfuih iivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepphgvthgvrhdrvghishgvnhhtrhgr uhhtsegvnhhtvghrphhrihhsvggusgdrtghomh X-ME-Proxy: Feedback-ID: i131946ab:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 7 Mar 2023 15:22:32 -0500 (EST) Message-ID: <36470e35-6e8d-d67c-aaa5-9fc93c5ff5c2@enterprisedb.com> Date: Tue, 7 Mar 2023 21:22:30 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: Add support for unit "B" to pg_size_pretty() To: David Rowley Cc: Justin Pryzby , pgsql-hackers@postgresql.org References: <0106914a-9eb5-22be-40d8-652cc88c827d@enterprisedb.com> <20230220143452.GM1653@telsasoft.com> <4b4613ec-d2c2-a615-9e3f-9f36cf5897ed@enterprisedb.com> Content-Language: en-US From: Peter Eisentraut In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 06.03.23 09:27, David Rowley wrote: > On Mon, 6 Mar 2023 at 21:13, Peter Eisentraut > wrote: >> >> On 02.03.23 20:58, David Rowley wrote: >>> I think I'd prefer to see the size_bytes_unit_alias struct have an >>> index into size_pretty_units[] array. i.e: >> >> Ok, done that way. (I had thought about that, but I was worried that >> that would be too error-prone to maintain. But I suppose the tables >> don't change that often, and test cases would easily catch mistakes.) > > Patch looks pretty good. I just see a small spelling mistake in: > > +/* Additional unit aliases acceted by pg_size_bytes */ > >> I also updated the documentation a bit more. > > I see I must have forgotten to add PB to the docs when pg_size_pretty > had that unit added. I guess you added the "etc" to fix that? I'm > wondering if that's the right choice. You modified the comment above > size_pretty_units[] to remind us to update the docs when adding units, > but the docs now say "etc", so do we need to? I'd likely have gone > with just adding "PB" to the docs, that way it's pretty clear that new > units need to be mentioned in the docs. Ok, I have fixed the original documentation to that effect and backpatched it. The remaining patch has been updated accordingly and committed also.