Improve examples for range operators

Started by PG Bug reporting formabout 7 years 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/11/functions-range.html
Description:

Hi.

It would be nice if next examples:

<< strictly left of int8range(1,10) << int8range(100,110) t

strictly right of int8range(50,60) >> int8range(20,30) t

&< does not extend to the right of int8range(1,20) &< int8range(18,20)
t
&> does not extend to the left of int8range(7,20) &> int8range(5,10) t

are extended by:
**not** strictly left of, **not** strictly right of, **extends** to the
right of, **extends** to the left of

Because without manual experiments I can not imagine the ranges that cause
'false' result for the examples above.

Thank you.

#2Bruce Momjian
bruce@momjian.us
In reply to: PG Bug reporting form (#1)
Re: Improve examples for range operators

On Wed, Feb 20, 2019 at 12:27:26PM +0000, PG Doc comments form wrote:

The following documentation comment has been logged on the website:

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

Hi.

It would be nice if next examples:

<< strictly left of int8range(1,10) << int8range(100,110) t

strictly right of int8range(50,60) >> int8range(20,30) t

&< does not extend to the right of int8range(1,20) &< int8range(18,20)
t
&> does not extend to the left of int8range(7,20) &> int8range(5,10) t

are extended by:
**not** strictly left of, **not** strictly right of, **extends** to the
right of, **extends** to the left of

Because without manual experiments I can not imagine the ranges that cause
'false' result for the examples above.

Well, they are not technically negatives of each other. << means the
first is all left of the second, while &< means that it doesn't go to
the right of the second, e.g.,

SELECT int8range(1,10) &< int8range(100,110);
?column?
----------
t

SELECT int8range(1,105) &< int8range(100,110);
?column?
----------
t

SELECT int8range(1,200) &< int8range(100,110);
?column?
----------
f

Notice it changed from true to false and none of these was strictly to
the right.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +