Improve examples: Provide the example which extend to the left of the range

Started by PG Bug reporting formover 1 year ago2 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/functions-range.html
Description:

Hi.
All examples on this page uses `not extend` expression:

```
anyrange &< anyrange → boolean

Does the first range not extend to the right of the second?

int8range(1,20) &< int8range(18,20) → t

anyrange &> anyrange → boolean

Does the first range not extend to the left of the second?

int8range(7,20) &> int8range(5,10) → t

...

anymultirange &> anymultirange → boolean

Does the first multirange not extend to the left of the second?

'{[7,20)}'::int8multirange &> '{[5,10)}'::int8multirange → t

anymultirange &> anyrange → boolean

Does the multirange not extend to the left of the range?

'{[7,20)}'::int8multirange &> int8range(5,10) → t
```

It would be nice to have examples which `extend to the other range`. Eg. the
first example shows how to not extend, the second shows how to extend. Or
`range` examples shows how to not extend left/right, and the `multirange`
examples shows how to extend to the left/right.

Thank you.

#2David G. Johnston
david.g.johnston@gmail.com
In reply to: PG Bug reporting form (#1)
Re: Improve examples: Provide the example which extend to the left of the range

On Tue, Jan 21, 2025 at 10:09 AM PG Doc comments form <
noreply@postgresql.org> wrote:

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/17/functions-range.html
Description:

It would be nice to have examples which `extend to the other range`. Eg.
the
first example shows how to not extend, the second shows how to extend. Or
`range` examples shows how to not extend left/right, and the `multirange`
examples shows how to extend to the left/right.

The use of the word "how" here might just be a translation thing but to be
sure this isn't about an action, it is strictly about whether the lower
bound of the left argument is greater or less than the lower bound of the
right argument.

I'll agree that all of this takes some thinking to understand but I don't
know that simply adding examples that return false instead of true is a big
gain.

Maybe reword it, removing the "not"?

Thus:

Does the first range not extend to the left of the second?

Becomes:

Is the lower bound of the first range larger than or equal to the lower
bound of the second range?

David J.