Document if width_bucket's low and high are inclusive/exclusive
Ben Peachey Higdon <bpeacheyhigdon@gmail.com>
From: Ben Peachey Higdon <bpeacheyhigdon@gmail.com>
To: pgsql-docs@lists.postgresql.org
Date: 2025-02-28T01:31:59Z
Lists: pgsql-docs
The current documentation for width_bucket (https://www.postgresql.org/docs/current/functions-math.html <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. For example: SELECT width_bucket(0, 0, 1, 4) returns 1, the first of 4 bins SELECT width_bucket(1, 0, 1, 4) returns 5, because the high was outside the exclusive bound of high = 1 Thank you!
Commits
-
Doc: improve documentation about width_bucket().
- ea06263c4aa5 18.0 landed
- ccfe3dbaa439 15.14 landed
- 9bd588f87de8 14.19 landed
- 9575e540f666 17.6 landed
- 7a93bd5986e4 16.10 landed
- 34a6c679ae35 13.22 landed