## 9.20. 范围/多范围函数和运算符

`anyrange` `@>` `anyrange``boolean`

`int4range(2,4) @> int4range(2,3)``t`

`anyrange` `@>` `anyelement``boolean`

`'[2011-01-01,2011-03-01)'::tsrange @> '2011-01-10'::timestamp``t`

`anyrange` `<@` `anyrange``boolean`

`int4range(2,4) <@ int4range(1,7)``t`

`anyelement` `<@` `anyrange``boolean`

`42 <@ int4range(1,7)``f`

`anyrange` `&&` `anyrange``boolean`

`int8range(3,7) && int8range(4,12)``t`

`anyrange` `<<` `anyrange``boolean`

`int8range(1,10) << int8range(100,110)``t`

`anyrange` `>>` `anyrange``boolean`

`int8range(50,60) >> int8range(20,30)``t`

`anyrange` `&<` `anyrange``boolean`

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

`anyrange` `&>` `anyrange``boolean`

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

`anyrange` `-|-` `anyrange``boolean`

`numrange(1.1,2.2) -|- numrange(2.2,3.3)``t`

`anyrange` `+` `anyrange``anyrange`

`numrange(5,15) + numrange(10,20)``[5,20)`

`anyrange` `*` `anyrange``anyrange`

`int8range(5,15) * int8range(10,20)``[10,15)`

`anyrange` `-` `anyrange``anyrange`

`int8range(5,15) - int8range(10,20)``[5,10)`

`anymultirange` `@>` `anymultirange``boolean`

`'{[2,4)}'::int4multirange @> '{[2,3)}'::int4multirange``t`

`anymultirange` `@>` `anyrange``boolean`

`'{[2,4)}'::int4multirange @> int4range(2,3)``t`

`anymultirange` `@>` `anyelement``boolean`

`'{[2011-01-01,2011-03-01)}'::tsmultirange @> '2011-01-10'::timestamp``t`

`anyrange` `@>` `anymultirange``boolean`

`'[2,4)'::int4range @> '{[2,3)}'::int4multirange``t`

`anymultirange` `<@` `anymultirange``boolean`

`'{[2,4)}'::int4multirange <@ '{[1,7)}'::int4multirange``t`

`anymultirange` `<@` `anyrange``boolean`

`'{[2,4)}'::int4multirange <@ int4range(1,7)``t`

`anyrange` `<@` `anymultirange``boolean`

`int4range(2,4) <@ '{[1,7)}'::int4multirange``t`

`anyelement` `<@` `anymultirange``boolean`

`42 <@ '{[1,7)}'::int4multirange``t`

`anymultirange` `&&` `anymultirange``boolean`

`'{[3,7)}'::int8multirange && '{[4,12)}'::int8multirange``t`

`anymultirange` `&&` `anyrange``boolean`

`'{[3,7)}'::int8multirange && int8range(4,12)``t`

`anyrange` `&&` `anymultirange``boolean`

`int8range(3,7) && '{[4,12)}'::int8multirange``t`

`anymultirange` `<<` `anymultirange``boolean`

`'{[1,10)}'::int8multirange << '{[100,110)}'::int8multirange``t`

`anymultirange` `<<` `anyrange``boolean`

`'{[1,10)}'::int8multirange << int8range(100,110)``t`

`anyrange` `<<` `anymultirange``boolean`

`int8range(1,10) << '{[100,110)}'::int8multirange``t`

`anymultirange` `>>` `anymultirange``boolean`

`'{[50,60)}'::int8multirange >> '{[20,30)}'::int8multirange``t`

`anymultirange` `>>` `anyrange``boolean`

`'{[50,60)}'::int8multirange >> int8range(20,30)``t`

`anyrange` `>>` `anymultirange``boolean`

`int8range(50,60) >> '{[20,30)}'::int8multirange``t`

`anymultirange` `&<` `anymultirange``boolean`

`'{[1,20)}'::int8multirange &< '{[18,20)}'::int8multirange``t`

`anymultirange` `&<` `anyrange``boolean`

`'{[1,20)}'::int8multirange &< int8range(18,20)``t`

`anyrange` `&<` `anymultirange``boolean`

`int8range(1,20) &< '{[18,20)}'::int8multirange``t`

`anymultirange` `&>` `anymultirange``boolean`

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

`anymultirange` `&>` `anyrange``boolean`

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

`anyrange` `&>` `anymultirange``boolean`

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

`anymultirange` `-|-` `anymultirange``boolean`

`'{[1.1,2.2)}'::nummultirange -|- '{[2.2,3.3)}'::nummultirange``t`

`anymultirange` `-|-` `anyrange``boolean`

`'{[1.1,2.2)}'::nummultirange -|- numrange(2.2,3.3)``t`

`anyrange` `-|-` `anymultirange``boolean`

`numrange(1.1,2.2) -|- '{[2.2,3.3)}'::nummultirange``t`

`anymultirange` `+` `anymultirange``anymultirange`

`'{[5,10)}'::nummultirange + '{[15,20)}'::nummultirange``{[5,10), [15,20)}`

`anymultirange` `*` `anymultirange``anymultirange`

`'{[5,15)}'::int8multirange * '{[10,20)}'::int8multirange``{[10,15)}`

`anymultirange` `-` `anymultirange``anymultirange`

`'{[5,20)}'::int8multirange - '{[10,15)}'::int8multirange``{[5,10), [15,20)}`

`lower` ( `anyrange` ) → `anyelement`

`lower(numrange(1.1,2.2))``1.1`

`upper` ( `anyrange` ) → `anyelement`

`upper(numrange(1.1,2.2))``2.2`

`isempty` ( `anyrange` ) → `boolean`

`isempty(numrange(1.1,2.2))``f`

`lower_inc` ( `anyrange` ) → `boolean`

`lower_inc(numrange(1.1,2.2))``t`

`upper_inc` ( `anyrange` ) → `boolean`

`upper_inc(numrange(1.1,2.2))``f`

`lower_inf` ( `anyrange` ) → `boolean`

`lower_inf('(,)'::daterange)``t`

`upper_inf` ( `anyrange` ) → `boolean`

`upper_inf('(,)'::daterange)``t`

`range_merge` ( `anyrange`, `anyrange` ) → `anyrange`

`range_merge('[1,2)'::int4range, '[3,4)'::int4range)``[1,4)`

`lower` ( `anymultirange` ) → `anyelement`

`lower('{[1.1,2.2)}'::nummultirange)``1.1`

`upper` ( `anymultirange` ) → `anyelement`

`upper('{[1.1,2.2)}'::nummultirange)``2.2`

`isempty` ( `anymultirange` ) → `boolean`

`isempty('{[1.1,2.2)}'::nummultirange)``f`

`lower_inc` ( `anymultirange` ) → `boolean`

`lower_inc('{[1.1,2.2)}'::nummultirange)``t`

`upper_inc` ( `anymultirange` ) → `boolean`

`upper_inc('{[1.1,2.2)}'::nummultirange)``f`

`lower_inf` ( `anymultirange` ) → `boolean`

`lower_inf('{(,)}'::datemultirange)``t`

`upper_inf` ( `anymultirange` ) → `boolean`

`upper_inf('{(,)}'::datemultirange)``t`

`range_merge` ( `anymultirange` ) → `anyrange`

`range_merge('{[1,2), [3,4)}'::int4multirange)``[1,4)`

`multirange` ( `anyrange` ) → `anymultirange`

`multirange('[1,2)'::int4range)``{[1,2)}`

`unnest` ( `anymultirange` ) → `setof anyrange`

`unnest('{[1,2), [3,4)}'::int4multirange)`

``` [1,2)
[3,4)
```

`lower_inc``upper_inc``lower_inf`、 和 `upper_inf` 函数对空范围(empty range)或多范围都返回假(false)。