@@ -2699,15 +2699,18 @@ P <optional> <replaceable>years</replaceable>-<replaceable>months</replaceable>-
2699
2699
</para>
2700
2700
2701
2701
<para>
2702
- In the verbose input format, and in some fields of the more compact
2703
- input formats, field values can have fractional parts; for example
2704
- <literal>'1.5 week'</literal> or <literal>'01:02:03.45'</literal>. Such input is
2705
- converted to the appropriate number of months, days, and seconds
2706
- for storage. When this would result in a fractional number of
2707
- months or days, the fraction is added to the lower-order fields
2708
- using the conversion factors 1 month = 30 days and 1 day = 24 hours.
2709
- For example, <literal>'1.5 month'</literal> becomes 1 month and 15 days.
2710
- Only seconds will ever be shown as fractional on output.
2702
+ Field values can have fractional parts: for example, <literal>'1.5
2703
+ weeks'</literal> or <literal>'01:02:03.45'</literal>. However,
2704
+ because interval internally stores only three integer units (months,
2705
+ days, microseconds), fractional units must be spilled to smaller
2706
+ units. Fractional parts of units greater than months is truncated to
2707
+ be an integer number of months, e.g. <literal>'1.5 years'</literal>
2708
+ becomes <literal>'1 year 6 mons'</literal>. Fractional parts of
2709
+ weeks and days are computed to be an integer number of days and
2710
+ microseconds, assuming 30 days per month and 24 hours per day, e.g.,
2711
+ <literal>'1.75 months'</literal> becomes <literal>1 mon 22 days
2712
+ 12:00:00</literal>. Only seconds will ever be shown as fractional
2713
+ on output.
2711
2714
</para>
2712
2715
2713
2716
<para>
@@ -2751,10 +2754,10 @@ P <optional> <replaceable>years</replaceable>-<replaceable>months</replaceable>-
2751
2754
2752
2755
<para>
2753
2756
Internally <type>interval</type> values are stored as months, days,
2754
- and seconds . This is done because the number of days in a month
2757
+ and microseconds . This is done because the number of days in a month
2755
2758
varies, and a day can have 23 or 25 hours if a daylight savings
2756
2759
time adjustment is involved. The months and days fields are integers
2757
- while the seconds field can store fractions . Because intervals are
2760
+ while the microseconds field can store fractional seconds . Because intervals are
2758
2761
usually created from constant strings or <type>timestamp</type> subtraction,
2759
2762
this storage method works well in most cases, but can cause unexpected
2760
2763
results:
0 commit comments