Skip to content

Commit 78ec1cb

Browse files
committed
Type interval takes a precision, too.
1 parent d139669 commit 78ec1cb

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

doc/src/sgml/datatype.sgml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.79 2001/12/21 03:54:02 thomas Exp $
2+
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.80 2001/12/23 20:21:37 tgl Exp $
33
-->
44

55
<chapter id="datatype">
@@ -1290,7 +1290,7 @@ SELECT b, char_length(b) FROM test2;
12901290
<entry>1 microsecond / 14 digits</entry>
12911291
</row>
12921292
<row>
1293-
<entry><type>interval</type></entry>
1293+
<entry><type>interval [ (<replaceable>p</replaceable>) ]</type></entry>
12941294
<entry>for time intervals</entry>
12951295
<entry>12 bytes</entry>
12961296
<entry>-178000000 years</entry>
@@ -1327,14 +1327,19 @@ SELECT b, char_length(b) FROM test2;
13271327
</para>
13281328

13291329
<para>
1330-
<type>time</type> and <type>timestamp</type> both accept an
1331-
optional precision field <replaceable>p</replaceable> which
1332-
determines the number of digits retained beyond the seconds
1333-
decimal point. By default, there is no explicit bound on precision
1334-
and the actual precision is determined by the underlying double
1335-
precision floating point number used to store values in seconds
1330+
<type>time</type>, <type>timestamp</type>, and <type>interval</type>
1331+
accept an
1332+
optional precision value <replaceable>p</replaceable> which
1333+
specifies the number of fractional digits retained in the seconds
1334+
field. By default, there is no explicit bound on precision. The
1335+
effective limit of precision is determined by the underlying double
1336+
precision floating point number used to store values (in seconds
13361337
for <type>interval</type> and
1337-
in seconds since 2000-01-01 for <type>timestamp</type>.
1338+
in seconds since 2000-01-01 for <type>timestamp</type>). The
1339+
useful range of <replaceable>p</replaceable> is from 0 to about
1340+
6 for <type>timestamp</type>, but may be more for <type>interval</type>.
1341+
The system will accept <replaceable>p</replaceable> ranging from
1342+
0 to 13.
13381343
</para>
13391344

13401345
<para>
@@ -1846,7 +1851,7 @@ January 8 04:05:06 1999 PST
18461851
</sect3>
18471852

18481853
<sect3>
1849-
<title><type>interval</type></title>
1854+
<title><type>interval [ ( <replaceable>precision</replaceable> ) ]</type></title>
18501855

18511856
<indexterm>
18521857
<primary>interval</primary>
@@ -1860,7 +1865,7 @@ January 8 04:05:06 1999 PST
18601865
@ Quantity Unit [Quantity Unit...] [Direction]
18611866
</programlisting>
18621867

1863-
where: <literal>Quantity</literal> is an integer (possibly signed);
1868+
where: <literal>Quantity</literal> is a number (possibly signed),
18641869
<literal>Unit</literal> is <literal>second</literal>,
18651870
<literal>minute</literal>, <literal>hour</literal>, <literal>day</literal>,
18661871
<literal>week</literal>, <literal>month</literal>, <literal>year</literal>,
@@ -1877,6 +1882,12 @@ January 8 04:05:06 1999 PST
18771882
explicit unit markings. For example, <literal>'1 12:59:10'</> is read
18781883
the same as <literal>'1 day 12 hours 59 min 10 sec'</>.
18791884
</para>
1885+
1886+
<para>
1887+
The optional precision
1888+
<replaceable>p</replaceable> should be between 0 and 13, and
1889+
defaults to the precision of the input literal.
1890+
</para>
18801891
</sect3>
18811892

18821893
<sect3>

0 commit comments

Comments
 (0)