Re: Improve examples for range operators

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Improve examples for range operators
Дата
Msg-id 20190222011814.gae3a4yjgfyoxa3r@momjian.us
обсуждение исходный текст
Ответ на Improve examples for range operators  (PG Doc comments form <noreply@postgresql.org>)
Список pgsql-docs
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 +


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

Предыдущее
От: Peter Eisentraut
Дата:
Сообщение: Re: First SVG graphic
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: Improve documentation for current_setting function