Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Greenplum
Gpdb
提交
f1438cf5
G
Gpdb
项目概览
Greenplum
/
Gpdb
通知
7
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
Gpdb
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
f1438cf5
编写于
6月 08, 2012
作者:
P
Peter Eisentraut
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Documentation style improvements
上级
ece01aae
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
31 deletion
+29
-31
doc/src/sgml/rangetypes.sgml
doc/src/sgml/rangetypes.sgml
+29
-31
未找到文件。
doc/src/sgml/rangetypes.sgml
浏览文件 @
f1438cf5
...
...
@@ -35,32 +35,32 @@
<itemizedlist>
<listitem>
<para>
<type>
INT4RANGE</type> — Range of <type>INTEGER
</type>
<type>
int4range</type> — Range of <type>integer
</type>
</para>
</listitem>
<listitem>
<para>
<type>
INT8RANGE</type> — Range of <type>BIGINT
</type>
<type>
int8range</type> — Range of <type>bigint
</type>
</para>
</listitem>
<listitem>
<para>
<type>
NUMRANGE</type> — Range of <type>NUMERIC
</type>
<type>
numrange</type> — Range of <type>numeric
</type>
</para>
</listitem>
<listitem>
<para>
<type>
TSRANGE</type> — Range of <type>TIMESTAMP WITHOUT TIME ZONE
</type>
<type>
tsrange</type> — Range of <type>timestamp without time zone
</type>
</para>
</listitem>
<listitem>
<para>
<type>
TSTZRANGE</type> — Range of <type>TIMESTAMP WITH TIME ZONE
</type>
<type>
tstzrange</type> — Range of <type>timestamp with time zone
</type>
</para>
</listitem>
<listitem>
<para>
<type>
DATERANGE</type> — Range of <type>DATE
</type>
<type>
daterange</type> — Range of <type>date
</type>
</para>
</listitem>
</itemizedlist>
...
...
@@ -74,9 +74,9 @@
<para>
<programlisting>
CREATE TABLE reservation (
room int, during TSRANGE
);
CREATE TABLE reservation (
room int, during tsrange
);
INSERT INTO reservation VALUES
( 1108, '[2010-01-01 14:30, 2010-01-01 15:30)'
);
(1108, '[2010-01-01 14:30, 2010-01-01 15:30)'
);
-- Containment
SELECT int4range(10, 20) @> 3;
...
...
@@ -223,16 +223,16 @@ empty
Examples:
<programlisting>
-- includes 3, does not include 7, and does include all points in between
select
'[3,7)'::int4range;
SELECT
'[3,7)'::int4range;
-- does not include either 3 or 7, but includes all points in between
select
'(3,7)'::int4range;
SELECT
'(3,7)'::int4range;
-- includes only the single point 4
select
'[4,4]'::int4range;
SELECT
'[4,4]'::int4range;
-- includes no points (and will be normalized to 'empty')
select
'[4,4)'::int4range;
SELECT
'[4,4)'::int4range;
</programlisting>
</para>
</sect2>
...
...
@@ -279,13 +279,13 @@ SELECT numrange(NULL, 2.2);
<para>
A discrete range is one whose element type has a well-defined
<quote>step</quote>, such as <type>
INTEGER</type> or <type>DATE
</type>.
<quote>step</quote>, such as <type>
integer</type> or <type>date
</type>.
In these types two elements can be said to be adjacent, when there are
no valid values between them. This contrasts with continuous ranges,
where it's always (or almost always) possible to identify other element
values between two given values. For example, a range over the
<type>
NUMERIC</> type is continuous, as is a range over <type>TIMESTAMP
</>.
(Even though <type>
TIMESTAMP
</> has limited precision, and so could
<type>
numeric</> type is continuous, as is a range over <type>timestamp
</>.
(Even though <type>
timestamp
</> has limited precision, and so could
theoretically be treated as discrete, it's better to consider it continuous
since the step size is normally not of interest.)
</para>
...
...
@@ -313,8 +313,8 @@ SELECT numrange(NULL, 2.2);
</para>
<para>
The built-in range types <type>
INT4RANGE</type>, <type>INT8RANGE
</type>,
and <type>
DATERANGE
</type> all use a canonical form that includes
The built-in range types <type>
int4range</type>, <type>int8range
</type>,
and <type>
daterange
</type> all use a canonical form that includes
the lower bound and excludes the upper bound; that is,
<literal>[)</literal>. User-defined range types can use other conventions,
however.
...
...
@@ -332,8 +332,8 @@ SELECT numrange(NULL, 2.2);
<programlisting>
CREATE TYPE floatrange AS RANGE (
subtype = float8,
subtype_diff = float8mi
subtype = float8,
subtype_diff = float8mi
);
SELECT '[1.234, 5.678]'::floatrange;
...
...
@@ -451,8 +451,7 @@ CREATE INDEX reservation_idx ON reservation USING gist (during);
range type. For example:
<programlisting>
ALTER TABLE reservation
ADD EXCLUDE USING gist (during WITH &&);
ALTER TABLE reservation ADD EXCLUDE USING gist (during WITH &&);
</programlisting>
That constraint will prevent any overlapping values from existing
...
...
@@ -460,11 +459,11 @@ ALTER TABLE reservation
<programlisting>
INSERT INTO reservation VALUES
( 1108, '[2010-01-01 11:30, 2010-01-01 13:00)'
);
(1108, '[2010-01-01 11:30, 2010-01-01 13:00)'
);
INSERT 0 1
INSERT INTO reservation VALUES
( 1108, '[2010-01-01 14:45, 2010-01-01 15:45)'
);
(1108, '[2010-01-01 14:45, 2010-01-01 15:45)'
);
ERROR: conflicting key value violates exclusion constraint "reservation_during_excl"
DETAIL: Key (during)=([ 2010-01-01 14:45:00, 2010-01-01 15:45:00 )) conflicts
with existing key (during)=([ 2010-01-01 14:30:00, 2010-01-01 15:30:00 )).
...
...
@@ -480,25 +479,24 @@ with existing key (during)=([ 2010-01-01 14:30:00, 2010-01-01 15:30:00 )).
are equal:
<programlisting>
CREATE TABLE room_reservation
(
room TEXT,
during TSRANGE,
EXCLUDE USING gist (room WITH =, during WITH &&)
CREATE TABLE room_reservation (
room text,
during tsrange,
EXCLUDE USING gist (room WITH =, during WITH &&)
);
INSERT INTO room_reservation VALUES
( '123A', '[2010-01-01 14:00, 2010-01-01 15:00)'
);
('123A', '[2010-01-01 14:00, 2010-01-01 15:00)'
);
INSERT 0 1
INSERT INTO room_reservation VALUES
( '123A', '[2010-01-01 14:30, 2010-01-01 15:30)'
);
('123A', '[2010-01-01 14:30, 2010-01-01 15:30)'
);
ERROR: conflicting key value violates exclusion constraint "room_reservation_room_during_excl"
DETAIL: Key (room, during)=(123A, [ 2010-01-01 14:30:00, 2010-01-01 15:30:00 )) conflicts with
existing key (room, during)=(123A, [ 2010-01-01 14:00:00, 2010-01-01 15:00:00 )).
INSERT INTO room_reservation VALUES
( '123B', '[2010-01-01 14:30, 2010-01-01 15:30)'
);
('123B', '[2010-01-01 14:30, 2010-01-01 15:30)'
);
INSERT 0 1
</programlisting>
</para>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录