@@ -2661,19 +2661,6 @@ P <optional> <replaceable>years</>-<replaceable>months</>-<replaceable>days</> <
2661
2661
to each field if any field is negative.
2662
2662
</para>
2663
2663
2664
- <para>
2665
- Internally <type>interval</> values are stored as months, days,
2666
- and seconds. This is done because the number of days in a month
2667
- varies, and a day can have 23 or 25 hours if a daylight savings
2668
- time adjustment is involved. The months and days fields are integers
2669
- while the seconds field can store fractions. Because intervals are
2670
- usually created from constant strings or <type>timestamp</> subtraction,
2671
- this storage method works well in most cases. Functions
2672
- <function>justify_days</> and <function>justify_hours</> are
2673
- available for adjusting days and hours that overflow their normal
2674
- ranges.
2675
- </para>
2676
-
2677
2664
<para>
2678
2665
In the verbose input format, and in some fields of the more compact
2679
2666
input formats, field values can have fractional parts; for example
@@ -2725,6 +2712,33 @@ P <optional> <replaceable>years</>-<replaceable>months</>-<replaceable>days</> <
2725
2712
</tgroup>
2726
2713
</table>
2727
2714
2715
+ <para>
2716
+ Internally <type>interval</type> values are stored as months, days,
2717
+ and seconds. This is done because the number of days in a month
2718
+ varies, and a day can have 23 or 25 hours if a daylight savings
2719
+ time adjustment is involved. The months and days fields are integers
2720
+ while the seconds field can store fractions. Because intervals are
2721
+ usually created from constant strings or <type>timestamp</type> subtraction,
2722
+ this storage method works well in most cases, but can cause unexpected
2723
+ results:
2724
+
2725
+ <programlisting>
2726
+ SELECT EXTRACT(hours from '80 minutes'::interval);
2727
+ date_part
2728
+ -----------
2729
+ 1
2730
+
2731
+ SELECT EXTRACT(days from '80 hours'::interval);
2732
+ date_part
2733
+ -----------
2734
+ 0
2735
+ </programlisting>
2736
+
2737
+ Functions <function>justify_days</function> and
2738
+ <function>justify_hours</function> are available for adjusting days
2739
+ and hours that overflow their normal ranges.
2740
+ </para>
2741
+
2728
2742
</sect2>
2729
2743
2730
2744
<sect2 id="datatype-interval-output">
0 commit comments