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 1pZ6CK-0001Oh-7r for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Mar 2023 08:27:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pZ6CI-00076y-NU for pgsql-hackers@arkaria.postgresql.org; Mon, 06 Mar 2023 08:27:54 +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 1pZ6CI-00076p-CS for pgsql-hackers@lists.postgresql.org; Mon, 06 Mar 2023 08:27:54 +0000 Received: from mail-ot1-x32a.google.com ([2607:f8b0:4864:20::32a]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pZ6CG-0005zm-4Q for pgsql-hackers@postgresql.org; Mon, 06 Mar 2023 08:27:53 +0000 Received: by mail-ot1-x32a.google.com with SMTP id q11-20020a056830440b00b00693c1a62101so4912705otv.0 for ; Mon, 06 Mar 2023 00:27:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=bbO/GeUsFUDdzFOr2iG3YPeth4aosAyteTdDUP6HYqg=; b=KAfojJ4M3zqOTgbdGJqH5q4dyDf6iB24jFdzLDnGy6jR9RKKK0CnxhEK9NYgw7dxmD PZS8N0P2tYja7d1VEYe6xA3NtYoUoA1BycLC9yBWOINXNOhiElUVHKfz4LZs2DFsUWdS hQyipx/T4FG+GnMnE+85UUO1vSWlwvttIOpIqE8mmN+L3jnPXBp2sx3FzwJDxLXpoAq+ F7CyDEjUQrUw+9yVp/r6w6C70Jp0D3yCcWZk0X73WyPsVV2tXFcByff1/CkU5wSJt46x x6S9AHbXeG8JBovS9aKpdPz5AE7CZTXmJ5UR1urCIjpWWa9E3VYurAzvyYOtKt5UZXZS wvTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=bbO/GeUsFUDdzFOr2iG3YPeth4aosAyteTdDUP6HYqg=; b=k85ab9NZZLVnS2KxOubS/n6LKh2yki1aO//MLQ4lhWz8dQWX//PMOoO7rrgGyRo1VB 8moaGbVzS37KH1u+2YgHvsE2fEQvOadmDhuZEHt3mbITnzpu7y3zpOhZNb8iLDTqL0EM TnWf+sJxeEDTYeqrxbZzeOZdv5/pqlo5YRbA/fI5aRBmvB0k3Eb3QKxvpUSFa1SK1Rgk M3sZZl4VQRFdoV8GjcWbhfK9Qo9pMkBvfiqbcMr/FS5iQqfuAKE0JVoFgcLYDh6q7CK3 C0Co+pP8EzB7Px1Bdnrc5IG8pyvbHkvA+i7f3+83GVmcZ8GLlT0DORff/TrGCLfpJRZb /sMw== X-Gm-Message-State: AO0yUKUjdFGSVJIgF2XlTWyQtANkatxWucYPIGTfq7YR0F1mEK6sAZXr CBIL0q4y4j5HZ7YFLus9OCeZS+3Is06lwvmtncA= X-Google-Smtp-Source: AK7set99kBeDeC8FHwaJX08y0e58/+Vm7pWubQIC3Zk9g67azOTumj8ekX6aSOhb22RwBBe33D15979oLro7q7AD6BQ= X-Received: by 2002:a05:6830:33f1:b0:690:ef0d:d946 with SMTP id i17-20020a05683033f100b00690ef0dd946mr3213350otu.3.1678091270555; Mon, 06 Mar 2023 00:27:50 -0800 (PST) MIME-Version: 1.0 References: <0106914a-9eb5-22be-40d8-652cc88c827d@enterprisedb.com> <20230220143452.GM1653@telsasoft.com> <4b4613ec-d2c2-a615-9e3f-9f36cf5897ed@enterprisedb.com> In-Reply-To: <4b4613ec-d2c2-a615-9e3f-9f36cf5897ed@enterprisedb.com> From: David Rowley Date: Mon, 6 Mar 2023 21:27:36 +1300 Message-ID: Subject: Re: Add support for unit "B" to pg_size_pretty() To: Peter Eisentraut Cc: Justin Pryzby , pgsql-hackers@postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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. David