diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 7a270eb..1924e06 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -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(string text - , characters text) - - text - - Remove the longest string consisting only of characters + btrim ( string text + , characters text ) + 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) - - 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 ( 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. The NULL (0) + character is not allowed because text data types cannot store such + bytes. + + chr(65) + A - chr(65) - A - + concat - concat(str "any" - [, str "any" [, ...] ]) - - text - - Concatenate the text representations of all the arguments. + concat ( val "any" + [, val "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(sep text, - str "any" - [, str "any" [, ...] ]) - - text - - Concatenate all but the first argument with separators. The first + concat_ws ( sep text, + val "any" + [, val "any" [, ...] ] ) + text + + Concatenates 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 - concat_ws(',', 'abcde', 2, NULL, 22) - abcde,2,22 - + format - format(formatstr text - [, formatarg "any" [, ...] ]) - - text - - Format arguments according to a format string. + format ( formatstr text + [, 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(string text, - n int) + left ( string text, + n integer ) + 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) - - int - - Number of characters in string + length ( text ) + integer + + Returns the number of characters in the string. + + length('jose') + 4 - length('jose') - 4 - + lpad - lpad(string text, - length int - , fill text) - - text - - Extend the string to length + lpad ( string text, + length integer + , fill text ) + 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(string text - , characters text) - - text - - Remove the longest string containing only characters from + ltrim ( string text + , characters text ) + text + + Removes the longest string containing only characters from characters (a space by default) from the start of - string + string. + + ltrim('zzzytest', 'xyz') + test - ltrim('zzzytest', 'xyz') - test - + md5 - md5(string) - - text - - MD5 hash, with - the result written in hexadecimal + md5 ( text ) + text + + Computes MD5 hash, with + the result written in hexadecimal. + + md5('abc') + 900150983cd24fb0&zwsp;d6963f7d28e17f72 - md5('abc') - 900150983cd24fb0 d6963f7d28e17f72 - + parse_ident - parse_ident(qualified_identifier text - [, strictmode boolean DEFAULT true ] ) - - text[] - - Split qualified_identifier into an array of + parse_ident ( qualified_identifier text + [, strictmode boolean DEFAULT true ] ) + 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,441 @@ 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() - - name - - Current client encoding name + pg_client_encoding ( ) + name + + Returns current client encoding name. + + pg_client_encoding() + SQL_ASCII - pg_client_encoding() - SQL_ASCII - + quote_ident - quote_ident(string text) - - 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(string text) - - 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(value anyelement) - text - - Coerce the given value to text and then quote it as a literal. + + quote_literal ( anyelement ) + text + + Coerces 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(string text) - - 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(value anyelement) - 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 + + Coerces 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(string text, pattern text [, flags text]) - - text[] - - Return captured substring(s) resulting from the first match of a POSIX - regular expression to the string (see - for more information) + regexp_match ( string text, pattern text [, flags text ] ) + 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} - regexp_match('foobarbequebaz', '(bar)(beque)') - {bar,beque} - + regexp_matches - regexp_matches(string text, pattern text [, flags text]) - - setof text[] - - Return captured substring(s) resulting from matching a POSIX regular - expression to the string (see - for more information) + regexp_matches ( string text, pattern text [, flags text ] ) + 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) - regexp_matches('foobarbequebaz', 'ba.', 'g') - {bar}{baz} (2 rows) - + regexp_replace - regexp_replace(string text, pattern text, replacement text [, flags text]) + regexp_replace ( string text, pattern text, replacement text [, flags text ] ) + 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(string text, pattern text [, flags text ]) - - text[] - - Split string using a POSIX regular expression as - the delimiter (see for more - information) + regexp_split_to_array ( string text, pattern text [, flags text ] ) + text[] + + Splits string using a POSIX regular + expression as the delimiter; see + . + + regexp_split_to_array('hello world', '\s+') + {hello,world} - regexp_split_to_array('hello world', '\s+') - {hello,world} - + regexp_split_to_table - regexp_split_to_table(string text, pattern text [, flags text]) - - setof text - - Split string using a POSIX regular expression as - the delimiter (see for more - information) + regexp_split_to_table ( string text, pattern text [, flags text ] ) + setof text + + Splits string using a POSIX regular + expression as the delimiter; see + . + + regexp_split_to_table('hello world', '\s+') + helloworld(2 rows) - regexp_split_to_table('hello world', '\s+') - helloworld (2 rows) - + repeat - repeat(string text, number int) + repeat ( string text, number integer ) + 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(string text, + replace ( string text, from text, - to text) - - text - Replace all occurrences in string of substring - from with substring to + to text ) + text + + Replaces all occurrences in string of + substring from with + substring to. + + replace('abcdefabcdef', 'cd', 'XX') + abXXefabXXef - 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(string text, - n int) + right ( string text, + n integer ) + ) + 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(string text, - length int - , fill text) - - text - - Extend the string to length + rpad ( string text, + length integer + , fill text ) + ) + 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(string text - , characters text) - - text - - Remove the longest string containing only characters from + rtrim ( string text + , characters text ) + text + + Removes the longest string containing only characters from characters (a space by default) from the end of - string + string. + + rtrim('testxxzx', 'xyz') + test - rtrim('testxxzx', 'xyz') - test - + split_part - split_part(string text, + split_part ( string text, delimiter text, - field int) + n integer ) + text + + Splits string on 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) - - int - - Location of specified substring (same as - position(substring in - string), but note the reversed - argument order) + strpos ( string text, substring text ) + 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 - strpos('high', 'ig') - 2 - + substr - substr(string, from , count) + substr ( string text, start integer , count integer ) + ) + 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, 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 ( string text, prefix text ) + 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(string text - , encoding text) + to_ascii ( string text + , encoding name 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(number int - 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(string text, + translate ( string text, from text, - to text) - - text - - Any character in string that matches a - character in the from set is replaced by - the corresponding character in the to + to text ) + 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 +6764,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 + + 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 + @@ -8645,103 +8633,79 @@ 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 a13565e..105ed1c 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 2aaae82..cf6a420 100644 --- a/doc/src/sgml/stylesheet-fo.xsl +++ b/doc/src/sgml/stylesheet-fo.xsl @@ -63,6 +63,31 @@ + + + + + + bold + + + + bold + + + + + + 5em + -5em + left + + + + @@ -70,6 +95,11 @@ + + + + + diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css index 1a66c78..7951881 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. */