区间范围的函数和运算。
Operator | Description | Example | Result |
= | equal 等于 | int4range(1,5) = '[1,4]'::int4range | t |
<> | not equal 不等于 | numrange(1.1,2.2) <> numrange(1.1,2.3) | t |
< | less than 小于 | int4range(1,10) < int4range(2,3) | t |
> | greater than 大于 | int4range(1,10) > int4range(1,5) | t |
<= | less than or equal 小于等于 | numrange(1.1,2.2) <= numrange(1.1,2.2) | t |
>= | greater than or equal 大于等于 | numrange(1.1,2.2) >= numrange(1.1,2.0) | t |
@> | contains range 包含 | int4range(2,4) @> int4range(2,3) | t |
@> | contains element 包含 | '[2011-01-01,2011-03-01)'::tsrange @> '2011-01-10'::timestamp | t |
<@ | range is contained by 被包含 | int4range(2,4) <@ int4range(1,7) | t |
<@ | element is contained by 被包含 | 42 <@ int4range(1,7) | f |
&& | overlap (have points in common)交集 | int8range(3,7) && int8range(4,12) | t |
<< | strictly left of 完全小于 | int8range(1,10) << int8range(100,110) | t |
>> | strictly right of 完全大于 | int8range(50,60) >> int8range(20,30) | t |
&< | 没有延伸到 | int8range(1,20) &< int8range(18,20) | t |
&> | 没有延伸到 | int8range(7,20) &> int8range(5,10) | t |
-|- | 毗邻 | numrange(1.1,2.2) -|- numrange(2.2,3.3) | t |
+ | 并集 | numrange(5,15) + numrange(10,20) | [5,20) |
* | 交集 | int8range(5,15) * int8range(10,20) | [10,15) |
- | 差异 | int8range(5,15) - int8range(10,20) | [5,10) |
Function | Return Type | Description | Example | Result |
lower(anyrange) | range's element type | 范围下界 | lower(numrange(1.1,2.2)) | 1.1 |
upper(anyrange) | range's element type | 范围上限 | upper(numrange(1.1,2.2)) | 2.2 |
isempty(anyrange) | boolean | range是否为空 | isempty(numrange(1.1,2.2)) | false |
lower_inc(anyrange) | boolean | 下限是否包含在内 | lower_inc(numrange(1.1,2.2)) | true |
upper_inc(anyrange) | boolean | 上限是否包含在内 | upper_inc(numrange(1.1,2.2)) | false |
lower_inf(anyrange) | boolean | 下界是否是无限的 | lower_inf('(,)'::daterange) | true |
upper_inf(anyrange) | boolean | 上界是否是无限的 | upper_inf('(,)'::daterange) | true |
range_merge(anyrange,anyrange) | anyrange | 包含给定范围的最小范围 | range_merge('[1,2)'::int4range, '[3,4)'::int4range) | [1,4) |