|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.232 2008/11/09 00:28:34 tgl Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/datatype.sgml,v 1.233 2008/11/09 17:09:48 tgl Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="datatype">
|
4 | 4 | <title id="datatype-title">Data Types</title>
|
@@ -2413,13 +2413,26 @@ January 8 04:05:06 1999 PST
|
2413 | 2413 | Internally <type>interval</> values are stored as months, days,
|
2414 | 2414 | and seconds. This is done because the number of days in a month
|
2415 | 2415 | varies, and a day can have 23 or 25 hours if a daylight savings
|
2416 |
| - time adjustment is involved. Because intervals are usually created |
2417 |
| - from constant strings or <type>timestamp</> subtraction, this |
2418 |
| - storage method works well in most cases. Functions |
| 2416 | + time adjustment is involved. The months and days fields are integers |
| 2417 | + while the seconds field can store fractions. Because intervals are |
| 2418 | + usually created from constant strings or <type>timestamp</> subtraction, |
| 2419 | + this storage method works well in most cases. Functions |
2419 | 2420 | <function>justify_days</> and <function>justify_hours</> are
|
2420 | 2421 | available for adjusting days and hours that overflow their normal
|
2421 | 2422 | ranges.
|
2422 | 2423 | </para>
|
| 2424 | + |
| 2425 | + <para> |
| 2426 | + In the verbose input format, and in some fields of the more compact |
| 2427 | + input formats, field values can have fractional parts; for example |
| 2428 | + <literal>'1.5 week'</> or <literal>'01:02:03.45'</>. Such input is |
| 2429 | + converted to the appropriate number of months, days, and seconds |
| 2430 | + for storage. When this would result in a fractional number of |
| 2431 | + months or days, the fraction is added to the lower-order fields |
| 2432 | + using the conversion factors 1 month = 30 days and 1 day = 24 hours. |
| 2433 | + For example, <literal>'1.5 month'</> becomes 1 month and 15 days. |
| 2434 | + Only seconds will ever be shown as fractional on output. |
| 2435 | + </para> |
2423 | 2436 | </sect2>
|
2424 | 2437 |
|
2425 | 2438 | <sect2 id="datatype-interval-output">
|
|
0 commit comments