diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 5e5bfddf7c5..7a270eb0ab2 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -6744,127 +6744,256 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
Date/Time Operators
+
+
+
+
+
+
+
+
- Operator
- Example
- Result
+ Operator
+ Signature
+
+
+ Description
+
+
+ Example
+ Example Result
- +
- date '2001-09-28' + integer '7'
- date '2001-10-05'
+ +
+ date + integer
+ date
+
+
+ Add a number of days to a date
+
+
+ date '2001-09-28' + 7
+ 2001-10-05
- +
- date '2001-09-28' + interval '1 hour'
- timestamp '2001-09-28 01:00:00'
+ +
+ date + interval
+ timestamp
+
+
+ Add an interval to a date
+
+
+ date '2001-09-28' + interval '1 hour'
+ 2001-09-28 01:00:00
- +
- date '2001-09-28' + time '03:00'
- timestamp '2001-09-28 03:00:00'
+ +
+ date + time
+ timestamp
+
+
+ Add a time-of-day to a date
+
+
+ date '2001-09-28' + time '03:00'
+ 2001-09-28 03:00:00
- +
- interval '1 day' + interval '1 hour'
- interval '1 day 01:00:00'
+ +
+ interval + interval
+ interval
+
+
+ Add intervals
+
+
+ interval '1 day' + interval '1 hour'
+ 1 day 01:00:00
- +
- timestamp '2001-09-28 01:00' + interval '23 hours'
- timestamp '2001-09-29 00:00:00'
+ +
+ timestamp + interval
+ timestamp
+
+
+ Add an interval to a timestamp
+
+
+ timestamp '2001-09-28 01:00' + interval '23 hours'
+ 2001-09-29 00:00:00
- +
- time '01:00' + interval '3 hours'
- time '04:00:00'
+ +
+ time + interval
+ time
+
+
+ Add an interval to a time
+
+
+ time '01:00' + interval '3 hours'
+ 04:00:00
- -
- - interval '23 hours'
- interval '-23:00:00'
+ -
+ - interval
+ interval
+
+
+ Negate an interval
+
+
+ - interval '23 hours'
+ -23:00:00
- -
- date '2001-10-01' - date '2001-09-28'
- integer '3' (days)
+ -
+ date - date
+ integer
+
+
+ Subtract dates
+
+
+ date '2001-10-01' - date '2001-09-28'
+ 3
- -
- date '2001-10-01' - integer '7'
- date '2001-09-24'
+ -
+ date - integer
+ date
+
+
+ Subtract a number of days from a date
+
+
+ date '2001-10-01' - 7
+ 2001-09-24
- -
- date '2001-09-28' - interval '1 hour'
- timestamp '2001-09-27 23:00:00'
+ -
+ date - interval
+ timestamp
+
+
+ Subtract an interval from a date
+
+
+ date '2001-09-28' - interval '1 hour'
+ 2001-09-27 23:00:00
- -
- time '05:00' - time '03:00'
- interval '02:00:00'
+ -
+ time - time
+ interval
+
+
+ Subtract times
+
+
+ time '05:00' - time '03:00'
+ 02:00:00
- -
- time '05:00' - interval '2 hours'
- time '03:00:00'
+ -
+ time - interval
+ time
+
+
+ Subtract an interval from a time
+
+
+ time '05:00' - interval '2 hours'
+ 03:00:00
- -
- timestamp '2001-09-28 23:00' - interval '23 hours'
- timestamp '2001-09-28 00:00:00'
+ -
+ timestamp - interval
+ timestamp
+
+
+ Subtract an interval from a timestamp
+
+
+ timestamp '2001-09-28 23:00' - interval '23 hours'
+ 2001-09-28 00:00:00
- -
- interval '1 day' - interval '1 hour'
- interval '1 day -01:00:00'
+ -
+ interval - interval
+ interval
+
+
+ Subtract intervals
+
+
+ interval '1 day' - interval '1 hour'
+ 1 day -01:00:00
- -
- timestamp '2001-09-29 03:00' - timestamp '2001-09-27 12:00'
- interval '1 day 15:00:00'
+ -
+ timestamp - timestamp
+ interval
+
+
+ Subtract timestamps
+
+
+ timestamp '2001-09-29 03:00' - timestamp '2001-09-27 12:00'
+ 1 day 15:00:00
- *
- 900 * interval '1 second'
- interval '00:15:00'
+ *
+ double precision * interval
+ interval
+
+
+ Multiply an interval by a scalar
+
+
+ 900 * interval '1 second'
+ 00:15:00
+
+
+ 21 * interval '1 day'
+ 21 days
+
+
+ 3.5 * interval '1 hour'
+ 03:30:00
- *
- 21 * interval '1 day'
- interval '21 days'
+ /
+ interval / double precision
+ interval
-
- *
- double precision '3.5' * interval '1 hour'
- interval '03:30:00'
+ Divide an interval by a scalar
-
- /
- interval '1 hour' / double precision '1.5'
- interval '00:40:00'
+ interval '1 hour' / 1.5
+ 00:40:00
@@ -6872,471 +7001,677 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
Date/Time Functions
-
+
+
+
+
+
+
+
+
+
- Function
- Return Type
- Description
- Example
- Result
+ Function
+ Signature
+
+
+ Description
+
+
+ Example
+ Example Result
-
+
age
- age(timestamp, timestamp)
+ age
- interval
- Subtract arguments, producing a symbolic
result that
+ age(timestamp, timestamp)
+ interval
+
+
+ Subtract arguments, producing a symbolic
result that
uses years and months, rather than just days
- age(timestamp '2001-04-10', timestamp '1957-06-13')
- 43 years 9 mons 27 days
+
+
+ age(timestamp '2001-04-10', timestamp '1957-06-13')
+ 43 years 9 mons 27 days
- age(timestamp)
- interval
- Subtract from current_date (at midnight)
- age(timestamp '1957-06-13')
- 43 years 8 mons 3 days
+ age
+ age(timestamp)
+ interval
+
+
+ Subtract from current_date (at midnight)
+
+
+ age(timestamp '1957-06-13')
+ variable
-
+
clock_timestamp
- clock_timestamp()
+ clock_timestamp
- timestamp with time zone
- Current date and time (changes during statement execution);
+ clock_timestamp()
+ timestamp with time zone
+
+
+ Current date and time (changes during statement execution);
see
-
-
+
+
+ clock_timestamp()
+ variable
-
+
current_date
- current_date
+ current_date
- date
- Current date;
+ current_date
+ date
+
+
+ Current date;
see
-
-
+
+
+ current_date
+ variable
-
+
current_time
- current_time
+ current_time
- time with time zone
- Current time of day;
+ current_time
+ time with time zone
+
+
+ Current time of day;
see
-
-
+
+
+ current_time
+ variable
-
+ current_time
+ current_time(integer)
+ time with time zone
+
+
+ Current time of day, with limited precision;
+ see
+
+
+
+ current_time(2)
+ variable
+
+
+
+
current_timestamp
- current_timestamp
+ current_timestamp
- timestamp with time zone
- Current date and time (start of current transaction);
+ current_timestamp
+ timestamp with time zone
+
+
+ Current date and time (start of current transaction);
see
-
-
+
+
+ current_timestamp
+ variable
-
+ current_timestamp
+ current_timestamp(integer)
+ timestamp with time zone
+
+
+ Current date and time (start of current transaction), with limited precision;
+ see
+
+
+
+ current_timestamp(0)
+ variable
+
+
+
+
date_part
- date_part(text, timestamp)
+ date_part
- double precision
- Get subfield (equivalent to extract);
+ date_part(text, timestamp)
+ double precision
+
+
+ Get timestamp subfield (equivalent to extract);
see
- date_part('hour', timestamp '2001-02-16 20:38:40')
- 20
+
+
+ date_part('hour', timestamp '2001-02-16 20:38:40')
+ 20
- date_part(text, interval)
- double precision
- Get subfield (equivalent to
+ date_part
+ date_part(text, interval)
+ double precision
+
+
+ Get interval subfield (equivalent to
extract); see
- date_part('month', interval '2 years 3 months')
- 3
+
+
+ date_part('month', interval '2 years 3 months')
+ 3
-
+
date_trunc
- date_trunc(text, timestamp)
+ date_trunc
- timestamp
- Truncate to specified precision; see
+ date_trunc(text, timestamp)
+ timestamp
+
+
+ Truncate to specified precision; see
- date_trunc('hour', timestamp '2001-02-16 20:38:40')
- 2001-02-16 20:00:00
+
+
+ date_trunc('hour', timestamp '2001-02-16 20:38:40')
+ 2001-02-16 20:00:00
- date_trunc(text, timestamp with time zone, text)
- timestamp with time zone
- Truncate to specified precision in the specified time zone; see
+ date_trunc
+ date_trunc(text, timestamp with time zone, text)
+ timestamp with time zone
+
+
+ Truncate to specified precision in the specified time zone; see
- date_trunc('day', timestamptz '2001-02-16 20:38:40+00', 'Australia/Sydney')
- 2001-02-16 13:00:00+00
+
+
+ date_trunc('day', timestamptz '2001-02-16 20:38:40+00', 'Australia/Sydney')
+ 2001-02-16 13:00:00+00
- date_trunc(text, interval)
- interval
- Truncate to specified precision; see
+ date_trunc
+ date_trunc(text, interval)
+ interval
+
+
+ Truncate to specified precision; see
- date_trunc('hour', interval '2 days 3 hours 40 minutes')
- 2 days 03:00:00
+
+
+ date_trunc('hour', interval '2 days 3 hours 40 minutes')
+ 2 days 03:00:00
-
+
extract
- extract(field from
- timestamp)
+ extract
- double precision
- Get subfield; see
+ extract(field from timestamp)
+ double precision
+
+
+ Get timestamp subfield; see
- extract(hour from timestamp '2001-02-16 20:38:40')
- 20
+
+
+ extract(hour from timestamp '2001-02-16 20:38:40')
+ 20
- extract(field from
- interval)
- double precision
- Get subfield; see
+ extract
+ extract(field from interval)
+ double precision
+
+
+ Get interval subfield; see
- extract(month from interval '2 years 3 months')
- 3
+
+
+ extract(month from interval '2 years 3 months')
+ 3
-
+
isfinite
- isfinite(date)
+ isfinite
- boolean
- Test for finite date (not +/-infinity)
- isfinite(date '2001-02-16')
- true
+ isfinite(date)
+ boolean
+
+
+ Test for finite date (not +/-infinity)
+
+
+ isfinite(date '2001-02-16')
+ true
- isfinite(timestamp)
- boolean
- Test for finite time stamp (not +/-infinity)
- isfinite(timestamp '2001-02-16 21:28:30')
- true
+ isfinite
+ isfinite(timestamp)
+ boolean
+
+
+ Test for finite timestamp (not +/-infinity)
+
+
+ isfinite(timestamp 'infinity')
+ false
- isfinite(interval)
- boolean
- Test for finite interval
- isfinite(interval '4 hours')
- true
+ isfinite
+ isfinite(interval)
+ boolean
+
+
+ Test for finite interval (currently always true)
+
+
+ isfinite(interval '4 hours')
+ true
-
+
justify_days
- justify_days(interval)
+ justify_days
- interval
- Adjust interval so 30-day time periods are represented as months
- justify_days(interval '35 days')
- 1 mon 5 days
+ justify_days(interval)
+ interval
+
+
+ Adjust interval so 30-day time periods are represented as months
+
+
+ justify_days(interval '35 days')
+ 1 mon 5 days
-
+
justify_hours
- justify_hours(interval)
+ justify_hours
- interval
- Adjust interval so 24-hour time periods are represented as days
- justify_hours(interval '27 hours')
- 1 day 03:00:00
+ justify_hours(interval)
+ interval
+
+
+ Adjust interval so 24-hour time periods are represented as days
+
+
+ justify_hours(&zwsp;interval '27 hours')
+ 1 day 03:00:00
-
+
justify_interval
- justify_interval(interval)
+ justify_interval
- interval
- Adjust interval using justify_days and justify_hours, with additional sign adjustments
- justify_interval(interval '1 mon -1 hour')
- 29 days 23:00:00
+ justify_interval(interval)
+ interval
+
+
+ Adjust interval using justify_days and justify_hours, with additional sign adjustments
+
+
+ justify_interval(&zwsp;interval '1 mon -1 hour')
+ 29 days 23:00:00
-
+
localtime
- localtime
+ localtime
- time
- Current time of day;
+ localtime
+ time
+
+
+ Current time of day;
see
-
-
+
+
+ localtime
+ variable
-
+ localtime
+ localtime(integer)
+ time
+
+
+ Current time of day, with limited precision;
+ see
+
+
+
+ localtime(0)
+ variable
+
+
+
+
localtimestamp
- localtimestamp
+ localtimestamp
- timestamp
- Current date and time (start of current transaction);
+ localtimestamp
+ timestamp
+
+
+ Current date and time (start of current transaction);
see
-
-
+
+
+ localtimestamp
+ variable
-
+ localtimestamp
+ localtimestamp(integer)
+ timestamp
+
+
+ Current date and time (start of current
+ transaction), with limited precision;
+ see
+
+
+
+ localtimestamp(2)
+ variable
+
+
+
+
make_date
-
-
- make_date(year int,
- month int,
- day int)
-
-
+ make_date
- date
-
+ make_date(year int,
+ month int,
+ day int)
+ date
+
+
+
Create date from year, month and day fields
- make_date(2013, 7, 15)
- 2013-07-15
+
+
+ make_date(2013, 7, 15)
+ 2013-07-15
-
-
+
make_interval
-
-
- make_interval(years int DEFAULT 0,
- months int DEFAULT 0,
- weeks int DEFAULT 0,
- days int DEFAULT 0,
- hours int DEFAULT 0,
- mins int DEFAULT 0,
- secs double precision DEFAULT 0.0)
-
-
+ make_interval
- interval
-
+ make_interval( year int
+ , month int
+ , week int
+ , day int
+ , hour int
+ , min int
+ , sec double precision
+ )
+ interval
+
+
+
Create interval from years, months, weeks, days, hours, minutes and
- seconds fields
+ seconds fields, each of which can default to zero
- make_interval(days => 10)
- 10 days
+
+
+ make_interval(days => 10)
+ 10 days
-
+
make_time
-
-
- make_time(hour int,
- min int,
- sec double precision)
-
-
+ make_time
- time
-
+ make_time(hour int,
+ min int,
+ sec double precision)
+ time
+
+
+
Create time from hour, minute and seconds fields
- make_time(8, 15, 23.5)
- 08:15:23.5
+
+
+ make_time(8, 15, 23.5)
+ 08:15:23.5
-
+
make_timestamp
-
-
- make_timestamp(year int,
- month int,
- day int,
- hour int,
- min int,
- sec double precision)
-
-
+ make_timestamp
- timestamp
-
+ make_timestamp(year int,
+ month int,
+ day int,
+ hour int,
+ min int,
+ sec double precision)
+ timestamp
+
+
+
Create timestamp from year, month, day, hour, minute and seconds fields
- make_timestamp(2013, 7, 15, 8, 15, 23.5)
- 2013-07-15 08:15:23.5
+
+
+ make_timestamp(&zwsp;2013, 7, 15, 8, 15, 23.5)
+ 2013-07-15 08:15:23.5
-
+
make_timestamptz
-
-
- make_timestamptz(year int,
- month int,
- day int,
- hour int,
- min int,
- sec double precision,
- timezone text )
-
-
+ make_timestamptz
- timestamp with time zone
-
+ make_timestamptz(year int,
+ month int,
+ day int,
+ hour int,
+ min int,
+ sec double precision
+ , timezone text )
+ timestamp with time zone
+
+
+
Create timestamp with time zone from year, month, day, hour, minute
and seconds fields; if timezone is not
specified, the current time zone is used
- make_timestamptz(2013, 7, 15, 8, 15, 23.5)
- 2013-07-15 08:15:23.5+01
+
+
+ make_timestamptz(&zwsp;2013, 7, 15, 8, 15, 23.5)
+ 2013-07-15 08:15:23.5+01
-
+
now
- now()
+ now
- timestamp with time zone
- Current date and time (start of current transaction);
+ now()
+ timestamp with time zone
+
+
+ Current date and time (start of current transaction);
see
-
-
+
+
+ now()
+ variable
-
+
statement_timestamp
- statement_timestamp()
+ statement_timestamp
- timestamp with time zone
- Current date and time (start of current statement);
+ statement_timestamp()
+ timestamp with time zone
+
+
+ Current date and time (start of current statement);
see
-
-
+
+
+ statement_timestamp()
+ variable
-
+
timeofday
- timeofday()
+ timeofday
- text
- Current date and time
+ timeofday()
+ text
+
+
+ Current date and time
(like clock_timestamp, but as a text string);
see
-
-
+
+
+ timeofday()
+ variable
-
+
transaction_timestamp
- transaction_timestamp()
+ transaction_timestamp
- timestamp with time zone
- Current date and time (start of current transaction);
- see
-
-
-
+ transaction_timestamp()
+ timestamp with time zone
-
+ Current date and time (start of current transaction);
+ see
+
+
+
+ transaction_&zwsp;timestamp()
+ variable
+
+
+
to_timestamp
- to_timestamp(double precision)
+ to_timestamp
- timestamp with time zone
- Convert Unix epoch (seconds since 1970-01-01 00:00:00+00) to
+ to_timestamp(double precision)
+ timestamp with time zone
+
+
+ Convert Unix epoch (seconds since 1970-01-01 00:00:00+00) to
timestamp
- to_timestamp(1284352323)
- 2010-09-13 04:32:03+00
+
+
+ to_timestamp(&zwsp;1284352323)
+ 2010-09-13 04:32:03+00
@@ -8310,52 +8645,83 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
Enum Support Functions
-
+
+
+
+
+
+
+
+
+
- Function
- Description
- Example
- Example Result
+ Function
+ Signature
+
+
+ Description
+
+
+ Example
+ Example Result
-
-
- enum_first
-
- enum_first(anyenum)
+
+
+ enum_first
+
+ enum_first
- Returns the first value of the input enum type
- enum_first(null::rainbow)
- red
+ enum_first(anyenum) anyenum
-
-
- enum_last
-
- enum_last(anyenum)
-
- Returns the last value of the input enum type
- enum_last(null::rainbow)
- purple
+ Returns the first value of the input enum type
-
-
- enum_range
-
- enum_range(anyenum)
-
- Returns all values of the input enum type in an ordered array
- enum_range(null::rainbow)
- {red,orange,yellow,green,blue,purple}
+ enum_first(&zwsp;null::rainbow)
+ red
- enum_range(anyenum, anyenum)
-
+
+
+ enum_last
+
+ enum_last
+
+ enum_last(anyenum) anyenum
+
+
+ Returns the last value of the input enum type
+
+
+ enum_last(&zwsp;null::rainbow)
+ purple
+
+
+
+
+ enum_range
+
+ enum_range
+
+ enum_range(anyenum) anyarray
+
+
+ Returns all values of the input enum type in an ordered array
+
+
+ enum_range(&zwsp;null::rainbow)
+ {red,orange,yellow,&zwsp;green,blue,purple}
+
+
+ enum_range
+ enum_range(anyenum, anyenum) anyarray
+
+
+
Returns the range between the two given enum values, as an ordered
array. The values must be from the same enum type. If the first
parameter is null, the result will start with the first value of
@@ -8363,16 +8729,18 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
If the second parameter is null, the result will end with the last
value of the enum type.
- enum_range('orange'::rainbow, 'green'::rainbow)
- {orange,yellow,green}
- enum_range(NULL, 'green'::rainbow)
- {red,orange,yellow,green}
+ enum_range(&zwsp;'orange'::rainbow, 'green'::rainbow)
+ {orange,yellow,green}
- enum_range('orange'::rainbow, NULL)
- {orange,yellow,green,blue,purple}
+ enum_range(NULL, 'green'::rainbow)
+ {red,orange,yellow,&zwsp;green}
+
+
+ enum_range(&zwsp;'orange'::rainbow, NULL)
+ {orange,yellow,green,&zwsp;blue,purple}
@@ -8384,7 +8752,7 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
only about its declared data type. Either null or a specific value of
the type can be passed, with the same result. It is more common to
apply these functions to a table column or function argument than to
- a hardwired type name as suggested by the examples.
+ a hardwired type name as used in the examples.
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index e148c9057f8..a13565e6018 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -49,6 +49,12 @@
+
+
+ →
+
+
+
diff --git a/doc/src/sgml/stylesheet-fo.xsl b/doc/src/sgml/stylesheet-fo.xsl
index ea754084be0..2aaae82092f 100644
--- a/doc/src/sgml/stylesheet-fo.xsl
+++ b/doc/src/sgml/stylesheet-fo.xsl
@@ -63,6 +63,13 @@
+
+
+
+ →
+
+
+