@@ -2688,19 +2688,6 @@ P <optional> <replaceable>years</>-<replaceable>months</>-<replaceable>days</> <
2688
2688
to each field if any field is negative.
2689
2689
</para>
2690
2690
2691
- <para>
2692
- Internally <type>interval</> values are stored as months, days,
2693
- and seconds. This is done because the number of days in a month
2694
- varies, and a day can have 23 or 25 hours if a daylight savings
2695
- time adjustment is involved. The months and days fields are integers
2696
- while the seconds field can store fractions. Because intervals are
2697
- usually created from constant strings or <type>timestamp</> subtraction,
2698
- this storage method works well in most cases. Functions
2699
- <function>justify_days</> and <function>justify_hours</> are
2700
- available for adjusting days and hours that overflow their normal
2701
- ranges.
2702
- </para>
2703
-
2704
2691
<para>
2705
2692
In the verbose input format, and in some fields of the more compact
2706
2693
input formats, field values can have fractional parts; for example
@@ -2752,6 +2739,33 @@ P <optional> <replaceable>years</>-<replaceable>months</>-<replaceable>days</> <
2752
2739
</tgroup>
2753
2740
</table>
2754
2741
2742
+ <para>
2743
+ Internally <type>interval</type> values are stored as months, days,
2744
+ and seconds. This is done because the number of days in a month
2745
+ varies, and a day can have 23 or 25 hours if a daylight savings
2746
+ time adjustment is involved. The months and days fields are integers
2747
+ while the seconds field can store fractions. Because intervals are
2748
+ usually created from constant strings or <type>timestamp</type> subtraction,
2749
+ this storage method works well in most cases, but can cause unexpected
2750
+ results:
2751
+
2752
+ <programlisting>
2753
+ SELECT EXTRACT(hours from '80 minutes'::interval);
2754
+ date_part
2755
+ -----------
2756
+ 1
2757
+
2758
+ SELECT EXTRACT(days from '80 hours'::interval);
2759
+ date_part
2760
+ -----------
2761
+ 0
2762
+ </programlisting>
2763
+
2764
+ Functions <function>justify_days</function> and
2765
+ <function>justify_hours</function> are available for adjusting days
2766
+ and hours that overflow their normal ranges.
2767
+ </para>
2768
+
2755
2769
</sect2>
2756
2770
2757
2771
<sect2 id="datatype-interval-output">
0 commit comments