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