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

2025-06-21 Thread Dean Rasheed
On Sat, 21 Jun 2025 at 18:09, Tom Lane wrote: > > While looking at those comments, I also noted that there is a > strange inconsistency between width_bucket_array and > width_bucket_float8/width_bucket_numeric. Namely, the latter > two reject an "operand" that is NaN, while width_bucket_array > g

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

2025-06-21 Thread Tom Lane
Dean Rasheed writes: > On Sat, 21 Jun 2025 at 18:09, Tom Lane wrote: >> Clearly these functions must reject NaN histogram bounds, for >> the same reason they reject infinite bounds. But I don't see >> any reason why they couldn't treat a NaN operand as valid. >> Should we change them? (I imagin

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

2025-06-21 Thread Tom Lane
Dean Rasheed writes: > On Fri, 20 Jun 2025 at 22:19, Tom Lane wrote: >> So concretely, how about the attached? > LGTM (though I'm not sure it really needs the word "therefore" in the > first hunk). OK, done that way. > There are also a couple of code comments that need fixing -- Good points,

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

2025-06-21 Thread Dean Rasheed
On Fri, 20 Jun 2025 at 22:19, Tom Lane wrote: > > So concretely, how about the attached? > LGTM (though I'm not sure it really needs the word "therefore" in the first hunk). There are also a couple of code comments that need fixing -- width_bucket_float8() comes with the following comment: * '

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

2025-06-20 Thread Tom Lane
I wrote: > Another thing I just remembered (think I knew it once) is the > behavior of the first form when low > high. It's not an error! So concretely, how about the attached? In addition to what we mentioned so far, I made the sentence about out-of-range cases more explicit.

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

2025-06-19 Thread Tom Lane
Robert Treat writes: > Since they are all lower bounds, they all operate the same way, so it > isn't quite as clear that it needs documenting. Are you thinking > something like this? > Returns the number of the bucket in which operand falls given an array > listing the lower bounds (inclusive) of

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

2025-06-18 Thread Robert Treat
On Wed, Jun 18, 2025 at 4:12 PM Tom Lane wrote: > Robert Treat writes: > > On Fri, Feb 28, 2025 at 7:15 AM Ben Peachey Higdon > > wrote: > >> The current documentation for width_bucket > >> (https://www.postgresql.org/docs/current/functions-math.html) does not > >> mention if the range’s low a

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

2025-06-18 Thread Tom Lane
Robert Treat writes: > On Fri, Feb 28, 2025 at 7:15 AM Ben Peachey Higdon > 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. > I'm not sure it's the

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

2025-06-18 Thread Robert Treat
On Fri, Feb 28, 2025 at 7:15 AM Ben Peachey Higdon 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