Type interval takes a precision, too.

This commit is contained in:
Tom Lane 2001-12-23 20:21:37 +00:00
parent d1396696e0
commit 78ec1cb027

View File

@ -1,5 +1,5 @@
<!-- <!--
$Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.79 2001/12/21 03:54:02 thomas Exp $ $Header: /cvsroot/pgsql/doc/src/sgml/datatype.sgml,v 1.80 2001/12/23 20:21:37 tgl Exp $
--> -->
<chapter id="datatype"> <chapter id="datatype">
@ -1290,7 +1290,7 @@ SELECT b, char_length(b) FROM test2;
<entry>1 microsecond / 14 digits</entry> <entry>1 microsecond / 14 digits</entry>
</row> </row>
<row> <row>
<entry><type>interval</type></entry> <entry><type>interval [ (<replaceable>p</replaceable>) ]</type></entry>
<entry>for time intervals</entry> <entry>for time intervals</entry>
<entry>12 bytes</entry> <entry>12 bytes</entry>
<entry>-178000000 years</entry> <entry>-178000000 years</entry>
@ -1327,14 +1327,19 @@ SELECT b, char_length(b) FROM test2;
</para> </para>
<para> <para>
<type>time</type> and <type>timestamp</type> both accept an <type>time</type>, <type>timestamp</type>, and <type>interval</type>
optional precision field <replaceable>p</replaceable> which accept an
determines the number of digits retained beyond the seconds optional precision value <replaceable>p</replaceable> which
decimal point. By default, there is no explicit bound on precision specifies the number of fractional digits retained in the seconds
and the actual precision is determined by the underlying double field. By default, there is no explicit bound on precision. The
precision floating point number used to store values in seconds effective limit of precision is determined by the underlying double
precision floating point number used to store values (in seconds
for <type>interval</type> and for <type>interval</type> and
in seconds since 2000-01-01 for <type>timestamp</type>. in seconds since 2000-01-01 for <type>timestamp</type>). The
useful range of <replaceable>p</replaceable> is from 0 to about
6 for <type>timestamp</type>, but may be more for <type>interval</type>.
The system will accept <replaceable>p</replaceable> ranging from
0 to 13.
</para> </para>
<para> <para>
@ -1846,7 +1851,7 @@ January 8 04:05:06 1999 PST
</sect3> </sect3>
<sect3> <sect3>
<title><type>interval</type></title> <title><type>interval [ ( <replaceable>precision</replaceable> ) ]</type></title>
<indexterm> <indexterm>
<primary>interval</primary> <primary>interval</primary>
@ -1860,7 +1865,7 @@ January 8 04:05:06 1999 PST
@ Quantity Unit [Quantity Unit...] [Direction] @ Quantity Unit [Quantity Unit...] [Direction]
</programlisting> </programlisting>
where: <literal>Quantity</literal> is an integer (possibly signed); where: <literal>Quantity</literal> is a number (possibly signed),
<literal>Unit</literal> is <literal>second</literal>, <literal>Unit</literal> is <literal>second</literal>,
<literal>minute</literal>, <literal>hour</literal>, <literal>day</literal>, <literal>minute</literal>, <literal>hour</literal>, <literal>day</literal>,
<literal>week</literal>, <literal>month</literal>, <literal>year</literal>, <literal>week</literal>, <literal>month</literal>, <literal>year</literal>,
@ -1877,6 +1882,12 @@ January 8 04:05:06 1999 PST
explicit unit markings. For example, <literal>'1 12:59:10'</> is read explicit unit markings. For example, <literal>'1 12:59:10'</> is read
the same as <literal>'1 day 12 hours 59 min 10 sec'</>. the same as <literal>'1 day 12 hours 59 min 10 sec'</>.
</para> </para>
<para>
The optional precision
<replaceable>p</replaceable> should be between 0 and 13, and
defaults to the precision of the input literal.
</para>
</sect3> </sect3>
<sect3> <sect3>