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

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Document if width_bucket's low and high are inclusive/exclusive
Дата
Msg-id 1391433.1750345913@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Document if width_bucket's low and high are inclusive/exclusive  (Robert Treat <rob@xzilla.net>)
Список pgsql-docs
Robert Treat <rob@xzilla.net> 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 the buckets

Yeah, though I might write "inclusive lower bounds" rather than use
parens.  What's bugging me though is the lack of any mention of the
bucket upper bounds: you have to deduce that the upper bounds must
be exclusive if the lower bounds are inclusive.  If that's obvious
here, why is it non-obvious for the other case?  Maybe instead of
the parenthetical form you suggested, add a sentence like

    Buckets have inclusive lower bounds, and therefore exclusive
    upper bounds.

and then we could either rely on the reader remembering that,
or else repeat it, for the second form of width_bucket.

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!
I think we need to document that, perhaps along the lines of

    If low > high, the behavior is mirror-reversed, with bucket 1
    now being the one just below low, and the inclusive bounds
    now being on the upper side.

plus an example.

            regards, tom lane



В списке pgsql-docs по дате отправления: