Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
f1438cf5
Commit
f1438cf5
authored
Jun 08, 2012
by
Peter Eisentraut
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Documentation style improvements
parent
ece01aae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
31 deletions
+29
-31
doc/src/sgml/rangetypes.sgml
doc/src/sgml/rangetypes.sgml
+29
-31
No files found.
doc/src/sgml/rangetypes.sgml
View file @
f1438cf5
...
@@ -35,32 +35,32 @@
...
@@ -35,32 +35,32 @@
<itemizedlist>
<itemizedlist>
<listitem>
<listitem>
<para>
<para>
<type>
INT4RANGE</type> — Range of <type>INTEGER
</type>
<type>
int4range</type> — Range of <type>integer
</type>
</para>
</para>
</listitem>
</listitem>
<listitem>
<listitem>
<para>
<para>
<type>
INT8RANGE</type> — Range of <type>BIGINT
</type>
<type>
int8range</type> — Range of <type>bigint
</type>
</para>
</para>
</listitem>
</listitem>
<listitem>
<listitem>
<para>
<para>
<type>
NUMRANGE</type> — Range of <type>NUMERIC
</type>
<type>
numrange</type> — Range of <type>numeric
</type>
</para>
</para>
</listitem>
</listitem>
<listitem>
<listitem>
<para>
<para>
<type>
TSRANGE</type> — Range of <type>TIMESTAMP WITHOUT TIME ZONE
</type>
<type>
tsrange</type> — Range of <type>timestamp without time zone
</type>
</para>
</para>
</listitem>
</listitem>
<listitem>
<listitem>
<para>
<para>
<type>
TSTZRANGE</type> — Range of <type>TIMESTAMP WITH TIME ZONE
</type>
<type>
tstzrange</type> — Range of <type>timestamp with time zone
</type>
</para>
</para>
</listitem>
</listitem>
<listitem>
<listitem>
<para>
<para>
<type>
DATERANGE</type> — Range of <type>DATE
</type>
<type>
daterange</type> — Range of <type>date
</type>
</para>
</para>
</listitem>
</listitem>
</itemizedlist>
</itemizedlist>
...
@@ -74,9 +74,9 @@
...
@@ -74,9 +74,9 @@
<para>
<para>
<programlisting>
<programlisting>
CREATE TABLE reservation (
room int, during TSRANGE
);
CREATE TABLE reservation (
room int, during tsrange
);
INSERT INTO reservation VALUES
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
-- Containment
SELECT int4range(10, 20) @> 3;
SELECT int4range(10, 20) @> 3;
...
@@ -223,16 +223,16 @@ empty
...
@@ -223,16 +223,16 @@ empty
Examples:
Examples:
<programlisting>
<programlisting>
-- includes 3, does not include 7, and does include all points in between
-- 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
-- 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
-- includes only the single point 4
select
'[4,4]'::int4range;
SELECT
'[4,4]'::int4range;
-- includes no points (and will be normalized to 'empty')
-- includes no points (and will be normalized to 'empty')
select
'[4,4)'::int4range;
SELECT
'[4,4)'::int4range;
</programlisting>
</programlisting>
</para>
</para>
</sect2>
</sect2>
...
@@ -279,13 +279,13 @@ SELECT numrange(NULL, 2.2);
...
@@ -279,13 +279,13 @@ SELECT numrange(NULL, 2.2);
<para>
<para>
A discrete range is one whose element type has a well-defined
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
In these types two elements can be said to be adjacent, when there are
no valid values between them. This contrasts with continuous ranges,
no valid values between them. This contrasts with continuous ranges,
where it's always (or almost always) possible to identify other element
where it's always (or almost always) possible to identify other element
values between two given values. For example, a range over the
values between two given values. For example, a range over the
<type>
NUMERIC</> type is continuous, as is a range over <type>TIMESTAMP
</>.
<type>
numeric</> type is continuous, as is a range over <type>timestamp
</>.
(Even though <type>
TIMESTAMP
</> has limited precision, and so could
(Even though <type>
timestamp
</> has limited precision, and so could
theoretically be treated as discrete, it's better to consider it continuous
theoretically be treated as discrete, it's better to consider it continuous
since the step size is normally not of interest.)
since the step size is normally not of interest.)
</para>
</para>
...
@@ -313,8 +313,8 @@ SELECT numrange(NULL, 2.2);
...
@@ -313,8 +313,8 @@ SELECT numrange(NULL, 2.2);
</para>
</para>
<para>
<para>
The built-in range types <type>
INT4RANGE</type>, <type>INT8RANGE
</type>,
The built-in range types <type>
int4range</type>, <type>int8range
</type>,
and <type>
DATERANGE
</type> all use a canonical form that includes
and <type>
daterange
</type> all use a canonical form that includes
the lower bound and excludes the upper bound; that is,
the lower bound and excludes the upper bound; that is,
<literal>[)</literal>. User-defined range types can use other conventions,
<literal>[)</literal>. User-defined range types can use other conventions,
however.
however.
...
@@ -451,8 +451,7 @@ CREATE INDEX reservation_idx ON reservation USING gist (during);
...
@@ -451,8 +451,7 @@ CREATE INDEX reservation_idx ON reservation USING gist (during);
range type. For example:
range type. For example:
<programlisting>
<programlisting>
ALTER TABLE reservation
ALTER TABLE reservation ADD EXCLUDE USING gist (during WITH &&);
ADD EXCLUDE USING gist (during WITH &&);
</programlisting>
</programlisting>
That constraint will prevent any overlapping values from existing
That constraint will prevent any overlapping values from existing
...
@@ -460,11 +459,11 @@ ALTER TABLE reservation
...
@@ -460,11 +459,11 @@ ALTER TABLE reservation
<programlisting>
<programlisting>
INSERT INTO reservation VALUES
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 0 1
INSERT INTO reservation VALUES
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"
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
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 )).
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 )).
...
@@ -480,25 +479,24 @@ with existing key (during)=([ 2010-01-01 14:30:00, 2010-01-01 15:30:00 )).
are equal:
are equal:
<programlisting>
<programlisting>
CREATE TABLE room_reservation
CREATE TABLE room_reservation (
(
room text,
room TEXT,
during tsrange,
during TSRANGE,
EXCLUDE USING gist (room WITH =, during WITH &&)
EXCLUDE USING gist (room WITH =, during WITH &&)
);
);
INSERT INTO room_reservation VALUES
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 0 1
INSERT INTO room_reservation VALUES
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"
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
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 )).
existing key (room, during)=(123A, [ 2010-01-01 14:00:00, 2010-01-01 15:00:00 )).
INSERT INTO room_reservation VALUES
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
INSERT 0 1
</programlisting>
</programlisting>
</para>
</para>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment