| The PostgreSQL 9.0 Reference Manual - Volume 1A - SQL Language Reference
by The PostgreSQL Global Development Group Paperback (6"x9"), 454 pages ISBN 9781906966041 RRP £14.95 ($19.95) Sales of this book support the PostgreSQL project! Get a printed copy>>> |
6.5.5 Interval Output
The output format of the interval type can be set to one of the
four styles sql_standard, postgres,
postgres_verbose, or iso_8601,
using the command SET intervalstyle.
The default is the postgres format.
Table 6-18 shows examples of each
output style.
The sql_standard style produces output that conforms to
the SQL standard's specification for interval literal strings, if
the interval value meets the standard's restrictions (either year-month
only or day-time only, with no mixing of positive
and negative components). Otherwise the output looks like a standard
year-month literal string followed by a day-time literal string,
with explicit signs added to disambiguate mixed-sign intervals.
The output of the postgres style matches the output of
PostgreSQL releases prior to 8.4 when the
DateStyle parameter was set to ISO.
The output of the postgres_verbose style matches the output of
PostgreSQL releases prior to 8.4 when the
DateStyle parameter was set to non-ISO output.
The output of the iso_8601 style matches the “format
with designators” described in section 4.4.3.2 of the
ISO 8601 standard.
| Style Specification | Year-Month Interval | Day-Time Interval | Mixed Interval
|
sql_standard | 1-2 | 3 4:05:06 | -1-2 +3 -4:05:06
|
postgres | 1 year 2 mons | 3 days 04:05:06 | -1 year -2 mons +3 days -04:05:06
|
postgres_verbose | @ 1 year 2 mons | @ 3 days 4 hours 5 mins 6 secs | @ 1 year 2 mons -3 days 4 hours 5 mins 6 secs ago
|
iso_8601 | P1Y2M | P3DT4H5M6S | P-1Y-2M3DT-4H-5M-6S |
| ISBN 9781906966041 | The PostgreSQL 9.0 Reference Manual - Volume 1A - SQL Language Reference | See the print edition |