diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 7a270eb0ab2..92c1835ae3e 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -1750,7 +1750,7 @@
text
- Remove the longest string containing only characters from
+ Remove the longest string containing only characters in
characters (a space by default) from the
start, end, or both ends (both is the default)
of string
@@ -1798,243 +1798,240 @@
Other String Functions
-
+
- Function
- Return Type
- Description
- Example
- Result
+
+ FunctionDescriptionExample(s)
+
-
+ ascii
- ascii(string)
+ ascii ( text )
+ integer
+
+ Returns the numeric code of the first character of the argument.
+ In UTF8 encoding, returns the Unicode code point
+ of the character. In other multibyte encodings, the argument must
+ be an ASCII character.
+
+ ascii('x')
+ 120
- int
-
- ASCII code of the first character of the
- argument. For UTF8 returns the Unicode code
- point of the character. For other multibyte encodings, the
- argument must be an ASCII character.
-
- ascii('x')
- 120
-
+ btrim
- btrim(stringtext
- , characterstext)
-
- text
-
- Remove the longest string consisting only of characters
+ btrim ( stringtext
+ , characterstext )
+ text
+
+ Removes the longest string consisting only of characters
in characters (a space by default)
- from the start and end of string
+ from the start and end of string.
+
+ btrim('xyxtrimyyx', 'xyz')
+ trim
- btrim('xyxtrimyyx', 'xyz')
- trim
-
+ chr
- chr(int)
+ chr ( integer )
+ text
+
+ Returns the character with the given code. In UTF8
+ encoding the argument is treated as a Unicode code point. In other
+ multibyte encodings the argument must designate
+ an ASCII character. chr(0) is
+ disallowed because text data types cannot store that character.
+
+ chr(65)
+ A
- text
-
- Character with the given code. For UTF8 the
- argument is treated as a Unicode code point. For other multibyte
- encodings the argument must designate an
- ASCII character. The NULL (0) character is not
- allowed because text data types cannot store such bytes.
-
- chr(65)
- A
-
+ concat
- concat(str"any"
- [, str"any" [, ...] ])
-
- text
-
- Concatenate the text representations of all the arguments.
+ concat ( val1"any"
+ [, val2"any" [, ...] ] )
+ text
+
+ Concatenates the text representations of all the arguments.
NULL arguments are ignored.
+
+ concat('abcde', 2, NULL, 22)
+ abcde222
- concat('abcde', 2, NULL, 22)
- abcde222
-
+ concat_ws
- concat_ws(septext,
- str"any"
- [, str"any" [, ...] ])
+ concat_ws ( septext,
+ val1"any"
+ [, val2"any" [, ...] ] )
+ text
+
+ Concatenates all but the first argument, with separators. The first
+ argument is used as the separator string, and should not be NULL.
+ Other NULL arguments are ignored.
+
+ concat_ws(',', 'abcde', 2, NULL, 22)
+ abcde,2,22
- text
-
- Concatenate all but the first argument with separators. The first
- argument is used as the separator string. NULL arguments are ignored.
-
- concat_ws(',', 'abcde', 2, NULL, 22)
- abcde,2,22
-
+ format
- format(formatstrtext
- [, formatarg"any" [, ...] ])
-
- text
-
- Format arguments according to a format string.
+ format ( formatstrtext
+ [, formatarg"any" [, ...] ] )
+ text
+
+ Formats arguments according to a format string;
+ see .
This function is similar to the C function sprintf.
- See .
+
+ format('Hello %s, %1$s', 'World')
+ Hello World, World
- format('Hello %s, %1$s', 'World')
- Hello World, World
-
+ initcap
- initcap(string)
-
- text
-
- Convert the first letter of each word to upper case and the
+ initcap ( text )
+ text
+
+ Converts the first letter of each word to upper case and the
rest to lower case. Words are sequences of alphanumeric
characters separated by non-alphanumeric characters.
+
+ initcap('hi THOMAS')
+ Hi Thomas
- initcap('hi THOMAS')
- Hi Thomas
-
+ left
- left(stringtext,
- nint)
+ left ( stringtext,
+ ninteger )
+ text
+
+ Returns first n characters in the
+ string, or when n is negative, returns
+ all but last |n| characters.
+
+ left('abcde', 2)
+ ab
- text
-
- Return first n characters in the
- string, or when n is negative, return
- all but last |n| characters
-
- left('abcde', 2)
- ab
-
+ length
- length(string)
+ length ( text )
+ integer
+
+ Returns the number of characters in the string.
+
+ length('jose')
+ 4
- int
-
- Number of characters in string
-
- length('jose')
- 4
-
+ lpad
- lpad(stringtext,
- lengthint
- , filltext)
-
- text
-
- Extend the string to length
+ lpad ( stringtext,
+ lengthinteger
+ , filltext )
+ text
+
+ Extends the string to length
length by prepending the characters
fill (a space by default). If the
string is already longer than
- length then it is truncated (on the
- right).
+ length then it is truncated (on the right).
+
+ lpad('hi', 5, 'xy')
+ xyxhi
- lpad('hi', 5, 'xy')
- xyxhi
-
+ ltrim
- ltrim(stringtext
- , characterstext)
-
- text
-
- Remove the longest string containing only characters from
+ ltrim ( stringtext
+ , characterstext )
+ text
+
+ Removes the longest string containing only characters in
characters (a space by default) from the start of
- string
+ string.
+
+ ltrim('zzzytest', 'xyz')
+ test
- ltrim('zzzytest', 'xyz')
- test
-
+ md5
- md5(string)
+ md5 ( text )
+ text
+
+ Computes the MD5 hash of
+ the argument, with the result written in hexadecimal.
+
+ md5('abc')
+ 900150983cd24fb0&zwsp;d6963f7d28e17f72
- text
-
- MD5 hash, with
- the result written in hexadecimal
-
- md5('abc')
- 900150983cd24fb0 d6963f7d28e17f72
-
+ parse_ident
- parse_ident(qualified_identifiertext
- [, strictmodeboolean DEFAULT true ] )
-
- text[]
-
- Split qualified_identifier into an array of
+ parse_ident ( qualified_identifiertext
+ [, strict_modebooleanDEFAULTtrue ] )
+ text[]
+
+ Splits qualified_identifier into an array of
identifiers, removing any quoting of individual identifiers. By
default, extra characters after the last identifier are considered an
error; but if the second parameter is false, then such
@@ -2042,417 +2039,445 @@
names for objects like functions.) Note that this function does not
truncate over-length identifiers. If you want truncation you can cast
the result to name[].
+
+ parse_ident('"SomeSchema".someTable')
+ {SomeSchema,sometable}
- parse_ident('"SomeSchema".someTable')
- {SomeSchema,sometable}
-
+ pg_client_encoding
- pg_client_encoding()
+ pg_client_encoding ( )
+ name
+
+ Returns current client encoding name.
+
+ pg_client_encoding()
+ UTF8
- name
-
- Current client encoding name
-
- pg_client_encoding()
- SQL_ASCII
-
+ quote_ident
- quote_ident(stringtext)
-
- text
-
- Return the given string suitably quoted to be used as an identifier
+ quote_ident ( text )
+ text
+
+ Returns the given string suitably quoted to be used as an identifier
in an SQL statement string.
Quotes are added only if necessary (i.e., if the string contains
non-identifier characters or would be case-folded).
Embedded quotes are properly doubled.
See also .
+
+ quote_ident('Foo bar')
+ "Foo bar"
- quote_ident('Foo bar')
- "Foo bar"
-
+ quote_literal
- quote_literal(stringtext)
-
- text
-
- Return the given string suitably quoted to be used as a string literal
+ quote_literal ( text )
+ text
+
+ Returns the given string suitably quoted to be used as a string literal
in an SQL statement string.
Embedded single-quotes and backslashes are properly doubled.
Note that quote_literal returns null on null
input; if the argument might be null,
quote_nullable is often more suitable.
See also .
+
+ quote_literal(E'O\'Reilly')
+ 'O''Reilly'
- quote_literal(E'O\'Reilly')
- 'O''Reilly'
- quote_literal(valueanyelement)
- text
-
- Coerce the given value to text and then quote it as a literal.
+
+ quote_literal ( anyelement )
+ text
+
+ Converts the given value to text and then quotes it as a literal.
Embedded single-quotes and backslashes are properly doubled.
+
+ quote_literal(42.5)
+ '42.5'
- quote_literal(42.5)
- '42.5'
-
+ quote_nullable
- quote_nullable(stringtext)
-
- text
-
- Return the given string suitably quoted to be used as a string literal
+ quote_nullable ( text )
+ text
+
+ Returns the given string suitably quoted to be used as a string literal
in an SQL statement string; or, if the argument
- is null, return NULL.
+ is null, returns NULL.
Embedded single-quotes and backslashes are properly doubled.
See also .
+
+ quote_nullable(NULL)
+ NULL
- quote_nullable(NULL)
- NULL
- quote_nullable(valueanyelement)
- text
-
- Coerce the given value to text and then quote it as a literal;
- or, if the argument is null, return NULL.
+
+ quote_nullable ( anyelement )
+ text
+
+ Converts the given value to text and then quotes it as a literal;
+ or, if the argument is null, returns NULL.
Embedded single-quotes and backslashes are properly doubled.
+
+ quote_nullable(42.5)
+ '42.5'
- quote_nullable(42.5)
- '42.5'
-
+ regexp_match
- regexp_match(stringtext, patterntext [, flagstext])
+ regexp_match ( stringtext, patterntext [, flagstext ] )
+ text[]
+
+ Returns captured substring(s) resulting from the first match of a POSIX
+ regular expression to the string; see
+ .
+
+ regexp_match('foobarbequebaz', '(bar)(beque)')
+ {bar,beque}
- text[]
-
- Return captured substring(s) resulting from the first match of a POSIX
- regular expression to the string (see
- for more information)
-
- regexp_match('foobarbequebaz', '(bar)(beque)')
- {bar,beque}
-
+ regexp_matches
- regexp_matches(stringtext, patterntext [, flagstext])
+ regexp_matches ( stringtext, patterntext [, flagstext ] )
+ setof text[]
+
+ Returns captured substring(s) resulting from matching a POSIX regular
+ expression to the string; see
+ .
+
+ regexp_matches('foobarbequebaz', 'ba.', 'g')
+ {bar}{baz}(2 rows in result)
- setof text[]
-
- Return captured substring(s) resulting from matching a POSIX regular
- expression to the string (see
- for more information)
-
- regexp_matches('foobarbequebaz', 'ba.', 'g')
- {bar}{baz} (2 rows)
-
+ regexp_replace
- regexp_replace(stringtext, patterntext, replacementtext [, flagstext])
+ regexp_replace ( stringtext, patterntext, replacementtext [, flagstext ] )
+ text
+
+ Replaces substring(s) matching a POSIX regular expression; see
+ .
+
+ regexp_replace('Thomas', '.[mN]a.', 'M')
+ ThM
- text
-
- Replace substring(s) matching a POSIX regular expression (see
- for more information)
-
- regexp_replace('Thomas', '.[mN]a.', 'M')
- ThM
-
+ regexp_split_to_array
- regexp_split_to_array(stringtext, patterntext [, flagstext ])
+ regexp_split_to_array ( stringtext, patterntext [, flagstext ] )
+ text[]
+
+ Splits string using a POSIX regular
+ expression as the delimiter; see
+ .
+
+ regexp_split_to_array('hello world', '\s+')
+ {hello,world}
- text[]
-
- Split string using a POSIX regular expression as
- the delimiter (see for more
- information)
-
- regexp_split_to_array('hello world', '\s+')
- {hello,world}
-
+ regexp_split_to_table
- regexp_split_to_table(stringtext, patterntext [, flagstext])
+ regexp_split_to_table ( stringtext, patterntext [, flagstext ] )
+ setof text
+
+ Splits string using a POSIX regular
+ expression as the delimiter; see
+ .
+
+ regexp_split_to_table('hello world', '\s+')
+ helloworld(2 rows in result)
- setof text
-
- Split string using a POSIX regular expression as
- the delimiter (see for more
- information)
-
- regexp_split_to_table('hello world', '\s+')
- helloworld (2 rows)
-
+ repeat
- repeat(stringtext, numberint)
+ repeat ( stringtext, numberinteger )
+ text
+
+ Repeats string the specified
+ number of times.
+
+ repeat('Pg', 4)
+ PgPgPgPg
- text
- Repeat string the specified
- number of times
- repeat('Pg', 4)
- PgPgPgPg
-
+ replace
- replace(stringtext,
+ replace ( stringtext,
fromtext,
- totext)
+ totext )
+ text
+
+ Replaces all occurrences in string of
+ substring from with
+ substring to.
+
+ replace('abcdefabcdef', 'cd', 'XX')
+ abXXefabXXef
- text
- Replace all occurrences in string of substring
- from with substring to
-
- replace('abcdefabcdef', 'cd', 'XX')
- abXXefabXXef
-
+ reverse
- reverse(str)
+ reverse ( text )
+ text
+
+ Reverses the order of the characters in the string.
+
+ reverse('abcde')
+ edcba
- text
-
- Reverse the order of the characters in string
-
- reverse('abcde')
- edcba
-
+ right
- right(stringtext,
- nint)
+ right ( stringtext,
+ ninteger )
+ )
+ text
+
+ Returns last n characters in the string,
+ or when n is negative, returns all but
+ first |n| characters.
+
+ right('abcde', 2)
+ de
- text
-
- Return last n characters in the string,
- or when n is negative, return all but
- first |n| characters
-
- right('abcde', 2)
- de
-
+ rpad
- rpad(stringtext,
- lengthint
- , filltext)
-
- text
-
- Extend the string to length
+ rpad ( stringtext,
+ lengthinteger
+ , filltext )
+ )
+ text
+
+ Extends the string to length
length by appending the characters
fill (a space by default). If the
string is already longer than
length then it is truncated.
+
+ rpad('hi', 5, 'xy')
+ hixyx
- rpad('hi', 5, 'xy')
- hixyx
-
+ rtrim
- rtrim(stringtext
- , characterstext)
-
- text
-
- Remove the longest string containing only characters from
+ rtrim ( stringtext
+ , characterstext )
+ text
+
+ Removes the longest string containing only characters in
characters (a space by default) from the end of
- string
+ string.
+
+ rtrim('testxxzx', 'xyz')
+ test
- rtrim('testxxzx', 'xyz')
- test
-
+ split_part
- split_part(stringtext,
+ split_part ( stringtext,
delimitertext,
- fieldint)
+ ninteger )
+ text
+
+ Splits string at occurrences
+ of delimiter and returns
+ the n'th field (counting from one).
+
+ split_part('abc~@~def~@~ghi', '~@~', 2)
+ def
- text
- Split string on delimiter
- and return the given field (counting from one)
-
- split_part('abc~@~def~@~ghi', '~@~', 2)
- def
-
+ strpos
- strpos(string, substring)
+ strpos ( stringtext, substringtext )
+ integer
+
+ Returns location of specified substring
+ within string, or zero if it's not present.
+ (Same as position(substring in
+ string), but note the reversed
+ argument order.)
+
+ strpos('high', 'ig')
+ 2
- int
-
- Location of specified substring (same as
- position(substring in
- string), but note the reversed
- argument order)
-
- strpos('high', 'ig')
- 2
-
+ substr
- substr(string, from, count)
+ substr ( stringtext, startinteger, countinteger )
+ )
+ text
+
+ Extracts substring starting at index start,
+ and extending for count characters if that is
+ specified. (Same
+ as substring(string
+ from start
+ for count).)
+
+ substr('alphabet', 3)
+ phabet
+
+ substr('alphabet', 3, 2)
+ ph
- text
-
- Extract substring (same as
- substring(string from from for count))
-
- substr('alphabet', 3, 2)
- ph
-
+ starts_with
- starts_with(string, prefix)
+ starts_with ( stringtext, prefixtext )
+ boolean
+
+ Returns true if string starts
+ with prefix.
+
+ starts_with('alphabet', 'alph')
+ t
- bool
-
- Return true if string starts
- with prefix
-
- starts_with('alphabet', 'alph')
- t
-
+ to_ascii
- to_ascii(stringtext
- , encodingtext)
+ to_ascii ( stringtext
+ , encodingname or integer )
+ text
+
+ Converts string to ASCII
+ from another encoding, which may be identified by name or number;
+ if encoding is omitted the database encoding
+ is assumed. The conversion consists primarily of dropping accents.
+ Conversion is only supported
+ from LATIN1, LATIN2,
+ LATIN9, and WIN1250 encodings.
+
+ to_ascii('Karél')
+ Karel
- text
-
- Convert string to ASCII from another encoding
- (only supports conversion from LATIN1, LATIN2, LATIN9,
- and WIN1250 encodings)
-
- to_ascii('Karel')
- Karel
-
+ to_hex
- to_hex(numberint
- or bigint)
+ to_hex ( number
+ integer
+ or bigint )
+ text
+
+ Converts number to its equivalent hexadecimal
+ representation.
+
+ to_hex(2147483647)
+ 7fffffff
- text
- Convert number to its equivalent hexadecimal
- representation
-
- to_hex(2147483647)
- 7fffffff
-
+ translate
- translate(stringtext,
+ translate ( stringtext,
fromtext,
- totext)
-
- text
-
- Any character in string that matches a
- character in the from set is replaced by
- the corresponding character in the to
+ totext )
+ text
+
+ Replaces each character in string that
+ matches a character in the from set with the
+ corresponding character in the to
set. If from is longer than
to, occurrences of the extra characters in
- from are removed.
+ from are deleted.
+
+ translate('12345', '143', 'ax')
+ a2x5
- translate('12345', '143', 'ax')
- a2x5
@@ -6743,257 +6768,224 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
Date/Time Operators
-
-
-
-
-
-
-
-
-
+
- Operator
- Signature
-
-
- Description
-
-
- Example
- Example Result
+
+ OperatorDescriptionExample(s)
+
- +
- date+integer
- date
-
-
- Add a number of days to a date
-
-
- date '2001-09-28' + 7
- 2001-10-05
+
+ date+integer
+ date
+
+ Add a number of days to a date
+
+ date '2001-09-28' + 7
+ 2001-10-05
+
- +
- date+interval
- timestamp
-
-
- Add an interval to a date
-
-
- date '2001-09-28' + interval '1 hour'
- 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+time
- timestamp
-
-
- Add a time-of-day to a date
-
-
- date '2001-09-28' + time '03:00'
- 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+interval
- interval
-
-
- Add intervals
-
-
- interval '1 day' + interval '1 hour'
- 1 day 01:00:00
+
+ interval+interval
+ interval
+
+ Add intervals
+
+ interval '1 day' + interval '1 hour'
+ 1 day 01: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
+
+ 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+interval
- time
-
-
- Add an interval to a time
-
-
- time '01:00' + interval '3 hours'
- 04:00:00
+
+ time+interval
+ time
+
+ Add an interval to a time
+
+ time '01:00' + interval '3 hours'
+ 04:00:00
+
- -
- -interval
- interval
-
-
- Negate an interval
-
-
- - interval '23 hours'
- -23:00:00
+
+ -interval
+ interval
+
+ Negate an interval
+
+ - interval '23 hours'
+ -23:00:00
+
- -
- date-date
- integer
-
-
- Subtract dates
-
-
- date '2001-10-01' - date '2001-09-28'
- 3
+
+ date-date
+ integer
+
+ Subtract dates, producing the number of days elapsed
+
+ date '2001-10-01' - date '2001-09-28'
+ 3
+
- -
- date-integer
- date
-
-
- Subtract a number of days from a date
-
-
- date '2001-10-01' - 7
- 2001-09-24
+
+ date-integer
+ date
+
+ Subtract a number of days from a date
+
+ date '2001-10-01' - 7
+ 2001-09-24
+
- -
- date-interval
- timestamp
-
-
- Subtract an interval from a date
-
-
- date '2001-09-28' - interval '1 hour'
- 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-time
- interval
-
-
- Subtract times
-
-
- time '05:00' - time '03:00'
- 02:00:00
+
+ time-time
+ interval
+
+ Subtract times
+
+ time '05:00' - time '03:00'
+ 02:00:00
+
- -
- time-interval
- time
-
-
- Subtract an interval from a time
-
-
- time '05:00' - interval '2 hours'
- 03:00:00
+
+ time-interval
+ time
+
+ Subtract an interval from a time
+
+ time '05:00' - interval '2 hours'
+ 03: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
+
+ 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-interval
- interval
-
-
- Subtract intervals
-
-
- interval '1 day' - interval '1 hour'
- 1 day -01:00:00
+
+ interval-interval
+ interval
+
+ Subtract intervals
+
+ interval '1 day' - interval '1 hour'
+ 1 day -01:00:00
+
- -
- timestamp-timestamp
- interval
-
-
- Subtract timestamps
-
-
- timestamp '2001-09-29 03:00' - timestamp '2001-09-27 12:00'
- 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
+
- *
- 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
+
+ interval*double precision
+ interval
+
+ Multiply an interval by a scalar
+
+ interval '1 second' * 900
+ 00:15:00
+
+ interval '1 day' * 21
+ 21 days
+
+ interval '1 hour' * 3.5
+ 03:30:00
+
- /
- interval/double precision
- interval
-
-
- Divide an interval by a scalar
-
-
- interval '1 hour' / 1.5
- 00:40:00
+
+ interval/double precision
+ interval
+
+ Divide an interval by a scalar
+
+ interval '1 hour' / 1.5
+ 00:40:00
+
@@ -7001,677 +6993,552 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
Date/Time Functions
-
-
-
-
-
-
-
-
-
+
- Function
- Signature
-
-
- Description
-
-
- Example
- Example Result
+
+ FunctionDescriptionExample(s)
+
-
+ age
- age
+ 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, 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
- age(timestamp)
- interval
-
-
- Subtract from current_date (at midnight)
-
-
- age(timestamp '1957-06-13')
- variable
+
+ age ( timestamp )
+ interval
+
+ Subtract argument from current_date (at midnight)
+
+ age(timestamp '1957-06-13')
+ 62 years 6 mons 10 days
+
-
+ 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()
+ 2019-12-23 14:39:53.662522-05
-
- clock_timestamp()
- variable
-
-
+ current_datecurrent_date
+ date
+
+ Current date; see
+
+ current_date
+ 2019-12-23
- current_date
- date
-
-
- Current date;
- see
-
-
-
- current_date
- variable
-
+ current_timecurrent_time
+ time with time zone
+
+ Current time of day; see
+
+ current_time
+ 14:39:53.662522-05
- 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;
+
+ current_time ( integer )
+ time with time zone
+
+ Current time of day, with limited precision;
see
+
+ current_time(2)
+ 14:39:53.66-05
-
- current_time(2)
- variable
-
-
+ current_timestampcurrent_timestamp
-
- current_timestamp
- timestamp with time zone
-
-
- Current date and time (start of current transaction);
+ timestamp with time zone
+
+ Current date and time (start of current transaction);
see
+
+ current_timestamp
+ 2019-12-23 14:39:53.662522-05
-
- current_timestamp
- variable
-
- current_timestamp
- current_timestamp(integer)
- timestamp with time zone
-
-
- Current date and time (start of current transaction), with limited precision;
+
+ current_timestamp ( integer )
+ timestamp with time zone
+
+ Current date and time (start of current transaction), with limited precision;
see
+
+ current_timestamp(0)
+ 2019-12-23 14:39:53-05
-
- current_timestamp(0)
- variable
-
-
+ date_part
- date_part
-
- date_part(text, timestamp)
- double precision
-
-
- Get timestamp 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
- date_part(text, interval)
- double precision
-
-
- Get interval subfield (equivalent to
- extract); see
+
+ 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
+ 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(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
- date_trunc(text, timestamp with time zone, text)
- timestamp with time zone
-
-
- Truncate to specified precision in the specified time zone; see
+
+ 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
- date_trunc(text, interval)
- interval
-
-
- Truncate to specified precision; see
+
+ 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
+ extract ( fieldfromtimestamp )
+ double precision
+
+ Get timestamp subfield; see
+
+ extract(hour from timestamp '2001-02-16 20:38:40')
+ 20
- extract(fieldfromtimestamp)
- double precision
-
-
- Get timestamp subfield; see
-
-
-
- extract(hour from timestamp '2001-02-16 20:38:40')
- 20
- extract
- extract(fieldfrominterval)
- double precision
-
-
- Get interval subfield; see
+
+ extract ( fieldfrominterval )
+ 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
+ isfinite ( date )
+ 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
- isfinite(timestamp)
- boolean
-
-
- Test for finite timestamp (not +/-infinity)
-
-
- isfinite(timestamp 'infinity')
- false
+
+ isfinite ( timestamp )
+ boolean
+
+ Test for finite timestamp (not +/-infinity)
+
+ isfinite(timestamp 'infinity')
+ false
+
- isfinite
- isfinite(interval)
- boolean
-
-
- Test for finite interval (currently always true)
-
-
- isfinite(interval '4 hours')
- true
+
+ isfinite ( interval )
+ boolean
+
+ Test for finite interval (currently always true)
+
+ isfinite(interval '4 hours')
+ true
+
-
+ justify_days
- justify_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_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
+ justify_hours ( interval )
+ 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
+ justify_interval ( 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
-
+ localtimelocaltime
-
- localtime
- time
-
-
- Current time of day;
+ time
+
+ Current time of day;
see
+
+ localtime
+ 14:39:53.662522
-
- localtime
- variable
-
- localtime
- localtime(integer)
- time
-
-
- Current time of day, with limited precision;
+
+ localtime ( integer )
+ time
+
+ Current time of day, with limited precision;
see
+
+ localtime(0)
+ 14:39:53
-
- localtime(0)
- variable
-
-
+ localtimestamplocaltimestamp
-
- localtimestamp
- timestamp
-
-
- Current date and time (start of current transaction);
+ timestamp
+
+ Current date and time (start of current transaction);
see
+
+ localtimestamp
+ 2019-12-23 14:39:53.662522
-
- localtimestamp
- variable
-
- localtimestamp
- localtimestamp(integer)
- timestamp
-
-
- Current date and time (start of current
+
+ localtimestamp ( integer )
+ timestamp
+
+ Current date and time (start of current
transaction), with limited precision;
see
+
+ localtimestamp(2)
+ 2019-12-23 14:39:53.66
-
- localtimestamp(2)
- variable
-
-
+ make_date
- make_date
-
- make_date(yearint,
+ make_date ( yearint,
monthint,
- dayint)
- date
-
-
-
+ dayint )
+ 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
-
- make_interval(yearint
+ make_interval ( yearint, monthint, weekint, dayint, hourint, minint, secdouble precision
- )
- interval
-
-
-
+ )
+ interval
+
Create interval from years, months, weeks, days, hours, minutes and
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
-
- make_time(hourint,
+ make_time ( hourint,
minint,
- secdouble precision)
- time
-
-
-
+ secdouble 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
-
- make_timestamp(yearint,
+ make_timestamp ( yearint,
monthint,
dayint,
hourint,
minint,
- secdouble precision)
- timestamp
-
-
-
+ secdouble 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
-
- make_timestamptz(yearint,
+ make_timestamptz ( yearint,
monthint,
dayint,
hourint,
minint,
secdouble precision
- , timezonetext)
- timestamp with time zone
-
-
-
+ , timezonetext )
+ 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()
+ 2019-12-23 14:39:53.662522-05
-
- 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()
+ 2019-12-23 14:39:53.662522-05
-
- 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()
+ Mon Dec 23 14:39:53.662522 2019 EST
-
- timeofday()
- variable
-
-
+ transaction_timestamp
- transaction_timestamp
-
- transaction_timestamp()
- timestamp with time zone
-
-
- Current date and time (start of current transaction);
+ transaction_timestamp ( )
+ timestamp with time zone
+
+ Current date and time (start of current transaction);
see
+
+ transaction_timestamp()
+ 2019-12-23 14:39:53.662522-05
+
- transaction_&zwsp;timestamp()
- variable
-
-
-
+ to_timestamp
- to_timestamp
+ to_timestamp ( double precision )
+ timestamp with time zone
+
+ Convert Unix epoch (seconds since 1970-01-01 00:00:00+00) to
+ timestamp with time zone
+
+ to_timestamp(1284352323)
+ 2010-09-13 04:32:03+00
- to_timestamp(double precision)
- timestamp with time zone
-
-
- Convert Unix epoch (seconds since 1970-01-01 00:00:00+00) to
- timestamp
-
-
- to_timestamp(&zwsp;1284352323)
- 2010-09-13 04:32:03+00
@@ -8468,16 +8335,16 @@ SELECT CURRENT_TIME;
Result: 14:39:53.662522-05
SELECT CURRENT_DATE;
-Result: 2001-12-23
+Result: 2019-12-23
SELECT CURRENT_TIMESTAMP;
-Result: 2001-12-23 14:39:53.662522-05
+Result: 2019-12-23 14:39:53.662522-05
SELECT CURRENT_TIMESTAMP(2);
-Result: 2001-12-23 14:39:53.66-05
+Result: 2019-12-23 14:39:53.66-05
SELECT LOCALTIMESTAMP;
-Result: 2001-12-23 14:39:53.662522
+Result: 2019-12-23 14:39:53.662522
@@ -8645,103 +8512,80 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
Enum Support Functions
-
-
-
-
-
-
-
-
-
+
- Function
- Signature
-
-
- Description
-
-
- Example
- Example Result
+
+ FunctionDescriptionExample(s)
+
+
-
+ enum_first
- enum_first
+ enum_first ( anyenum )
+ anyenum
+
+ Returns the first value of the input enum type.
+
+ enum_first(null::rainbow)
+ red
- enum_first(anyenum) anyenum
- Returns the first value of the input enum type
-
-
- enum_first(&zwsp;null::rainbow)
- red
-
-
-
+ enum_last
- enum_last
+ enum_last ( anyenum )
+ anyenum
+
+ Returns the last value of the input enum type.
+
+ enum_last(null::rainbow)
+ purple
- 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(null::rainbow)
+ {red,orange,yellow,&zwsp;green,blue,purple}
- 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
-
-
-
+
+ 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
the enum type.
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,&zwsp;yellow,green}
+
+ enum_range('orange'::rainbow, NULL)
+ {orange,yellow,green,&zwsp;blue,purple}
-
- enum_range(&zwsp;'orange'::rainbow, 'green'::rainbow)
- {orange,yellow,green}
-
-
- enum_range(NULL, 'green'::rainbow)
- {red,orange,yellow,&zwsp;green}
-
-
- enum_range(&zwsp;'orange'::rainbow, NULL)
- {orange,yellow,green,&zwsp;blue,purple}
-
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index a13565e6018..105ed1ce265 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -103,4 +103,11 @@
+
+
+
+
+
+
+
diff --git a/doc/src/sgml/stylesheet-fo.xsl b/doc/src/sgml/stylesheet-fo.xsl
index 2aaae82092f..6fce0be8b75 100644
--- a/doc/src/sgml/stylesheet-fo.xsl
+++ b/doc/src/sgml/stylesheet-fo.xsl
@@ -63,6 +63,32 @@
+
+
+
+
+
+ bold
+
+
+
+ bold
+
+
+
+
+
+
+ 5em
+ -5em
+ left
+
+
+
+
@@ -70,6 +96,11 @@
+
+
+
+
+
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index 1a66c789d50..795188153f5 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -76,6 +76,20 @@ div.example {
margin: 0.5ex;
}
+/* formatting for entries in tables of functions: indent all but first line */
+
+th.functableentry {
+ padding-left: 5em;
+ text-indent: -5em;
+ text-align: left;
+}
+
+td.functableentry {
+ padding-left: 5em;
+ text-indent: -5em;
+ text-align: left;
+}
+
/* Put these here instead of inside the HTML (see unsetting of
admon.style in XSL) so that the web site stylesheet can set its own
style. */