1
1
<!--
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 $
3
3
-->
4
4
5
5
<chapter id="datatype">
@@ -1290,7 +1290,7 @@ SELECT b, char_length(b) FROM test2;
1290
1290
<entry>1 microsecond / 14 digits</entry>
1291
1291
</row>
1292
1292
<row>
1293
- <entry><type>interval</type></entry>
1293
+ <entry><type>interval [ (<replaceable>p</replaceable>) ] </type></entry>
1294
1294
<entry>for time intervals</entry>
1295
1295
<entry>12 bytes</entry>
1296
1296
<entry>-178000000 years</entry>
@@ -1327,14 +1327,19 @@ SELECT b, char_length(b) FROM test2;
1327
1327
</para>
1328
1328
1329
1329
<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
1336
1337
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.
1338
1343
</para>
1339
1344
1340
1345
<para>
@@ -1846,7 +1851,7 @@ January 8 04:05:06 1999 PST
1846
1851
</sect3>
1847
1852
1848
1853
<sect3>
1849
- <title><type>interval</type></title>
1854
+ <title><type>interval [ ( <replaceable>precision</replaceable> ) ] </type></title>
1850
1855
1851
1856
<indexterm>
1852
1857
<primary>interval</primary>
@@ -1860,7 +1865,7 @@ January 8 04:05:06 1999 PST
1860
1865
@ Quantity Unit [Quantity Unit...] [Direction]
1861
1866
</programlisting>
1862
1867
1863
- where: <literal>Quantity</literal> is an integer (possibly signed);
1868
+ where: <literal>Quantity</literal> is a number (possibly signed),
1864
1869
<literal>Unit</literal> is <literal>second</literal>,
1865
1870
<literal>minute</literal>, <literal>hour</literal>, <literal>day</literal>,
1866
1871
<literal>week</literal>, <literal>month</literal>, <literal>year</literal>,
@@ -1877,6 +1882,12 @@ January 8 04:05:06 1999 PST
1877
1882
explicit unit markings. For example, <literal>'1 12:59:10'</> is read
1878
1883
the same as <literal>'1 day 12 hours 59 min 10 sec'</>.
1879
1884
</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>
1880
1891
</sect3>
1881
1892
1882
1893
<sect3>
0 commit comments