IntervalStyle
A system parameter controlling the interval display format
IntervalStyle
is a configuration parameter determining the display format for interval values.It also determines the rules for interpreting ambiguous interval input values.
IntervalStyle
was added in PostgreSQL 8.4.
Default value
The default value for IntervalStyle
is: postgres
.
Usage
IntervalStyle
can be set to one of four values:
postgres
postgres_verbose
iso_8601
sql_standard
See the Examples section below for the different styles output by each option.
Change history
- PostgreSQL 8.4
- added (commit df7641e2)
Examples
Usage examples for IntervalStyle
:
postgres=# SHOW datestyle; DateStyle ----------- ISO, YMD (1 row) postgres=# SHOW intervalstyle; IntervalStyle --------------- postgres (1 row) postgres=# SELECT INTERVAL '1 hour', INTERVAL '1 day'; interval | interval ----------+---------- 01:00:00 | 1 day (1 row) postgres=# SET intervalstyle TO postgres_verbose; SET postgres=# SELECT INTERVAL '1 hour', INTERVAL '1 day'; interval | interval ----------+---------- @ 1 hour | @ 1 day (1 row) postgres=# SET intervalstyle TO sql_standard; SET postgres=# SELECT INTERVAL '1 hour', INTERVAL '1 day'; interval | interval ----------+----------- 1:00:00 | 1 0:00:00 (1 row) postgres=# SET intervalstyle TO iso_8601; SET postgres=# SELECT INTERVAL '1 hour', INTERVAL '1 day'; interval | interval ----------+---------- PT1H | P1D (1 row)
References
- PostgreSQL documentation: IntervalStyle