to each field if any field is negative.
- Internally interval values are stored as months, days,
- and seconds. This is done because the number of days in a month
- varies, and a day can have 23 or 25 hours if a daylight savings
- time adjustment is involved. The months and days fields are integers
- while the seconds field can store fractions. Because intervals are
- usually created from constant strings or timestamp subtraction,
- this storage method works well in most cases. Functions
- justify_days and justify_hours are
- available for adjusting days and hours that overflow their normal
- ranges.
-
-
In the verbose input format, and in some fields of the more compact
input formats, field values can have fractional parts; for example
+ Internally interval values are stored as months, days,
+ and seconds. This is done because the number of days in a month
+ varies, and a day can have 23 or 25 hours if a daylight savings
+ time adjustment is involved. The months and days fields are integers
+ while the seconds field can store fractions. Because intervals are
+ usually created from constant strings or timestamp subtraction,
+ this storage method works well in most cases, but can cause unexpected
+ results:
+
+SELECT EXTRACT(hours from '80 minutes'::interval);
+ date_part
+-----------
+ 1
+
+SELECT EXTRACT(days from '80 hours'::interval);
+ date_part
+-----------
+ 0
+
+
+ Functions justify_days and
+ justify_hours are available for adjusting days
+ and hours that overflow their normal ranges.
+
+