Re: Document if width_bucket's low and high are inclusive/exclusive

From: Robert Treat <rob(at)xzilla(dot)net>
To: Ben Peachey Higdon <bpeacheyhigdon(at)gmail(dot)com>
Cc: pgsql-docs(at)lists(dot)postgresql(dot)org
Subject: Re: Document if width_bucket's low and high are inclusive/exclusive
Date: 2025-06-18 18:56:48
Message-ID: CABV9wwPh9+JAYBudAhTY8yPj5VJACA_FpHfEAaHMX1s4z05VkQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-docs

On Fri, Feb 28, 2025 at 7:15 AM Ben Peachey Higdon
<bpeacheyhigdon(at)gmail(dot)com> wrote:
> The current documentation for width_bucket (https://www.postgresql.org/docs/current/functions-math.html) does not mention if the range’s low and high are inclusive or exclusive.
>
> Returns the number of the bucket in which operand falls in a histogram having count equal-width buckets spanning the range low to high. Returns 0 or count+1 for an input outside that range.
>
> I had assumed that both the low and high were inclusive but actually the low is inclusive while the high is exclusive.
>

I'm not sure it's the most ground breaking thing, but would probably
save a bunch of future people from having to gin up an example to test
it, so I'd probably update it per the following patch.

Robert Treat
https://xzilla.net

Attachment Content-Type Size
v1-0001-Document-width_bucket-range-as-inclusive-exclusiv.patch application/octet-stream 1.1 KB

In response to

Responses

Browse pgsql-docs by date

  From Date Subject
Next Message Robert Treat 2025-06-18 19:50:19 Re: Mention GIN indexes support parallel builds.
Previous Message Daniel Gustafsson 2025-06-18 11:59:52 Re: Deprecated openssl command option in documentation