Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f1438cf

Browse files
committed
Documentation style improvements
1 parent ece01aa commit f1438cf

File tree

1 file changed

+29
-31
lines changed

1 file changed

+29
-31
lines changed

doc/src/sgml/rangetypes.sgml

+29-31
Original file line numberDiff line numberDiff line change
@@ -35,32 +35,32 @@
3535
<itemizedlist>
3636
<listitem>
3737
<para>
38-
<type>INT4RANGE</type> &mdash; Range of <type>INTEGER</type>
38+
<type>int4range</type> &mdash; Range of <type>integer</type>
3939
</para>
4040
</listitem>
4141
<listitem>
4242
<para>
43-
<type>INT8RANGE</type> &mdash; Range of <type>BIGINT</type>
43+
<type>int8range</type> &mdash; Range of <type>bigint</type>
4444
</para>
4545
</listitem>
4646
<listitem>
4747
<para>
48-
<type>NUMRANGE</type> &mdash; Range of <type>NUMERIC</type>
48+
<type>numrange</type> &mdash; Range of <type>numeric</type>
4949
</para>
5050
</listitem>
5151
<listitem>
5252
<para>
53-
<type>TSRANGE</type> &mdash; Range of <type>TIMESTAMP WITHOUT TIME ZONE</type>
53+
<type>tsrange</type> &mdash; Range of <type>timestamp without time zone</type>
5454
</para>
5555
</listitem>
5656
<listitem>
5757
<para>
58-
<type>TSTZRANGE</type> &mdash; Range of <type>TIMESTAMP WITH TIME ZONE</type>
58+
<type>tstzrange</type> &mdash; Range of <type>timestamp with time zone</type>
5959
</para>
6060
</listitem>
6161
<listitem>
6262
<para>
63-
<type>DATERANGE</type> &mdash; Range of <type>DATE</type>
63+
<type>daterange</type> &mdash; Range of <type>date</type>
6464
</para>
6565
</listitem>
6666
</itemizedlist>
@@ -74,9 +74,9 @@
7474

7575
<para>
7676
<programlisting>
77-
CREATE TABLE reservation ( room int, during TSRANGE );
77+
CREATE TABLE reservation (room int, during tsrange);
7878
INSERT INTO reservation VALUES
79-
( 1108, '[2010-01-01 14:30, 2010-01-01 15:30)' );
79+
(1108, '[2010-01-01 14:30, 2010-01-01 15:30)');
8080

8181
-- Containment
8282
SELECT int4range(10, 20) @> 3;
@@ -223,16 +223,16 @@ empty
223223
Examples:
224224
<programlisting>
225225
-- includes 3, does not include 7, and does include all points in between
226-
select '[3,7)'::int4range;
226+
SELECT '[3,7)'::int4range;
227227

228228
-- does not include either 3 or 7, but includes all points in between
229-
select '(3,7)'::int4range;
229+
SELECT '(3,7)'::int4range;
230230

231231
-- includes only the single point 4
232-
select '[4,4]'::int4range;
232+
SELECT '[4,4]'::int4range;
233233

234234
-- includes no points (and will be normalized to 'empty')
235-
select '[4,4)'::int4range;
235+
SELECT '[4,4)'::int4range;
236236
</programlisting>
237237
</para>
238238
</sect2>
@@ -279,13 +279,13 @@ SELECT numrange(NULL, 2.2);
279279

280280
<para>
281281
A discrete range is one whose element type has a well-defined
282-
<quote>step</quote>, such as <type>INTEGER</type> or <type>DATE</type>.
282+
<quote>step</quote>, such as <type>integer</type> or <type>date</type>.
283283
In these types two elements can be said to be adjacent, when there are
284284
no valid values between them. This contrasts with continuous ranges,
285285
where it's always (or almost always) possible to identify other element
286286
values between two given values. For example, a range over the
287-
<type>NUMERIC</> type is continuous, as is a range over <type>TIMESTAMP</>.
288-
(Even though <type>TIMESTAMP</> has limited precision, and so could
287+
<type>numeric</> type is continuous, as is a range over <type>timestamp</>.
288+
(Even though <type>timestamp</> has limited precision, and so could
289289
theoretically be treated as discrete, it's better to consider it continuous
290290
since the step size is normally not of interest.)
291291
</para>
@@ -313,8 +313,8 @@ SELECT numrange(NULL, 2.2);
313313
</para>
314314

315315
<para>
316-
The built-in range types <type>INT4RANGE</type>, <type>INT8RANGE</type>,
317-
and <type>DATERANGE</type> all use a canonical form that includes
316+
The built-in range types <type>int4range</type>, <type>int8range</type>,
317+
and <type>daterange</type> all use a canonical form that includes
318318
the lower bound and excludes the upper bound; that is,
319319
<literal>[)</literal>. User-defined range types can use other conventions,
320320
however.
@@ -332,8 +332,8 @@ SELECT numrange(NULL, 2.2);
332332

333333
<programlisting>
334334
CREATE TYPE floatrange AS RANGE (
335-
subtype = float8,
336-
subtype_diff = float8mi
335+
subtype = float8,
336+
subtype_diff = float8mi
337337
);
338338

339339
SELECT '[1.234, 5.678]'::floatrange;
@@ -451,20 +451,19 @@ CREATE INDEX reservation_idx ON reservation USING gist (during);
451451
range type. For example:
452452

453453
<programlisting>
454-
ALTER TABLE reservation
455-
ADD EXCLUDE USING gist (during WITH &amp;&amp;);
454+
ALTER TABLE reservation ADD EXCLUDE USING gist (during WITH &amp;&amp;);
456455
</programlisting>
457456

458457
That constraint will prevent any overlapping values from existing
459458
in the table at the same time:
460459

461460
<programlisting>
462461
INSERT INTO reservation VALUES
463-
( 1108, '[2010-01-01 11:30, 2010-01-01 13:00)' );
462+
(1108, '[2010-01-01 11:30, 2010-01-01 13:00)');
464463
INSERT 0 1
465464

466465
INSERT INTO reservation VALUES
467-
( 1108, '[2010-01-01 14:45, 2010-01-01 15:45)' );
466+
(1108, '[2010-01-01 14:45, 2010-01-01 15:45)');
468467
ERROR: conflicting key value violates exclusion constraint "reservation_during_excl"
469468
DETAIL: Key (during)=([ 2010-01-01 14:45:00, 2010-01-01 15:45:00 )) conflicts
470469
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 )).
480479
are equal:
481480

482481
<programlisting>
483-
CREATE TABLE room_reservation
484-
(
485-
room TEXT,
486-
during TSRANGE,
487-
EXCLUDE USING gist (room WITH =, during WITH &amp;&amp;)
482+
CREATE TABLE room_reservation (
483+
room text,
484+
during tsrange,
485+
EXCLUDE USING gist (room WITH =, during WITH &amp;&amp;)
488486
);
489487

490488
INSERT INTO room_reservation VALUES
491-
( '123A', '[2010-01-01 14:00, 2010-01-01 15:00)' );
489+
('123A', '[2010-01-01 14:00, 2010-01-01 15:00)');
492490
INSERT 0 1
493491

494492
INSERT INTO room_reservation VALUES
495-
( '123A', '[2010-01-01 14:30, 2010-01-01 15:30)' );
493+
('123A', '[2010-01-01 14:30, 2010-01-01 15:30)');
496494
ERROR: conflicting key value violates exclusion constraint "room_reservation_room_during_excl"
497495
DETAIL: Key (room, during)=(123A, [ 2010-01-01 14:30:00, 2010-01-01 15:30:00 )) conflicts with
498496
existing key (room, during)=(123A, [ 2010-01-01 14:00:00, 2010-01-01 15:00:00 )).
499497

500498
INSERT INTO room_reservation VALUES
501-
( '123B', '[2010-01-01 14:30, 2010-01-01 15:30)' );
499+
('123B', '[2010-01-01 14:30, 2010-01-01 15:30)');
502500
INSERT 0 1
503501
</programlisting>
504502
</para>

0 commit comments

Comments
 (0)