diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 692f78aa519..d5c7a14415c 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -325,224 +325,269 @@ repeat('Pg', 4) PgPgPgPg
-
- PredicateDescriptionExample(s)
-
+
+ Predicate
+
+
+ Description
+
+
+ Example(s)
+
-
+ datatypeBETWEENdatatypeANDdatatypeboolean
-
+
+
Between (inclusive of the range endpoints).
-
+
+ 2 BETWEEN 1 AND 3t
-
+
+ 2 BETWEEN 3 AND 1f
-
+
-
+ datatypeNOT BETWEENdatatypeANDdatatypeboolean
-
+
+
Not between (the negation of BETWEEN).
-
+
+ 2 NOT BETWEEN 1 AND 3f
-
+
-
+ datatypeBETWEEN SYMMETRICdatatypeANDdatatypeboolean
-
+
+
Between, after sorting the two endpoint values.
-
+
+ 2 BETWEEN SYMMETRIC 3 AND 1t
-
+
-
+ datatypeNOT BETWEEN SYMMETRICdatatypeANDdatatypeboolean
-
+
+
Not between, after sorting the two endpoint values.
-
+
+ 2 NOT BETWEEN SYMMETRIC 3 AND 1f
-
+
-
+ datatypeIS DISTINCT FROMdatatypeboolean
-
+
+
Not equal, treating null as a comparable value.
-
+
+ 1 IS DISTINCT FROM NULLt (rather than NULL)
-
+
+ NULL IS DISTINCT FROM NULLf (rather than NULL)
-
+
-
+ datatypeIS NOT DISTINCT FROMdatatypeboolean
-
+
+
Equal, treating null as a comparable value.
-
+
+ 1 IS NOT DISTINCT FROM NULLf (rather than NULL)
-
+
+ NULL IS NOT DISTINCT FROM NULLt (rather than NULL)
-
+
-
+ datatypeIS NULLboolean
-
+
+
Test whether value is null.
-
+
+ 1.5 IS NULLf
-
+
-
+ datatypeIS NOT NULLboolean
-
+
+
Test whether value is not null.
-
+
+ 'null' IS NOT NULLt
-
+
-
+ datatypeISNULLboolean
-
+
+
Test whether value is null (nonstandard syntax).
-
+
-
+ datatypeNOTNULLboolean
-
+
+
Test whether value is not null (nonstandard syntax).
-
+
-
+ booleanIS TRUEboolean
-
+
+
Test whether boolean expression yields true.
-
+
+ true IS TRUEt
-
+
+ NULL::boolean IS TRUEf (rather than NULL)
-
+
-
+ booleanIS NOT TRUEboolean
-
+
+
Test whether boolean expression yields false or unknown.
-
+
+ true IS NOT TRUEf
-
+
+ NULL::boolean IS NOT TRUEt (rather than NULL)
-
+
-
+ booleanIS FALSEboolean
-
+
+
Test whether boolean expression yields false.
-
+
+ true IS FALSEf
-
+
+ NULL::boolean IS FALSEf (rather than NULL)
-
+
-
+ booleanIS NOT FALSEboolean
-
+
+
Test whether boolean expression yields true or unknown.
-
+
+ true IS NOT FALSEt
-
+
+ NULL::boolean IS NOT FALSEt (rather than NULL)
-
+
-
+ booleanIS UNKNOWNboolean
-
+
+
Test whether boolean expression yields unknown.
-
+
+ true IS UNKNOWNf
-
+
+ NULL::boolean IS UNKNOWNt (rather than NULL)
-
+
-
+ booleanIS NOT UNKNOWNboolean
-
+
+
Test whether boolean expression yields true or false.
-
+
+ true IS NOT UNKNOWNt
-
+
+ NULL::boolean IS NOT UNKNOWNf (rather than NULL)
-
+
@@ -746,40 +791,50 @@ repeat('Pg', 4) PgPgPgPg
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ num_nonnullsnum_nonnulls ( VARIADIC"any" )
integer
-
+
+
Returns the number of non-null arguments.
-
+
+ num_nonnulls(1, NULL, 2)2
-
+
-
+ num_nullsnum_nulls ( VARIADIC"any" )
integer
-
+
+
Returns the number of null arguments.
-
+
+ num_nulls(1, NULL, 2)1
-
+
@@ -809,9 +864,6 @@ repeat('Pg', 4) PgPgPgPg
Operators shown as accepting integral_type
are available for the types smallint, integer,
and bigint.
- Operators shown as accepting numeric_or_dp
- are available for the types numeric and double
- precision.
Except where noted, each form of an operator returns the same data type
as its argument(s). Calls involving multiple argument data types, such
as integer+numeric,
@@ -824,251 +876,302 @@ repeat('Pg', 4) PgPgPgPg
-
- OperatorDescriptionExample(s)
-
+
+ Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ numeric_type+numeric_typenumeric_type
-
+
+
Addition
-
+
+ 2 + 35
-
+
-
+ +numeric_typenumeric_type
-
+
+
Unary plus (no operation)
-
+
+ + 3.53.5
-
+
-
+ numeric_type-numeric_typenumeric_type
-
+
+
Subtraction
-
+
+ 2 - 3-1
-
+
-
+ -numeric_typenumeric_type
-
+
+
Negation
-
+
+ - (-4)4
-
+
-
+ numeric_type*numeric_typenumeric_type
-
+
+
Multiplication
-
+
+ 2 * 36
-
+
-
+ numeric_type/numeric_typenumeric_type
-
+
+
Division (for integral types, division truncates the result towards
zero)
-
+
+ 5.0 / 22.5000000000000000
-
+
+ 5 / 22
-
+
+ (-5) / 2-2
-
+
-
+ numeric_type%numeric_typenumeric_type
-
+
+
Modulo (remainder); available for smallint,
integer, bigint, and numeric
-
+
+ 5 % 41
-
+
-
- numeric_or_dp^numeric_or_dp
- numeric_or_dp
-
+
+ numeric^numeric
+ numeric
+
+
+ double precision^double precision
+ double precision
+
+
Exponentiation (unlike typical mathematical practice, multiple uses of
^ will associate left to right)
-
+
+ 2 ^ 38
-
+
+ 2 ^ 3 ^ 3512
-
+
-
+ |/double precisiondouble precision
-
+
+
Square root
-
+
+ |/ 25.05
-
+
-
+ ||/double precisiondouble precision
-
+
+
Cube root
-
+
+ ||/ 64.04
-
+
-
+ bigint!numeric
-
+
+
Factorial
-
+
+ 5 !120
-
+
-
+ !!bigintnumeric
-
+
+
Factorial (as a prefix operator)
-
+
+ !! 5120
-
+
-
+ @numeric_typenumeric_type
-
+
+
Absolute value
-
+
+ @ -5.05
-
+
-
+ integral_type&integral_typeintegral_type
-
+
+
Bitwise AND
-
+
+ 91 & 1511
-
+
-
+ integral_type|integral_typeintegral_type
-
+
+
Bitwise OR
-
+
+ 32 | 335
-
+
-
+ integral_type#integral_typeintegral_type
-
+
+
Bitwise exclusive OR
-
+
+ 17 # 520
-
+
-
+ ~integral_typeintegral_type
-
+
+
Bitwise NOT
-
+
+ ~1-2
-
+
-
+ integral_type<<integerintegral_type
-
+
+
Bitwise shift left
-
+
+ 1 << 416
-
+
-
+ integral_type>>integerintegral_type
-
+
+
Bitwise shift right
-
+
+ 8 >> 22
-
+
@@ -1093,444 +1196,561 @@ repeat('Pg', 4) PgPgPgPg
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ absabs ( numeric_type )
numeric_type
-
+
+
Absolute value
-
+
+ abs(-17.4)17.4
-
+
-
+ cbrtcbrt ( double precision )
double precision
-
+
+
Cube root
-
+
+ cbrt(64.0)4
-
+
-
+ ceil
- ceil ( numeric_or_dp )
- numeric_or_dp
-
+ ceil ( numeric )
+ numeric
+
+
+ ceil ( double precision )
+ double precision
+
+
Nearest integer greater than or equal to argument
-
+
+ ceil(42.2)43
-
+
+ ceil(-42.8)-42
-
+
-
+ ceiling
- ceiling ( numeric_or_dp )
- numeric_or_dp
-
+ ceiling ( numeric )
+ numeric
+
+
+ ceiling ( double precision )
+ double precision
+
+
Nearest integer greater than or equal to argument (same
as ceil)
-
+
+ ceiling(95.3)96
-
+
-
+ degreesdegrees ( double precision )
double precision
-
+
+
Converts radians to degrees
-
+
+ degrees(0.5)28.64788975654116
-
+
-
+ divdiv ( ynumeric,
xnumeric )
numeric
-
+
+
Integer quotient of y/x
(truncates towards zero)
-
+
+ div(9,4)2
-
+
-
+ exp
- exp ( numeric_or_dp )
- numeric_or_dp
-
+ exp ( numeric )
+ numeric
+
+
+ exp ( double precision )
+ double precision
+
+
Exponential (e raised to the given power)
-
+
+ exp(1.0)2.7182818284590452
-
+
-
+ floor
- floor ( numeric_or_dp )
- numeric_or_dp
-
+ floor ( numeric )
+ numeric
+
+
+ floor ( double precision )
+ double precision
+
+
Nearest integer less than or equal to argument
-
+
+ floor(42.8)42
-
+
+ floor(-42.8)-43
-
+
-
+ gcdgcd ( numeric_type, numeric_type )
numeric_type
-
+
+
Greatest common divisor (the largest positive number that divides both
inputs with no remainder); returns 0 if both inputs
are zero; available for integer, bigint,
and numeric
-
+
+ gcd(1071, 462)21
-
+
-
+ lcmlcm ( numeric_type, numeric_type )
numeric_type
-
+
+
Least common multiple (the smallest strictly positive number that is
an integral multiple of both inputs); returns 0 if
either input is zero; available for integer,
bigint, and numeric
-
+
+ lcm(1071, 462)23562
-
+
-
+ ln
- ln ( numeric_or_dp )
- numeric_or_dp
-
+ ln ( numeric )
+ numeric
+
+
+ ln ( double precision )
+ double precision
+
+
Natural logarithm
-
+
+ ln(2.0)0.6931471805599453
-
+
-
+ log
- log ( numeric_or_dp )
- numeric_or_dp
-
+ log ( numeric )
+ numeric
+
+
+ log ( double precision )
+ double precision
+
+
Base 10 logarithm
-
+
+ log(100)2
-
+
-
+ log10
- log10 ( numeric_or_dp )
- numeric_or_dp
-
+ log10 ( numeric )
+ numeric
+
+
+ log10 ( double precision )
+ double precision
+
+
Base 10 logarithm (same as log)
-
+
+ log10(1000)3
-
+
-
+ log ( bnumeric,
xnumeric )
numeric
-
+
+
Logarithm of x to base b
-
+
+ log(2.0, 64.0)6.0000000000
-
+
-
+ min_scalemin_scale ( numeric )
integer
-
+
+
Minimum scale (number of fractional decimal digits) needed
to represent the supplied value precisely
-
+
+ min_scale(8.4100)2
-
+
-
+ modmod ( ynumeric_type,
xnumeric_type )
numeric_type
-
+
+
Remainder of y/x;
available for smallint, integer,
bigint, and numeric
-
+
+ mod(9,4)1
-
+
-
+ pipi ( )
double precision
-
+
+
Approximate value of π
-
+
+ pi()3.141592653589793
-
+
-
+ power
- power ( anumeric_or_dp,
- bnumeric_or_dp )
- numeric_or_dp
-
+ power ( anumeric,
+ bnumeric )
+ numeric
+
+
+ power ( adouble precision,
+ bdouble precision )
+ double precision
+
+ a raised to the power of b
-
+
+ power(9, 3)729
-
+
-
+ radiansradians ( double precision )
double precision
-
+
+
Converts degrees to radians
-
+
+ radians(45.0)0.7853981633974483
-
+
-
+ round
- round ( numeric_or_dp )
- numeric_or_dp
-
+ round ( numeric )
+ numeric
+
+
+ round ( double precision )
+ double precision
+
+
Rounds to nearest integer
-
+
+ round(42.4)42
-
+
-
+ round ( vnumeric, sinteger )
numeric
-
+
+
Rounds v to s decimal
places
-
+
+ round(42.4382, 2)42.44
-
+
-
+ scalescale ( numeric )
integer
-
+
+
Scale of the argument (the number of decimal digits in the fractional part)
-
+
+ scale(8.4100)4
-
+
-
+ sign
- sign ( numeric_or_dp )
- numeric_or_dp
-
+ sign ( numeric )
+ numeric
+
+
+ sign ( double precision )
+ double precision
+
+
Sign of the argument (-1, 0, or +1)
-
+
+ sign(-8.4)-1
-
+
-
+ sqrt
- sqrt ( numeric_or_dp )
- numeric_or_dp
-
+ sqrt ( numeric )
+ numeric
+
+
+ sqrt ( double precision )
+ double precision
+
+
Square root
-
+
+ sqrt(2)1.4142135623730951
-
+
-
+ trim_scaletrim_scale ( numeric )
numeric
-
+
+
Reduces the value's scale (number of fractional decimal digits) by
removing trailing zeroes
-
+
+ trim_scale(8.4100)8.41
-
+
-
+ trunc
- trunc ( numeric_or_dp )
- numeric_or_dp
-
+ trunc ( numeric )
+ numeric
+
+
+ trunc ( double precision )
+ double precision
+
+
Truncates to integer (towards zero)
-
+
+ trunc(42.8)42
-
+
+ trunc(-42.8)-42
-
+
-
+ trunc ( vnumeric, sinteger )
numeric
-
+
+
Truncates v to s
decimal places
-
+
+ trunc(42.4382, 2)42.43
-
+
-
+ width_bucket
- width_bucket ( operandnumeric_or_dp, lownumeric_or_dp, highnumeric_or_dp, countinteger )
+ width_bucket ( operandnumeric, lownumeric, highnumeric, countinteger )
integer
-
+
+
+ width_bucket ( operanddouble precision, lowdouble precision, highdouble precision, countinteger )
+ integer
+
+
Returns the number of the bucket in
which operand falls in a histogram
having count equal-width buckets spanning the
@@ -1538,17 +1758,19 @@ repeat('Pg', 4) PgPgPgPg
Returns 0
or count+1 for an input
outside that range.
-
+
+ width_bucket(5.35, 0.024, 10.06, 5)3
-
+
-
+ width_bucket ( operandanyelement, thresholdsanyarray )
integer
-
+
+
Returns the number of the bucket in
which operand falls given an array listing the
lower bounds of the buckets. Returns 0 for an
@@ -1558,10 +1780,11 @@ repeat('Pg', 4) PgPgPgPg
The thresholds array must be
sorted, smallest first, or unexpected results will be
obtained.
-
+
+ width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[])2
-
+
@@ -1578,41 +1801,51 @@ repeat('Pg', 4) PgPgPgPg
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ randomrandom ( )
double precision
-
+
+
Returns a random value in the range 0.0 <= x < 1.0
-
+
+ random()0.897124072839091
-
+
-
+ setseedsetseed ( double precision )
void
-
+
+
Sets the seed for subsequent random() calls;
argument must be between -1.0 and 1.0, inclusive
-
+
+ setseed(0.12345)
-
+
@@ -1642,257 +1875,295 @@ repeat('Pg', 4) PgPgPgPg
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ acosacos ( double precision )
double precision
-
+
+
Inverse cosine, result in radians
-
+
+ acos(1)0
-
+
-
+ acosdacosd ( double precision )
double precision
-
+
+
Inverse cosine, result in degrees
-
+
+ acosd(0.5)60
-
+
-
+ asinasin ( double precision )
double precision
-
+
+
Inverse sine, result in radians
-
+
+ asin(1)1.5707963267948966
-
+
-
+ asindasind ( double precision )
double precision
-
+
+
Inverse sine, result in degrees
-
+
+ asind(0.5)30
-
+
-
+ atanatan ( double precision )
double precision
-
+
+
Inverse tangent, result in radians
-
+
+ atan(1)0.7853981633974483
-
+
-
+ atandatand ( double precision )
double precision
-
+
+
Inverse tangent, result in degrees
-
+
+ atand(1)45
-
+
-
+ atan2atan2 ( ydouble precision,
xdouble precision )
double precision
-
+
+
Inverse tangent of
y/x,
result in radians
-
+
+ atan2(1,0)1.5707963267948966
-
+
-
+ atan2datan2d ( ydouble precision,
xdouble precision )
double precision
-
+
+
Inverse tangent of
y/x,
result in degrees
-
+
+ atan2d(1,0)90
-
+
-
+ coscos ( double precision )
double precision
-
+
+
Cosine, argument in radians
-
+
+ cos(0)1
-
+
-
+ cosdcosd ( double precision )
double precision
-
+
+
Cosine, argument in degrees
-
+
+ cosd(60)0.5
-
+
-
+ cotcot ( double precision )
double precision
-
+
+
Cotangent, argument in radians
-
+
+ cot(0.5)1.830487721712452
-
+
-
+ cotdcotd ( double precision )
double precision
-
+
+
Cotangent, argument in degrees
-
+
+ cotd(45)1
-
+
-
+ sinsin ( double precision )
double precision
-
+
+
Sine, argument in radians
-
+
+ sin(1)0.8414709848078965
-
+
-
+ sindsind ( double precision )
double precision
-
+
+
Sine, argument in degrees
-
+
+ sind(30)0.5
-
+
-
+ tantan ( double precision )
double precision
-
+
+
Tangent, argument in radians
-
+
+ tan(1)1.5574077246549023
-
+
-
+ tandtand ( double precision )
double precision
-
+
+
Tangent, argument in degrees
-
+
+ tand(45)1
-
+
@@ -1920,101 +2191,119 @@ repeat('Pg', 4) PgPgPgPg
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ sinhsinh ( double precision )
double precision
-
+
+
Hyperbolic sine
-
+
+ sinh(1)1.1752011936438014
-
+
-
+ coshcosh ( double precision )
double precision
-
+
+
Hyperbolic cosine
-
+
+ cosh(0)1
-
+
-
+ tanhtanh ( double precision )
double precision
-
+
+
Hyperbolic tangent
-
+
+ tanh(1)0.7615941559557649
-
+
-
+ asinhasinh ( double precision )
double precision
-
+
+
Inverse hyperbolic sine
-
+
+ asinh(1)0.881373587019543
-
+
-
+ acoshacosh ( double precision )
double precision
-
+
+
Inverse hyperbolic cosine
-
+
+ acosh(1)0
-
+
-
+ atanhatanh ( double precision )
double precision
-
+
+
Inverse hyperbolic tangent
-
+
+ atanh(0.5)0.5493061443340548
-
+
@@ -2067,48 +2356,61 @@ repeat('Pg', 4) PgPgPgPg
-
- Function/OperatorDescriptionExample(s)
-
+
+ Function/Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ character stringconcatenationtext||texttext
-
+
+
Concatenates the two strings.
-
+
+ 'Post' || 'greSQL'PostgreSQL
-
+
-
+ text||anynonarray
- or anynonarray||texttext
-
+
+
+ anynonarray||text
+ text
+
+
Converts the non-string input to text, then concatenates the two
strings. (The non-string input cannot be of an array type, because
that would create ambiguity with the array ||
operators. If you want to concatenate an array's text equivalent,
cast it to text explicitly.)
-
+
+ 'Value: ' || 42Value: 42
-
+
-
+ normalized
@@ -2117,7 +2419,8 @@ repeat('Pg', 4) PgPgPgPgtextISNOTformNORMALIZEDboolean
-
+
+
Checks whether the string is in the specified Unicode normalization
form. The optional form key word specifies the
form: NFC (the default), NFD,
@@ -2125,30 +2428,33 @@ repeat('Pg', 4) PgPgPgPg
only be used when the server encoding is UTF8. Note
that checking for normalization using this expression is often faster
than normalizing possibly already normalized strings.
-
+
+ U&'\0061\0308bc' IS NFD NORMALIZEDt
-
+
-
+ bit_lengthbit_length ( text )
integer
-
+
+
Returns number of bits in the string (8
times the octet_length).
-
+
+ bit_length('jose')32
-
+
-
+ char_length
@@ -2162,34 +2468,44 @@ repeat('Pg', 4) PgPgPgPgcharacter string, lengthchar_length ( text )
- or character_length ( text )
integer
-
+
+
+
+ character_length
+
+ character_length ( text )
+ integer
+
+
Returns number of characters in the string.
-
+
+ char_length('josé')4
-
+
-
+ lowerlower ( text )
text
-
+
+
Converts the string to all lower case, according to the rules of the
database's locale.
-
+
+ lower('TOM')tom
-
+
-
+ normalize
@@ -2199,140 +2515,158 @@ repeat('Pg', 4) PgPgPgPgnormalize ( text, form )
text
-
+
+
Converts the string to the specified Unicode
normalization form. The optional form key word
specifies the form: NFC (the default),
NFD, NFKC, or
NFKD. This function can only be used when the
server encoding is UTF8.
-
+
+ normalize(U&'\0061\0308bc', NFC)U&'\00E4bc'
-
+
-
+ octet_lengthoctet_length ( text )
integer
-
+
+
Returns number of bytes in the string.
-
+
+ octet_length('josé')5 (if server encoding is UTF8)
-
+
-
+ octet_lengthoctet_length ( character )
integer
-
+
+
Returns number of bytes in the string. Since this version of the
function accepts type character directly, it will not
strip trailing spaces.
-
+
+ octet_length('abc '::character(4))4
-
+
-
+ overlayoverlay ( stringtextPLACINGnewsubstringtextFROMstartintegerFORcountinteger )
text
-
+
+
Replaces the substring of string that starts at
the start'th character and extends
for count characters
with newsubstring.
If count is omitted, it defaults to the length
of newsubstring.
-
+
+ overlay('Txxxxas' placing 'hom' from 2 for 4)Thomas
-
+
-
+ positionposition ( substringtextINstringtext )
integer
-
+
+
Returns starting index of specified substring
within string, or zero if it's not present.
-
+
+ position('om' in 'Thomas')3
-
+
-
+ substringsubstring ( stringtextFROMstartintegerFORcountinteger )
text
-
+
+
Extracts the substring of string starting at
the start'th character if that is specified,
and stopping after count characters if that is
specified. Provide at least one of start
and count.
-
+
+ substring('Thomas' from 2 for 3)hom
-
+
+ substring('Thomas' from 3)omas
-
+
+ substring('Thomas' for 2)Th
-
+
-
+ substring ( stringtextFROMpatterntext )
text
-
+
+
Extracts substring matching POSIX regular expression; see
.
-
+
+ substring('Thomas' from '...$')mas
-
+
-
+ substring ( stringtextFROMpatterntextFORescapetext )
text
-
+
+
Extracts substring matching SQL regular expression;
see .
-
+
+ substring('Thomas' from '%#"o_a#"_' for '#')oma
-
+
-
+ trim
@@ -2340,45 +2674,51 @@ repeat('Pg', 4) PgPgPgPgcharacterstextFROMstringtext )
text
-
+
+
Removes 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.
-
+
+ trim(both 'xyz' from 'yxTomxx')Tom
-
+
-
+ trim ( LEADING | TRAILING | BOTHFROMstringtext,
characterstext )
text
-
+
+
This is a non-standard syntax for trim().
-
+
+ trim(both from 'yxTomxx', 'xyz')Tom
-
+
-
+ upperupper ( text )
text
-
+
+
Converts the string to all upper case, according to the rules of the
database's locale.
-
+
+ upper('tom')TOM
-
+
@@ -2395,87 +2735,101 @@ repeat('Pg', 4) PgPgPgPg
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ asciiascii ( 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
-
+
-
+ btrimbtrim ( stringtext, characterstext )
text
-
+
+
Removes the longest string containing only characters
in characters (a space by default)
from the start and end of string.
-
+
+ btrim('xyxtrimyyx', 'xyz')trim
-
+
-
+ chrchr ( 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
-
+
-
+ concatconcat ( val1"any"
[, val2"any" [, ...] ] )
text
-
+
+
Concatenates the text representations of all the arguments.
NULL arguments are ignored.
-
+
+ concat('abcde', 2, NULL, 22)abcde222
-
+
-
+ concat_ws
@@ -2483,86 +2837,96 @@ repeat('Pg', 4) PgPgPgPgval1"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
-
+
-
+ formatformat ( formatstrtext
[, formatarg"any" [, ...] ] )
text
-
+
+
Formats arguments according to a format string;
see .
This function is similar to the C function sprintf.
-
+
+ format('Hello %s, %1$s', 'World')Hello World, World
-
+
-
+ initcapinitcap ( 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
-
+
-
+ leftleft ( 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
-
+
-
+ lengthlength ( text )
integer
-
+
+
Returns the number of characters in the string.
-
+
+ length('jose')4
-
+
-
+ lpad
@@ -2570,61 +2934,68 @@ repeat('Pg', 4) PgPgPgPglengthinteger, 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).
-
+
+ lpad('hi', 5, 'xy')xyxhi
-
+
-
+ ltrimltrim ( stringtext, characterstext )
text
-
+
+
Removes the longest string containing only characters in
characters (a space by default) from the start of
string.
-
+
+ ltrim('zzzytest', 'xyz')test
-
+
-
+ md5md5 ( text )
text
-
+
+
Computes the MD5 hash of
the argument, with the result written in hexadecimal.
-
+
+ md5('abc')900150983cd24fb0&zwsp;d6963f7d28e17f72
-
+
-
+ parse_identparse_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
@@ -2633,55 +3004,61 @@ repeat('Pg', 4) PgPgPgPg
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}
-
+
-
+ pg_client_encodingpg_client_encoding ( )
name
-
+
+
Returns current client encoding name.
-
+
+ pg_client_encoding()UTF8
-
+
-
+ quote_identquote_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_literalquote_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.
@@ -2689,160 +3066,189 @@ repeat('Pg', 4) PgPgPgPg
input; if the argument might be null,
quote_nullable is often more suitable.
See also .
-
+
+ quote_literal(E'O\'Reilly')'O''Reilly'
-
+
-
+ 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_nullablequote_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, returns NULL.
Embedded single-quotes and backslashes are properly doubled.
See also .
-
+
+ quote_nullable(NULL)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'
-
+
-
+ regexp_matchregexp_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}
-
+
-
+ regexp_matchesregexp_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)
-
+
+
+ {bar}
+ {baz}
+
+ (2 rows in result)
+
-
+ regexp_replaceregexp_replace ( stringtext, patterntext, replacementtext [, flagstext ] )
text
-
+
+
Replaces substring(s) matching a POSIX regular expression; see
.
-
+
+ regexp_replace('Thomas', '.[mN]a.', 'M')ThM
-
+
-
+ regexp_split_to_arrayregexp_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}
-
+
-
+ regexp_split_to_tableregexp_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)
-
+
+
+ hello
+ world
+
+ (2 rows in result)
+
-
+ repeatrepeat ( stringtext, numberinteger )
text
-
+
+
Repeats string the specified
number of times.
-
+
+ repeat('Pg', 4)PgPgPgPg
-
+
-
+ replace
@@ -2850,33 +3256,37 @@ repeat('Pg', 4) PgPgPgPgfromtext,
totext )
text
-
+
+
Replaces all occurrences in string of
substring from with
substring to.
-
+
+ replace('abcdefabcdef', 'cd', 'XX')abXXefabXXef
-
+
-
+ reversereverse ( text )
text
-
+
+
Reverses the order of the characters in the string.
-
+
+ reverse('abcde')edcba
-
+
-
+ right
@@ -2884,18 +3294,20 @@ repeat('Pg', 4) PgPgPgPgninteger )
)
text
-
+
+
Returns last n characters in the string,
or when n is negative, returns all but
first |n| characters.
-
+
+ right('abcde', 2)de
-
+
-
+ rpad
@@ -2904,38 +3316,42 @@ repeat('Pg', 4) PgPgPgPg, 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
-
+
-
+ rtrimrtrim ( stringtext, characterstext )
text
-
+
+
Removes the longest string containing only characters in
characters (a space by default) from the end of
string.
-
+
+ rtrim('testxxzx', 'xyz')test
-
+
-
+ split_part
@@ -2943,43 +3359,48 @@ repeat('Pg', 4) PgPgPgPgdelimitertext,
ninteger )
text
-
+
+
Splits string at occurrences
of delimiter and returns
the n'th field (counting from one).
-
+
+ split_part('abc~@~def~@~ghi', '~@~', 2)def
-
+
-
+ strposstrpos ( stringtext, substringtext )
integer
-
+
+
Returns starting index 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
-
+
-
+ substrsubstr ( stringtext, startinteger, countinteger )
text
-
+
+
Extracts the substring of string starting at
the start'th character,
and extending for count characters if that is
@@ -2987,73 +3408,94 @@ repeat('Pg', 4) PgPgPgPg
as substring(string
from start
for count).)
-
+
+ substr('alphabet', 3)phabet
-
+
+ substr('alphabet', 3, 2)ph
-
+
-
+ starts_withstarts_with ( stringtext, prefixtext )
boolean
-
+
+
Returns true if string starts
with prefix.
-
+
+ starts_with('alphabet', 'alph')t
-
+
-
+ to_ascii
- to_ascii ( stringtext
- , encodingname or integer )
+ to_ascii ( stringtext )
text
-
+
+
+ to_ascii ( stringtext,
+ encodingname )
+ text
+
+
+ to_ascii ( stringtext,
+ encodinginteger )
+ 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.
+ from another encoding, which may be identified by name or number.
+ If encoding is omitted the database encoding
+ is assumed (which in practice is the only useful case).
+ The conversion consists primarily of dropping accents.
Conversion is only supported
from LATIN1, LATIN2,
LATIN9, and WIN1250 encodings.
-
+ (See the module for another, more flexible
+ solution.)
+
+ to_ascii('Karél')Karel
-
+
-
+ to_hex
- to_hex ( number
- integer
- or bigint )
+ to_hex ( integer )
text
-
- Converts number to its equivalent hexadecimal
- representation.
-
+
+
+ to_hex ( bigint )
+ text
+
+
+ Converts the number to its equivalent hexadecimal representation.
+
+ to_hex(2147483647)7fffffff
-
+
-
+ translate
@@ -3061,17 +3503,19 @@ repeat('Pg', 4) PgPgPgPgfromtext,
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 deleted.
-
+
+ translate('12345', '143', 'ax')a2x5
-
+
@@ -3339,117 +3783,135 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
-
- Function/OperatorDescriptionExample(s)
-
+
+ Function/Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ binary stringconcatenationbytea||byteabytea
-
+
+
Concatenates the two binary strings.
-
+
+ '\x123456'::bytea || '\x789a00bcde'::bytea\x123456789a00bcde
-
+
-
+ bit_lengthbit_length ( bytea )
integer
-
+
+
Returns number of bits in the binary string (8
times the octet_length).
-
+
+ bit_length('\x123456'::bytea)24
-
+
-
+ octet_lengthoctet_length ( bytea )
integer
-
+
+
Returns number of bytes in the binary string.
-
+
+ octet_length('\x123456'::bytea)3
-
+
-
+ overlayoverlay ( bytesbyteaPLACINGnewsubstringbyteaFROMstartintegerFORcountinteger )
bytea
-
+
+
Replaces the substring of bytes that starts at
the start'th byte and extends
for count bytes
with newsubstring.
If count is omitted, it defaults to the length
of newsubstring.
-
+
+ overlay('\x1234567890'::bytea placing '\002\003'::bytea from 2 for 3)\x12020390
-
+
-
+ positionposition ( substringbyteaINbytesbytea )
integer
-
+
+
Returns starting index of specified substring
within bytes, or zero if it's not present.
-
+
+ position('\x5678'::bytea in '\x1234567890'::bytea)3
-
+
-
+ substringsubstring ( bytesbyteaFROMstartintegerFORcountinteger )
bytea
-
+
+
Extracts the substring of bytes starting at
the start'th byte if that is specified,
and stopping after count bytes if that is
specified. Provide at least one of start
and count.
-
+
+ substring('\x1234567890'::bytea from 3 for 2)\x5678
-
+
-
+ trim
@@ -3457,28 +3919,32 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
bytesremovedbyteaFROMbytesbytea )
bytea
-
+
+
Removes the longest string containing only bytes appearing in
bytesremoved from the start
and end of bytes.
-
+
+ trim('\x9012'::bytea from '\x1234567890'::bytea)\x345678
-
+
-
+ trim ( BOTHFROMbytesbytea,
bytesremovedbytea )
bytea
-
+
+
This is a non-standard syntax for trim().
-
+
+ trim(both from '\x1234567890'::bytea, '\x9012'::bytea)\x345678
-
+
@@ -3497,67 +3963,79 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ btrimbtrim ( bytesbytea,
bytesremovedbytea )
bytea
-
+
+
Removes the longest string containing only bytes appearing in
bytesremoved from the start and end of
bytes.
-
+
+ btrim('\x1234567890'::bytea, '\x9012'::bytea)\x345678
-
+
-
+ get_bitget_bit ( bytesbytea,
nbigint )
integer
-
+
+
Extracts n'th bit
from binary string.
-
+
+ get_bit('\x1234567890'::bytea, 30)1
-
+
-
+ get_byteget_byte ( bytesbytea,
ninteger )
integer
-
+
+
Extracts n'th byte
from binary string.
-
+
+ get_byte('\x1234567890'::bytea, 4)144
-
+
-
+ length
@@ -3572,46 +4050,52 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
length ( bytea )
integer
-
+
+
Returns the number of bytes in the binary string.
-
+
+ length('\x1234567890'::bytea)5
-
+
-
+ length ( bytesbytea,
encodingname )
integer
-
+
+
Returns the number of characters in the binary string, assuming
that it is text in the given encoding.
-
+
+ length('jose'::bytea, 'UTF8')4
-
+
-
+ md5md5 ( bytea )
text
-
+
+
Computes the MD5 hash of
the binary string, with the result written in hexadecimal.
-
+
+ md5('Th\000omas'::bytea)8ab2d3c9689aaf18&zwsp;b4958c334c82d8b1
-
+
-
+ set_bit
@@ -3619,17 +4103,19 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
nbigint,
newvalueinteger )
bytea
-
+
+
Sets n'th bit in
binary string to newvalue.
-
+
+ set_bit('\x1234567890'::bytea, 30, 0)\x1234563890
-
+
-
+ set_byte
@@ -3637,87 +4123,98 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
ninteger,
newvalueinteger )
bytea
-
+
+
Sets n'th byte in
binary string to newvalue.
-
+
+ set_byte('\x1234567890'::bytea, 4, 64)\x1234567840
-
+
-
+ sha224sha224 ( bytea )
bytea
-
+
+
Computes the SHA-224 hash
of the binary string.
-
+
+ sha224('abc'::bytea)\x23097d223405d8228642a477bda2&zwsp;55b32aadbce4bda0b3f7e36c9da7
-
+
-
+ sha256sha256 ( bytea )
bytea
-
+
+
Computes the SHA-256 hash
of the binary string.
-
+
+ sha256('abc'::bytea)\xba7816bf8f01cfea414140de5dae2223&zwsp;b00361a396177a9cb410ff61f20015ad
-
+
-
+ sha384sha384 ( bytea )
bytea
-
+
+
Computes the SHA-384 hash
of the binary string.
-
+
+ sha384('abc'::bytea)\xcb00753f45a35e8bb5a03d699ac65007&zwsp;272c32ab0eded1631a8b605a43ff5bed&zwsp;8086072ba1e7cc2358baeca134c825a7
-
+
-
+ sha512sha512 ( bytea )
bytea
-
+
+
Computes the SHA-512 hash
of the binary string.
-
+
+ sha512('abc'::bytea)\xddaf35a193617abacc417349ae204131&zwsp;12e6fa4e89a97ea20a9eeee64b55d39a&zwsp;2192992a274fc1a836ba3c23a3feebbd&zwsp;454d4423643ce80e2a9ac94fa54ca49f
-
+
-
+ substrsubstr ( bytesbytea, startinteger, countinteger )
bytea
-
+
+
Extracts the substring of bytes starting at
the start'th byte,
and extending for count bytes if that is
@@ -3725,10 +4222,11 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
as substring(bytes
from start
for count).)
-
+
+ substr('\x1234567890'::bytea, 3, 2)\x5678
-
+
@@ -3778,15 +4276,21 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ convert
@@ -3794,93 +4298,103 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
src_encodingname,
dest_encodingname )
bytea
-
+
+
Converts a binary string representing text in
encoding src_encoding
to a binary string in encoding dest_encoding
(see for
available conversions).
-
+
+ convert('text_in_utf8', 'UTF8', 'LATIN1')\x746578745f696e5f75746638
-
+
-
+ convert_fromconvert_from ( bytesbytea,
src_encodingname )
text
-
+
+
Converts a binary string representing text in
encoding src_encoding
to text in the database encoding
(see for
available conversions).
-
+
+ convert_from('text_in_utf8', 'UTF8')text_in_utf8
-
+
-
+ convert_toconvert_to ( stringtext,
dest_encodingname )
bytea
-
+
+
Converts a text string (in the database encoding) to a
binary string encoded in encoding dest_encoding
(see for
available conversions).
-
+
+ convert_to('some_text', 'UTF8')\x736f6d655f74657874
-
+
-
+ encodeencode ( bytesbytea,
formattext )
text
-
+
+
Encodes binary data into a textual representation; supported
format values are:
base64,
escape,
hex.
-
+
+ encode('123\000\001', 'base64')MTIzAAE=
-
+
-
+ decodedecode ( stringtext,
formattext )
bytea
-
+
+
Decodes binary data from a textual representation; supported
format values are the same as
for encode.
-
+
+ decode('MTIzAAE=', 'base64')\x3132330001
-
+
@@ -3987,97 +4501,117 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
-
- OperatorDescriptionExample(s)
-
+
+ Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ bit||bitbit
-
+
+
Concatenation
-
+
+ B'10001' || B'011'10001011
-
+
-
+ bit&bitbit
-
+
+
Bitwise AND (inputs must be of equal length)
-
+
+ B'10001' & B'01101'00001
-
+
-
+ bit|bitbit
-
+
+
Bitwise OR (inputs must be of equal length)
-
+
+ B'10001' | B'01101'11101
-
+
-
+ bit#bitbit
-
+
+
Bitwise exclusive OR (inputs must be of equal length)
-
+
+ B'10001' # B'01101'11100
-
+
-
+ ~bitbit
-
+
+
Bitwise NOT
-
+
+ ~ B'10001'01110
-
+
-
+ bit<<integerbit
-
+
+
Bitwise shift left
(string length is preserved)
-
+
+ B'10001' << 301000
-
+
-
+ bit>>integerbit
-
+
+
Bitwise shift right
(string length is preserved)
-
+
+ B'10001' >> 200100
-
+
@@ -4093,30 +4627,38 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ bit_lengthbit_length ( bit )
integer
-
+
+
Returns number of bits in the bit string.
-
+
+ bit_length(B'10111')5
-
+
-
+ length
@@ -4126,103 +4668,115 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
length ( bit )
integer
-
+
+
Returns number of bits in the bit string.
-
+
+ length(B'10111')5
-
+
-
+ octet_lengthoctet_length ( bit )
integer
-
+
+
Returns number of bytes in the bit string.
-
+
+ octet_length(B'1011111011')2
-
+
-
+ overlayoverlay ( bitsbitPLACINGnewsubstringbitFROMstartintegerFORcountinteger )
bit
-
+
+
Replaces the substring of bits that starts at
the start'th bit and extends
for count bits
with newsubstring.
If count is omitted, it defaults to the length
of newsubstring.
-
+
+ overlay(B'01010101010101010' placing B'11111' from 2 for 3)0111110101010101010
-
+
-
+ positionposition ( substringbitINbitsbit )
integer
-
+
+
Returns starting index of specified substring
within bits, or zero if it's not present.
-
+
+ position(B'010' in B'000001101011')8
-
+
-
+ substringsubstring ( bitsbitFROMstartintegerFORcountinteger )
bit
-
+
+
Extracts the substring of bits starting at
the start'th bit if that is specified,
and stopping after count bits if that is
specified. Provide at least one of start
and count.
-
+
+ substring(B'110010111111' from 3 for 2)00
-
+
-
+ get_bitget_bit ( bitsbit,
ninteger )
integer
-
+
+
Extracts n'th bit
from bit string; the first (leftmost) bit is bit 0.
-
+
+ get_bit(B'101010101010101010', 6)1
-
+
-
+ set_bit
@@ -4230,14 +4784,16 @@ SELECT format('Testing %3$s, %2$s, %s', 'one', 'two', 'three');
ninteger,
newvalueinteger )
bit
-
+
+
Sets n'th bit in
bit string to newvalue;
the first (leftmost) bit is bit 0.
-
+
+ set_bit(B'101010101010101010', 6, 0)101010001010101010
-
+
@@ -4673,59 +5229,73 @@ substring('foobar' from '#"o_b#"%' for '#') NULL
-
- OperatorDescriptionExample(s)
-
+
+ Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ text~textboolean
-
+
+
String matches regular expression, case sensitively
-
+
+ 'thomas' ~ '.*thom.*'t
-
+
-
+ text~*textboolean
-
+
+
String matches regular expression, case insensitively
-
+
+ 'thomas' ~* '.*Thom.*'t
-
+
-
+ text!~textboolean
-
+
+
String does not match regular expression, case sensitively
-
+
+ 'thomas' !~ '.*thomas.*'f
-
+
-
+ text!~*textboolean
-
+
+
String does not match regular expression, case insensitively
-
+
+ 'thomas' !~* '.*vadim.*'t
-
+
@@ -6446,105 +7016,129 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ to_char
- to_char ( timestampwith time zone, text )
+ to_char ( timestamp, text )
text
-
+
+
+ to_char ( timestamp with time zone, text )
+ text
+
+
Converts time stamp to string according to the given format.
-
+
+ to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')05:31:12
-
+
-
+ to_char ( interval, text )
text
-
+
+
Converts interval to string according to the given format.
-
+
+ to_char(interval '15h 2m 12s', 'HH24:MI:SS')15:02:12
-
+
-
+ to_char ( numeric_type, text )
text
-
+
+
Converts number to string according to the given format; available
for integer, bigint, numeric,
real, double precision.
-
+
+ to_char(125, '999')125
-
+
+ to_char(125.8::real, '999D9')125.8
-
+
+ to_char(-125.8, '999D99S')125.80-
-
+
-
+ to_dateto_date ( text, text )
date
-
+
+
Converts string to date according to the given format.
-
+
+ to_date('05 Dec 2000', 'DD Mon YYYY')2000-12-05
-
+
-
+ to_numberto_number ( text, text )
numeric
-
+
+
Converts string to numeric according to the given format.
-
+
+ to_number('12,454.8-', '99G999D9S')-12454.8
-
+
-
+ to_timestampto_timestamp ( text, text )
timestamp with time zone
-
+
+
Converts string to time stamp according to the given format.
(See also to_timestamp(double precision) in
.)
-
+
+ to_timestamp('05 Dec 2000', 'DD Mon YYYY')2000-12-05 00:00:00-05
-
+
@@ -7588,221 +8182,263 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
-
- OperatorDescriptionExample(s)
-
+
+ Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ date+integerdate
-
+
+
Add a number of days to a date
-
+
+ date '2001-09-28' + 72001-10-05
-
+
-
+ date+intervaltimestamp
-
+
+
Add an interval to a date
-
+
+ date '2001-09-28' + interval '1 hour'2001-09-28 01:00:00
-
+
-
+ date+timetimestamp
-
+
+
Add a time-of-day to a date
-
+
+ date '2001-09-28' + time '03:00'2001-09-28 03:00:00
-
+
-
+ interval+intervalinterval
-
+
+
Add intervals
-
+
+ interval '1 day' + interval '1 hour'1 day 01:00:00
-
+
-
+ timestamp+intervaltimestamp
-
+
+
Add an interval to a timestamp
-
+
+ timestamp '2001-09-28 01:00' + interval '23 hours'2001-09-29 00:00:00
-
+
-
+ time+intervaltime
-
+
+
Add an interval to a time
-
+
+ time '01:00' + interval '3 hours'04:00:00
-
+
-
+ -intervalinterval
-
+
+
Negate an interval
-
+
+ - interval '23 hours'-23:00:00
-
+
-
+ date-dateinteger
-
+
+
Subtract dates, producing the number of days elapsed
-
+
+ date '2001-10-01' - date '2001-09-28'3
-
+
-
+ date-integerdate
-
+
+
Subtract a number of days from a date
-
+
+ date '2001-10-01' - 72001-09-24
-
+
-
+ date-intervaltimestamp
-
+
+
Subtract an interval from a date
-
+
+ date '2001-09-28' - interval '1 hour'2001-09-27 23:00:00
-
+
-
+ time-timeinterval
-
+
+
Subtract times
-
+
+ time '05:00' - time '03:00'02:00:00
-
+
-
+ time-intervaltime
-
+
+
Subtract an interval from a time
-
+
+ time '05:00' - interval '2 hours'03:00:00
-
+
-
+ timestamp-intervaltimestamp
-
+
+
Subtract an interval from a timestamp
-
+
+ timestamp '2001-09-28 23:00' - interval '23 hours'2001-09-28 00:00:00
-
+
-
+ interval-intervalinterval
-
+
+
Subtract intervals
-
+
+ interval '1 day' - interval '1 hour'1 day -01:00:00
-
+
-
+ timestamp-timestampinterval
-
+
+
Subtract timestamps
-
+
+ timestamp '2001-09-29 03:00' - timestamp '2001-09-27 12:00'1 day 15:00:00
-
+
-
+ interval*double precisioninterval
-
+
+
Multiply an interval by a scalar
-
+
+ interval '1 second' * 90000:15:00
-
+
+ interval '1 day' * 2121 days
-
+
+ interval '1 hour' * 3.503:30:00
-
+
-
+ interval/double precisioninterval
-
+
+
Divide an interval by a scalar
-
+
+ interval '1 hour' / 1.500:40:00
-
+
@@ -7813,373 +8449,429 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ ageage ( 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 )
interval
-
+
+
Subtract argument from current_date (at midnight)
-
+
+ age(timestamp '1957-06-13')62 years 6 mons 10 days
-
+
-
+ clock_timestampclock_timestamp ( )
timestamp with time zone
-
+
+
Current date and time (changes during statement execution);
see
-
+
+ clock_timestamp()2019-12-23 14:39:53.662522-05
-
+
-
+ current_datecurrent_datedate
-
+
+
Current date; see
-
+
+ current_date2019-12-23
-
+
-
+ current_timecurrent_timetime with time zone
-
+
+
Current time of day; see
-
+
+ current_time14:39:53.662522-05
-
+
-
+ current_time ( integer )
time with time zone
-
+
+
Current time of day, with limited precision;
see
-
+
+ current_time(2)14:39:53.66-05
-
+
-
+ current_timestampcurrent_timestamptimestamp with time zone
-
+
+
Current date and time (start of current transaction);
see
-
+
+ current_timestamp2019-12-23 14:39:53.662522-05
-
+
-
+ 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
-
+
-
+ date_partdate_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 ( text, interval )
double precision
-
+
+
Get interval subfield (equivalent to extract);
see
-
+
+ date_part('month', interval '2 years 3 months')3
-
+
-
+ date_truncdate_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 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 ( text, interval )
interval
-
+
+
Truncate to specified precision; see
-
+
+ date_trunc('hour', interval '2 days 3 hours 40 minutes')2 days 03:00:00
-
+
-
+ extractextract ( fieldfromtimestamp )
double precision
-
+
+
Get timestamp subfield; see
-
+
+ extract(hour from timestamp '2001-02-16 20:38:40')20
-
+
-
+ extract ( fieldfrominterval )
double precision
-
+
+
Get interval subfield; see
-
+
+ extract(month from interval '2 years 3 months')3
-
+
-
+ isfiniteisfinite ( date )
boolean
-
+
+
Test for finite date (not +/-infinity)
-
+
+ isfinite(date '2001-02-16')true
-
+
-
+ isfinite ( timestamp )
boolean
-
+
+
Test for finite timestamp (not +/-infinity)
-
+
+ isfinite(timestamp 'infinity')false
-
+
-
+ isfinite ( interval )
boolean
-
+
+
Test for finite interval (currently always true)
-
+
+ isfinite(interval '4 hours')true
-
+
-
+ justify_daysjustify_days ( interval )
interval
-
+
+
Adjust interval so 30-day time periods are represented as months
-
+
+ justify_days(interval '35 days')1 mon 5 days
-
+
-
+ justify_hoursjustify_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_intervaljustify_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
-
+
-
+ localtimelocaltimetime
-
+
+
Current time of day;
see
-
+
+ localtime14:39:53.662522
-
+
-
+ localtime ( integer )
time
-
+
+
Current time of day, with limited precision;
see
-
+
+ localtime(0)14:39:53
-
+
-
+ localtimestamplocaltimestamptimestamp
-
+
+
Current date and time (start of current transaction);
see
-
+
+ localtimestamp2019-12-23 14:39:53.662522
-
+
-
+ localtimestamp ( integer )
timestamp
-
+
+
Current date and time (start of current
transaction), with limited precision;
see
-
+
+ localtimestamp(2)2019-12-23 14:39:53.66
-
+
-
+ make_date
@@ -8187,16 +8879,18 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
monthint,
dayint )
date
-
+
+
Create date from year, month and day fields
-
+
+ make_date(2013, 7, 15)2013-07-15
-
+
-
+ make_intervalmake_interval ( yearint
@@ -8208,17 +8902,19 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
, secdouble precision )
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_time
@@ -8226,16 +8922,18 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
minint,
secdouble precision )
time
-
+
+
Create time from hour, minute and seconds fields
-
+
+ make_time(8, 15, 23.5)08:15:23.5
-
+
-
+ make_timestamp
@@ -8246,16 +8944,18 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
minint,
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_timestamptz
@@ -8267,95 +8967,107 @@ SELECT regexp_match('abc01234xyz', '(?:(.*?)(\d+)(.*)){1,1}');
secdouble precision, 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
-
+
-
+ nownow ( )
timestamp with time zone
-
+
+
Current date and time (start of current transaction);
see
-
+
+ now()2019-12-23 14:39:53.662522-05
-
+
-
+ statement_timestampstatement_timestamp ( )
timestamp with time zone
-
+
+
Current date and time (start of current statement);
see
-
+
+ statement_timestamp()2019-12-23 14:39:53.662522-05
-
+
-
+ timeofdaytimeofday ( )
text
-
+
+
Current date and time
(like clock_timestamp, but as a text string);
see
-
+
+ timeofday()Mon Dec 23 14:39:53.662522 2019 EST
-
+
-
+ transaction_timestamptransaction_timestamp ( )
timestamp with time zone
-
+
+
Current date and time (start of current transaction);
see
-
+
+ transaction_timestamp()2019-12-23 14:39:53.662522-05
-
+
-
+ to_timestampto_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
-
+
@@ -9021,53 +9733,65 @@ SELECT date_trunc('hour', INTERVAL '3 days 02:47:33');
-
- OperatorDescriptionExample(s)
-
+
+ Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ timestamp without time zoneAT TIME ZONEzonetimestamp with time zone
-
+
+
Converts given time stamp without time zone to
time stamp with time zone, assuming the given
value is in the named time zone.
-
+
+ timestamp '2001-02-16 20:38:40' at time zone 'America/Denver'2001-02-17 03:38:40+00
-
+
-
+ timestamp with time zoneAT TIME ZONEzonetimestamp without time zone
-
+
+
Converts given time stamp with time zone to
time stamp without time zone, as the time would
appear in that zone.
-
+
+ timestamp with time zone '2001-02-16 20:38:40-05' at time zone 'America/Denver'2001-02-16 18:38:40
-
+
-
+ time with time zoneAT TIME ZONEzonetime with time zone
-
+
+
Converts given time with time zone to a new time
zone. Since no date is supplied, this uses the currently active UTC
offset for the named destination zone.
-
+
+ time with time zone '05:34:17-05' at time zone 'UTC'10:34:17+00
-
+
@@ -9348,76 +10072,92 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ enum_firstenum_first ( anyenum )
anyenum
-
+
+
Returns the first value of the input enum type.
-
+
+ enum_first(null::rainbow)red
-
+
-
+ enum_lastenum_last ( anyenum )
anyenum
-
+
+
Returns the last value of the input enum type.
-
+
+ enum_last(null::rainbow)purple
-
+
-
+ enum_rangeenum_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, 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}
-
+
@@ -9451,60 +10191,73 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- OperatorDescriptionExample(s)
-
+
+ Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ geometric_type+pointgeometric_type
-
+
+
Adds the coordinates of the second point to those of each
point of the first argument, thus performing translation.
Available for point, box, path,
circle.
-
+
+ box '(1,1),(0,0)' + point '(2,0)'(3,1),(2,0)
-
+
-
+ path+pathpath
-
+
+
Concatenates two open paths (returns NULL if either path is closed).
-
+
+ path '[(0,0),(1,1)]' + path '[(2,2),(3,3),(4,4)]'[(0,0),(1,1),(2,2),(3,3),(4,4)]
-
+
-
+ geometric_type-pointgeometric_type
-
+
+
Subtracts the coordinates of the second point from those
of each point of the first argument, thus performing translation.
Available for point, box, path,
circle.
-
+
+ box '(1,1),(0,0)' - point '(2,0)'(-1,1),(-2,0)
-
+
-
+ geometric_type*pointgeometric_type
-
+
+
Multiplies each point of the first argument by the second
point (treating a point as being a complex number
represented by real and imaginary parts, and performing standard
@@ -9519,20 +10272,23 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
still considered to have sides parallel to the axes. Hence the box's
size is not preserved, as a true rotation would do.path, circle.
-
+
+ path '((0,0),(1,0),(1,1))' * point '(3.0,0)'((0,0),(3,0),(3,3))
-
+
+ path '((0,0),(1,0),(1,1))' * point(cosd(45), sind(45))((0,0),&zwsp;(0.7071067811865475,0.7071067811865475),&zwsp;(0,1.414213562373095))
-
+
-
+ geometric_type/pointgeometric_type
-
+
+
Divides each point of the first argument by the second
point (treating a point as being a complex number
represented by real and imaginary parts, and performing standard
@@ -9544,85 +10300,98 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
Available for point, box,path,
circle.
-
+
+ path '((0,0),(1,0),(1,1))' / point '(2.0,0)'((0,0),(0.5,0),(0.5,0.5))
-
+
+ path '((0,0),(1,0),(1,1))' / point(cosd(45), sind(45))((0,0),&zwsp;(0.7071067811865476,-0.7071067811865476),&zwsp;(1.4142135623730951,0))
-
+
-
+ @-@geometric_typedouble precision
-
+
+
Computes the total length.
Available for lseg, path.
-
+
+ @-@ path '[(0,0),(1,0),(1,1)]'2
-
+
-
+ @@geometric_typepoint
-
+
+
Computes the center point.
Available for box, lseg, path,
polygon, circle.
-
+
+ @@ box '(2,2),(0,0)'(1,1)
-
+
-
+ #geometric_typeinteger
-
+
+
Returns the number of points.
Available for path, polygon.
-
+
+ # path '((1,0),(0,1),(-1,0))'3
-
+
-
+ geometric_type#geometric_typepoint
-
+
+
Computes the point of intersection, or NULL if there is none.
Available for lseg, line.
-
+
+ lseg '[(0,0),(1,1)]' # lseg '[(1,0),(0,1)]'(0.5,0.5)
-
+
-
+ box#boxbox
-
+
+
Computes the intersection of two boxes, or NULL if there is none.
-
+
+ box '(2,2),(-1,-1)' # box '(1,1),(-2,-2)'(1,1),(-1,-1)
-
+
-
+ geometric_type##geometric_typepoint
-
+
+
Computes the closest point to the first object on the second object.
Available for these pairs of types:
(point, box),
@@ -9633,17 +10402,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
(lseg, line),
(line, box),
(line, lseg).
-
+
+ point '(0,0)' ## lseg '[(2,0),(0,2)]'(1,1)
-
+
-
+ geometric_type<->geometric_typedouble precision
-
+
+
Computes the distance between the objects.
Available for all seven geometric types, for all combinations
of point with another geometric type, and for
@@ -9653,17 +10424,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
(lseg, line),
(polygon, circle)
(and the commutator cases).
-
+
+ circle '<(0,0),1>' <-> circle '<(5,0),1>'3
-
+
-
+ geometric_type@>geometric_typeboolean
-
+
+
Does first object contain second?
Available for these pairs of types:
(box, point),
@@ -9673,17 +10446,19 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
(polygon, polygon),
(circle, point),
(circle, circle).
-
+
+ circle '<(0,0),2>' @> point '(1,1)'t
-
+
-
+ geometric_type<@geometric_typeboolean
-
+
+
Is first object contained in or on second?
Available for these pairs of types:
(point, box),
@@ -9697,193 +10472,221 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
(lseg, line),
(polygon, polygon),
(circle, circle).
-
+
+ point '(1,1)' <@ circle '<(0,0),2>'t
-
+
-
+ geometric_type&&geometric_typeboolean
-
+
+
Do these objects overlap? (One point in common makes this true.)
Available for box, polygon,
circle.
-
+
+ box '(1,1),(0,0)' && box '(2,2),(0,0)'t
-
+
-
+ geometric_type<<geometric_typeboolean
-
+
+
Is first object strictly left of second?
Available for point, box,
polygon, circle.
-
+
+ circle '<(0,0),1>' << circle '<(5,0),1>'t
-
+
-
+ geometric_type>>geometric_typeboolean
-
+
+
Is first object strictly right of second?
Available for point, box,
polygon, circle.
-
+
+ circle '<(5,0),1>' >> circle '<(0,0),1>'t
-
+
-
+ geometric_type&<geometric_typeboolean
-
+
+
Does first object not extend to the right of second?
Available for box, polygon,
circle.
-
+
+ box '(1,1),(0,0)' &< box '(2,2),(0,0)'t
-
+
-
+ geometric_type&>geometric_typeboolean
-
+
+
Does first object not extend to the left of second?
Available for box, polygon,
circle.
-
+
+ box '(3,3),(0,0)' &> box '(2,2),(0,0)'t
-
+
-
+ geometric_type<<|geometric_typeboolean
-
+
+
Is first object strictly below second?
Available for box, polygon,
circle.
-
+
+ box '(3,3),(0,0)' <<| box '(5,5),(3,4)'t
-
+
-
+ geometric_type|>>geometric_typeboolean
-
+
+
Is first object strictly above second?
Available for box, polygon,
circle.
-
+
+ box '(5,5),(3,4)' |>> box '(3,3),(0,0)'t
-
+
-
+ geometric_type&<|geometric_typeboolean
-
+
+
Does first object not extend above second?
Available for box, polygon,
circle.
-
+
+ box '(1,1),(0,0)' &<| box '(2,2),(0,0)'t
-
+
-
+ geometric_type|&>geometric_typeboolean
-
+
+
Does first object not extend below second?
Available for box, polygon,
circle.
-
+
+ box '(3,3),(0,0)' |&> box '(2,2),(0,0)'t
-
+
-
+ box<^boxboolean
-
+
+
Is first object below second (allows edges to touch)?
-
+
+ box '((1,1),(0,0))' <^ box '((2,2),(1,1))'t
-
+
-
+ point<^pointboolean
-
+
+
Is first object strictly below second?
(This operator is misnamed; it should be <<|.)
-
+
+ point '(1,0)' <^ point '(1,1)'t
-
+
-
+ box>^boxboolean
-
+
+
Is first object above second (allows edges to touch)?
-
+
+ box '((2,2),(1,1))' >^ box '((1,1),(0,0))'t
-
+
-
+ point>^pointboolean
-
+
+
Is first object strictly above second?
(This operator is misnamed; it should be |>>.)
-
+
+ point '(1,1)' >^ point '(1,0)'t
-
+
-
+ geometric_type?#geometric_typeboolean
-
+
+
Do these objects intersect?
Available for these pairs of types:
(box, box),
@@ -9893,100 +10696,127 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
(line, box),
(line, line),
(path, path).
-
+
+ lseg '[(-1,0),(1,0)]' ?# box '(2,2),(-2,-2)'t
-
+
-
- ?-geometric_type
+
+ ?-lineboolean
-
+
+
+ ?-lseg
+ boolean
+
+
Is line horizontal?
- Available for lseg, line.
-
+
+ ?- lseg '[(-1,0),(1,0)]'t
-
+
-
+ point?-pointboolean
-
+
+
Are points horizontally aligned (that is, have same y coordinate)?
-
+
+ point '(1,0)' ?- point '(0,0)'t
-
+
-
- ?|geometric_type
+
+ ?|lineboolean
-
+
+
+ ?|lseg
+ boolean
+
+
Is line vertical?
- Available for lseg, line.
-
+
+ ?| lseg '[(-1,0),(1,0)]'f
-
+
-
+ point?|pointboolean
-
+
+
Are points vertically aligned (that is, have same x coordinate)?
-
+
+ point '(0,1)' ?| point '(0,0)'t
-
+
-
- geometric_type?-|geometric_type
+
+ line?-|lineboolean
-
+
+
+ lseg?-|lseg
+ boolean
+
+
Are lines perpendicular?
- Available for lseg, line.
-
+
+ lseg '[(0,0),(0,1)]' ?-| lseg '[(0,0),(1,0)]'t
-
+
-
- geometric_type?||geometric_type
+
+ line?||lineboolean
-
+
+
+ lseg?||lseg
+ boolean
+
+
Are lines parallel?
- Available for lseg, line.
-
+
+ lseg '[(-1,0),(1,0)]' ?|| lseg '[(-1,2),(1,2)]'t
-
+
-
+ geometric_type~=geometric_typeboolean
-
+
+
Are these objects the same?
Available for point, box,
polygon, circle.
-
+
+ polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))'t
-
+
@@ -10018,229 +10848,263 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ areaarea ( geometric_type )
double precision
-
+
+
Computes area.
Available for box, path, circle.
A path input must be closed, else NULL is returned.
Also, if the path is self-intersecting, the result may be
meaningless.
-
+
+ area(box '(2,2),(0,0)')4
-
+
-
+ centercenter ( geometric_type )
point
-
+
+
Computes center point.
Available for box, circle.
-
+
+ center(box '(1,2),(0,0)')(0.5,1)
-
+
-
+ diagonaldiagonal ( box )
lseg
-
+
+
Extracts box's diagonal as a line segment
(same as lseg(box)).
-
+
+ diagonal(box '(1,2),(0,0)')[(1,2),(0,0)]
-
+
-
+ diameterdiameter ( circle )
double precision
-
+
+
Computes diameter of circle.
-
+
+ diameter(circle '<(0,0),2>')4
-
+
-
+ heightheight ( box )
double precision
-
+
+
Computes vertical size of box.
-
+
+ height(box '(1,2),(0,0)')2
-
+
-
+ isclosedisclosed ( path )
boolean
-
+
+
Is path closed?
-
+
+ isclosed(path '((0,0),(1,1),(2,0))')t
-
+
-
+ isopenisopen ( path )
boolean
-
+
+
Is path open?
-
+
+ isopen(path '[(0,0),(1,1),(2,0)]')t
-
+
-
+ lengthlength ( geometric_type )
double precision
-
+
+
Computes the total length.
Available for lseg, path.
-
+
+ length(path '((-1,0),(1,0))')4
-
+
-
+ npointsnpoints ( geometric_type )
integer
-
+
+
Returns the number of points.
Available for path, polygon.
-
+
+ npoints(path '[(0,0),(1,1),(2,0)]')3
-
+
-
+ pclosepclose ( path )
path
-
+
+
Converts path to closed form.
-
+
+ pclose(path '[(0,0),(1,1),(2,0)]')((0,0),(1,1),(2,0))
-
+
-
+ popenpopen ( path )
path
-
+
+
Converts path to open form.
-
+
+ popen(path '((0,0),(1,1),(2,0))')[(0,0),(1,1),(2,0)]
-
+
-
+ radiusradius ( circle )
double precision
-
+
+
Computes radius of circle.
-
+
+ radius(circle '<(0,0),2>')2
-
+
-
+ slopeslope ( point, point )
double precision
-
+
+
Computes slope of a line drawn through the two points.
-
+
+ slope(point '(0,0)', point '(2,1)')0.5
-
+
-
+ widthwidth ( box )
double precision
-
+
+
Computes horizontal size of box.
-
+
+ width(box '(1,2),(0,0)')1
-
+
@@ -10251,290 +11115,338 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ boxbox ( circle )
box
-
+
+
Computes box inscribed within the circle.
-
+
+ box(circle '<(0,0),2>')(1.414213562373095,1.414213562373095),&zwsp;(-1.414213562373095,-1.414213562373095)
-
+
-
+ box ( point )
box
-
+
+
Converts point to empty box.
-
+
+ box(point '(1,0)')(1,0),(1,0)
-
+
-
+ box ( point, point )
box
-
+
+
Converts any two corner points to box.
-
+
+ box(point '(0,1)', point '(1,0)')(1,1),(0,0)
-
+
-
+ box ( polygon )
box
-
+
+
Computes bounding box of polygon.
-
+
+ box(polygon '((0,0),(1,1),(2,0))')(2,1),(0,0)
-
+
-
+ bound_boxbound_box ( box, box )
box
-
+
+
Computes bounding box of two boxes.
-
+
+ bound_box(box '(1,1),(0,0)', box '(4,4),(3,3)')(4,4),(0,0)
-
+
-
+ circlecircle ( box )
circle
-
+
+
Computes smallest circle enclosing box.
-
+
+ circle(box '(1,1),(0,0)')<(0.5,0.5),0.7071067811865476>
-
+
-
+ circle ( point, double precision )
circle
-
+
+
Constructs circle from center and radius.
-
+
+ circle(point '(0,0)', 2.0)<(0,0),2>
-
+
-
+ circle ( polygon )
circle
-
+
+
Converts polygon to circle. The circle's center is the mean of the
positions of the polygon's points, and the radius is the average
distance of the polygon's points from that center.
-
+
+ circle(polygon '((0,0),(1,3),(2,0))')<(1,1),1.6094757082487299>
-
+
-
+ lineline ( point, point )
line
-
+
+
Converts two points to the line through them.
-
+
+ line(point '(-1,0)', point '(1,0)'){0,-1,0}
-
+
-
+ lseglseg ( box )
lseg
-
+
+
Extracts box's diagonal as a line segment.
-
+
+ lseg(box '(1,0),(-1,0)')[(1,0),(-1,0)]
-
+
-
+ lseg ( point, point )
lseg
-
+
+
Constructs line segment from two endpoints.
-
+
+ lseg(point '(-1,0)', point '(1,0)')[(-1,0),(1,0)]
-
+
-
+ pathpath ( polygon )
path
-
+
+
Converts polygon to a closed path with the same list of points.
-
+
+ path(polygon '((0,0),(1,1),(2,0))')((0,0),(1,1),(2,0))
-
+
-
+ pointpoint ( double precision, double precision )
point
-
+
+
Constructs point from its coordinates.
-
+
+ point(23.4, -44.5)(23.4,-44.5)
-
+
-
+ point ( box )
point
-
+
+
Computes center of box.
-
+
+ point(box '(1,0),(-1,0)')(0,0)
-
+
-
+ point ( circle )
point
-
+
+
Computes center of circle.
-
+
+ point(circle '<(0,0),2>')(0,0)
-
+
-
+ point ( lseg )
point
-
+
+
Computes center of line segment.
-
+
+ point(lseg '[(-1,0),(1,0)]')(0,0)
-
+
-
+ point ( polygon )
point
-
+
+
Computes center of polygon (the mean of the
positions of the polygon's points).
-
+
+ point(polygon '((0,0),(1,1),(2,0))')(1,0.3333333333333333)
-
+
-
+ polygonpolygon ( box )
polygon
-
+
+
Converts box to a 4-point polygon.
-
+
+ polygon(box '(1,1),(0,0)')((0,0),(0,1),(1,1),(1,0))
-
+
-
+ polygon ( circle )
polygon
-
+
+
Converts circle to a 12-point polygon.
-
+
+ polygon(circle '<(0,0),2>')((-2,0),&zwsp;(-1.7320508075688774,0.9999999999999999),&zwsp;(-1.0000000000000002,1.7320508075688772),&zwsp;(-1.2246063538223773e-16,2),&zwsp;(0.9999999999999996,1.7320508075688774),&zwsp;(1.732050807568877,1.0000000000000007),&zwsp;(2,2.4492127076447545e-16),&zwsp;(1.7320508075688776,-0.9999999999999994),&zwsp;(1.0000000000000009,-1.7320508075688767),&zwsp;(3.673819061467132e-16,-2),&zwsp;(-0.9999999999999987,-1.732050807568878),&zwsp;(-1.7320508075688767,-1.0000000000000009))
-
+
-
+ polygon ( integer, circle )
polygon
-
+
+
Converts circle to an n-point polygon.
-
+
+ polygon(4, circle '<(3,0),1>')((2,0),&zwsp;(3,1),&zwsp;(4,1.2246063538223773e-16),&zwsp;(3,-1))
-
+
-
+ polygon ( path )
polygon
-
+
+
Converts closed path to a polygon with the same list of points.
-
+
+ polygon(path '((0,0),(1,1),(2,0))')((0,0),(1,1),(2,0))
-
+
@@ -10582,171 +11494,205 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- OperatorDescriptionExample(s)
-
+
+ Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ inet<<inetboolean
-
+
+
Is subnet strictly contained by subnet?
This operator, and the next four, test for subnet inclusion. They
consider only the network parts of the two addresses (ignoring any
bits to the right of the netmasks) and determine whether one network
is identical to or a subnet of the other.
-
+
+ inet '192.168.1.5' << inet '192.168.1/24't
-
+
+ inet '192.168.0.5' << inet '192.168.1/24'f
-
+
+ inet '192.168.1/24' << inet '192.168.1/24'f
-
+
-
+ inet<<=inetboolean
-
+
+
Is subnet contained by or equal to subnet?
-
+
+ inet '192.168.1/24' <<= inet '192.168.1/24't
-
+
-
+ inet>>inetboolean
-
+
+
Does subnet strictly contain subnet?
-
+
+ inet '192.168.1/24' >> inet '192.168.1.5't
-
+
-
+ inet>>=inetboolean
-
+
+
Does subnet contain or equal subnet?
-
+
+ inet '192.168.1/24' >>= inet '192.168.1/24't
-
+
-
+ inet&&inetboolean
-
+
+
Does either subnet contain or equal the other?
-
+
+ inet '192.168.1/24' && inet '192.168.1.80/28't
-
+
+ inet '192.168.1/24' && inet '192.168.2.0/28'f
-
+
-
+ ~inetinet
-
+
+
Computes bitwise NOT.
-
+
+ ~ inet '192.168.1.6'63.87.254.249
-
+
-
+ inet&inetinet
-
+
+
Computes bitwise AND.
-
+
+ inet '192.168.1.6' & inet '0.0.0.255'0.0.0.6
-
+
-
+ inet|inetinet
-
+
+
Computes bitwise OR.
-
+
+ inet '192.168.1.6' | inet '0.0.0.255'192.168.1.255
-
+
-
+ inet+bigintinet
-
+
+
Adds an offset to an address.
-
+
+ inet '192.168.1.6' + 25192.168.1.31
-
+
-
+ bigint+inetinet
-
+
+
Adds an offset to an address.
-
+
+ 200 + inet '::ffff:fff0:1'::ffff:255.240.0.201
-
+
-
+ inet-bigintinet
-
+
+
Subtracts an offset from an address.
-
+
+ inet '192.168.1.43' - 36192.168.1.7
-
+
-
+ inet-inetbigint
-
+
+
Computes the difference of two addresses.
-
+
+ inet '192.168.1.43' - inet '192.168.1.19'24
-
+
+ inet '::1' - inet '::ffff:1'-4294901760
-
+
@@ -10757,228 +11703,262 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ abbrevabbrev ( inet )
text
-
+
+
Creates an abbreviated display format as text.
(The result is the same as the inet output function
produces; it is abbreviated only in comparison to the
result of an explicit cast to text, which for historical
reasons will never suppress the netmask part.)
-
+
+ abbrev(inet '10.1.0.0/32')10.1.0.0
-
+
-
+ abbrev ( cidr )
text
-
+
+
Creates an abbreviated display format as text.
(The abbreviation consists of dropping all-zero octets to the right
of the netmask; more examples are in
.)
-
+
+ abbrev(cidr '10.1.0.0/16')10.1/16
-
+
-
+ broadcastbroadcast ( inet )
inet
-
+
+
Computes the broadcast address for the address's network.
-
+
+ broadcast(inet '192.168.1.5/24')192.168.1.255/24
-
+
-
+ familyfamily ( inet )
integer
-
+
+
Returns the address's family: 4 for IPv4,
6 for IPv6.
-
+
+ family(inet '::1')6
-
+
-
+ hosthost ( inet )
text
-
+
+
Returns the IP address as text, ignoring the netmask.
-
+
+ host(inet '192.168.1.0/24')192.168.1.0
-
+
-
+ hostmaskhostmask ( inet )
inet
-
+
+
Computes the host mask for the address's network.
-
+
+ hostmask(inet '192.168.23.20/30')0.0.0.3
-
+
-
+ inet_mergeinet_merge ( inet, inet )
cidr
-
+
+
Computes the smallest network that includes both of the given networks.
-
+
+ inet_merge(inet '192.168.1.5/24', inet '192.168.2.5/24')192.168.0.0/22
-
+
-
+ inet_same_familyinet_same_family ( inet, inet )
boolean
-
+
+
Tests whether the addresses belong to the same IP family.
-
+
+ inet_same_family(inet '192.168.1.5/24', inet '::1')f
-
+
-
+ masklenmasklen ( inet )
integer
-
+
+
Returns the netmask length in bits.
-
+
+ masklen(inet '192.168.1.5/24')24
-
+
-
+ netmasknetmask ( inet )
inet
-
+
+
Computes the network mask for the address's network.
-
+
+ netmask(inet '192.168.1.5/24')255.255.255.0
-
+
-
+ networknetwork ( inet )
cidr
-
+
+
Returns the network part of the address, zeroing out
whatever is to the right of the netmask.
(This is equivalent to casting the value to cidr.)
-
+
+ network(inet '192.168.1.5/24')192.168.1.0/24
-
+
-
+ set_masklenset_masklen ( inet, integer )
inet
-
+
+
Sets the netmask length for an inet value.
The address part does not change.
-
+
+ set_masklen(inet '192.168.1.5/24', 16)192.168.1.5/16
-
+
-
+ set_masklen ( cidr, integer )
cidr
-
+
+
Sets the netmask length for a cidr value.
Address bits to the right of the new netmask are set to zero.
-
+
+ set_masklen(cidr '192.168.1.0/24', 16)192.168.0.0/16
-
+
-
+ texttext ( inet )
text
-
+
+
Returns the unabbreviated IP address and netmask length as text.
(This has the same result as an explicit cast to text.)
-
+
+ text(inet '192.168.1.5')192.168.1.5/32
-
+
@@ -11008,58 +11988,70 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ trunctrunc ( macaddr )
macaddr
-
+
+
Sets the last 3 bytes of the address to zero. The remaining prefix
can be associated with a particular manufacturer (using data not
included in PostgreSQL).
-
+
+ trunc(macaddr '12:34:56:78:90:ab')12:34:56:00:00:00
-
+
-
+ trunc ( macaddr8 )
macaddr8
-
+
+
Sets the last 5 bytes of the address to zero. The remaining prefix
can be associated with a particular manufacturer (using data not
included in PostgreSQL).
-
+
+ trunc(macaddr8 '12:34:56:78:90:ab:cd:ef')12:34:56:00:00:00:00:00
-
+
-
+ macaddr8_set7bitmacaddr8_set7bit ( macaddr8 )
macaddr8
-
+
+
Sets the 7th bit of the address to one, creating what is known as
modified EUI-64, for inclusion in an IPv6 address.
-
+
+ macaddr8_set7bit(macaddr8 '00:34:56:ab:cd:ef')02:34:56:ff:fe:ab:cd:ef
-
+
@@ -11096,149 +12088,181 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- OperatorDescriptionExample(s)
-
+
+ Operator
+
+
+ Description
+
+
+ Example(s)
+
-
+ tsvector@@tsquery
- or
+ boolean
+
+ tsquery@@tsvectorboolean
-
+
+
Does tsvector match tsquery?
-
+ (The arguments can be given in either order.)
+
+ to_tsvector('fat cats ate rats') @@ to_tsquery('cat & rat')t
-
+
-
+ text@@tsqueryboolean
-
+
+
Does text string, after implicit invocation
of to_tsvector(), match tsquery?
-
+
+ 'fat cats ate rats' @@ to_tsquery('cat & rat')t
-
+
-
+ tsvector@@@tsquery
- or
+ boolean
+
+ tsquery@@@tsvectorboolean
-
+
+
This is a deprecated synonym for @@.
-
+
+ to_tsvector('fat cats ate rats') @@@ to_tsquery('cat & rat')t
-
+
-
+ tsvector||tsvectortsvector
-
+
+
Concatenates two tsvectors. If both inputs contain
lexeme positions, the second input's positions are adjusted
accordingly.
-
+
+ 'a:1 b:2'::tsvector || 'c:1 d:2 b:3'::tsvector'a':1 'b':2,5 'c':3 'd':4
-
+
-
+ tsquery&&tsquerytsquery
-
+
+
ANDs two tsquerys together, producing a query that
matches documents that match both input queries.
-
+
+ 'fat | rat'::tsquery && 'cat'::tsquery( 'fat' | 'rat' ) & 'cat'
-
+
-
+ tsquery||tsquerytsquery
-
+
+
ORs two tsquerys together, producing a query that
matches documents that match either input query.
-
+
+ 'fat | rat'::tsquery || 'cat'::tsquery'fat' | 'rat' | 'cat'
-
+
-
+ !!tsquerytsquery
-
+
+
Negates a tsquery, producing a query that matches
documents that do not match the input query.
-
+
+ !! 'cat'::tsquery!'cat'
-
+
-
+ tsquery<->tsquerytsquery
-
+
+
Constructs a phrase query, which matches if the two input queries
match at successive lexemes.
-
+
+ to_tsquery('fat') <-> to_tsquery('rat')'fat' <-> 'rat'
-
+
-
+ tsquery@>tsqueryboolean
-
+
+
Does first tsquery contain the second? (This considers
only whether all the lexemes appearing in one query appear in the
other, ignoring the combining operators.)
-
+
+ 'cat'::tsquery @> 'cat & rat'::tsqueryf
-
+
-
+ tsquery<@tsqueryboolean
-
+
+
Is first tsquery contained in the second? (This
considers only whether all the lexemes appearing in one query appear
in the other, ignoring the combining operators.)
-
+
+ 'cat'::tsquery <@ 'cat & rat'::tsqueryt
-
+
+ 'cat'::tsquery <@ '!cat & rat'::tsqueryt
-
+
@@ -11258,78 +12282,92 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ array_to_tsvectorarray_to_tsvector ( text[] )
tsvector
-
+
+
Converts an array of lexemes to a tsvector.
The given strings are used as-is without further processing.
-
+
+ array_to_tsvector('{fat,cat,rat}'::text[])'cat' 'fat' 'rat'
-
+
-
+ get_current_ts_configget_current_ts_config ( )
regconfig
-
+
+
Returns the OID of the current default text search configuration
(as set by ).
-
+
+ get_current_ts_config()english
-
+
-
+ lengthlength ( tsvector )
integer
-
+
+
Returns the number of lexemes in the tsvector.
-
+
+ length('fat:2,4 cat:3 rat:5A'::tsvector)3
-
+
-
+ numnodenumnode ( tsquery )
integer
-
+
+
Returns the number of lexemes plus operators in
the tsquery.
-
+
+ numnode('(fat & rat) | cat'::tsquery)5
-
+
-
+ plainto_tsquery
@@ -11337,19 +12375,21 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
configregconfig, querytext )
tsquery
-
+
+
Converts text to a tsquery, normalizing words according to
the specified or default configuration. Any punctuation in the string
is ignored (it does not determine query operators). The resulting
query matches documents containing all non-stopwords in the text.
-
+
+ plainto_tsquery('english', 'The Fat Rats')'fat' & 'rat'
-
+
-
+ phraseto_tsquery
@@ -11357,22 +12397,25 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
configregconfig, querytext )
tsquery
-
+
+
Converts text to a tsquery, normalizing words according to
the specified or default configuration. Any punctuation in the string
is ignored (it does not determine query operators). The resulting
query matches phrases containing all non-stopwords in the text.
-
+
+ phraseto_tsquery('english', 'The Fat Rats')'fat' <-> 'rat'
-
+
+ phraseto_tsquery('english', 'The Cat and Rats')'cat' <2> 'rat'
-
+
-
+ websearch_to_tsquery
@@ -11380,87 +12423,97 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
configregconfig, querytext )
tsquery
-
+
+
Converts text to a tsquery, normalizing words according
to the specified or default configuration. Quoted word sequences are
converted to phrase tests. The word or is understood
as producing an OR operator, and a dash produces a NOT operator;
other punctuation is ignored.
This approximates the behavior of some common web search tools.
-
+
+ websearch_to_tsquery('english', '"fat rat" or cat dog')'fat' <-> 'rat' | 'cat' & 'dog'
-
+
-
+ querytreequerytree ( tsquery )
text
-
+
+
Produces a representation of the indexable portion of
a tsquery. A result that is empty or
just T indicates a non-indexable query.
-
+
+ querytree('foo & ! bar'::tsquery)'foo'
-
+
-
+ setweightsetweight ( vectortsvector, weight"char" )
tsvector
-
+
+
Assigns the specified weight to each element
of the vector.
-
+
+ setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A')'cat':3A 'fat':2A,4A 'rat':5A
-
+
-
+ setweightsetweight for specific lexeme(s)setweight ( vectortsvector, weight"char", lexemestext[] )
tsvector
-
+
+
Assigns the specified weight to elements
of the vector that are listed
in lexemes.
-
+
+ setweight('fat:2,4 cat:3 rat:5,6B'::tsvector, 'A', '{cat,rat}')'cat':3A 'fat':2,4 'rat':5A,6A
-
+
-
+ stripstrip ( tsvector )
tsvector
-
+
+
Removes positions and weights from the tsvector.
-
+
+ strip('fat:2,4 cat:3 rat:5A'::tsvector)'cat' 'fat' 'rat'
-
+
-
+ to_tsquery
@@ -11468,18 +12521,20 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
configregconfig, querytext )
tsquery
-
+
+
Converts text to a tsquery, normalizing words according to
the specified or default configuration. The words must be combined
by valid tsquery operators.
-
+
+ to_tsquery('english', 'The & Fat & Rats')'fat' & 'rat'
-
+
-
+ to_tsvector
@@ -11487,23 +12542,32 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
configregconfig, documenttext )
tsvector
-
+
+
Converts text to a tsvector, normalizing words according
to the specified or default configuration. Position information is
included in the result.
-
+
+ to_tsvector('english', 'The Fat Rats')'fat':2 'rat':3
-
+
-
+ to_tsvector (
configregconfig,
- documentjson(b) )
+ documentjson )
tsvector
-
+
+
+ to_tsvector (
+ configregconfig,
+ documentjsonb )
+ tsvector
+
+
Converts each string value in the JSON document to
a tsvector, normalizing words according to the specified
or default configuration. The results are then concatenated in
@@ -11512,26 +12576,39 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
values. (Beware that document order of the fields of a
JSON object is implementation-dependent when the input
is jsonb; observe the difference in the examples.)
-
+
+ to_tsvector('english', '{"aa": "The Fat Rats", "b": "dog"}'::json)'dog':5 'fat':2 'rat':3
-
+
+ to_tsvector('english', '{"aa": "The Fat Rats", "b": "dog"}'::jsonb)'dog':1 'fat':4 'rat':5
-
+
-
+
- json(b)_to_tsvector
+ json_to_tsvector
- json(b)_to_tsvector (
+ json_to_tsvector (
configregconfig,
- documentjson(b),
+ documentjson,
filterjsonb )
tsvector
-
+
+
+
+ jsonb_to_tsvector
+
+ jsonb_to_tsvector (
+ configregconfig,
+ documentjsonb,
+ filterjsonb )
+ tsvector
+
+
Selects each item in the JSON document that is requested by
the filter and converts each one to
a tsvector, normalizing words according to the specified
@@ -11550,63 +12627,71 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
"all" (to include all the above).
As a special case, the filter can also be a
simple JSON value that is one of these keywords.
-
+
+ json_to_tsvector('english', '{"a": "The Fat Rats", "b": 123}'::json, '["string", "numeric"]')'123':5 'fat':2 'rat':3
-
+
+ json_to_tsvector('english', '{"cat": "The Fat Rats", "dog": 123}'::json, '"all"')'123':9 'cat':1 'dog':7 'fat':4 'rat':5
-
+
-
+ ts_deletets_delete ( vectortsvector, lexemetext )
tsvector
-
+
+
Removes any occurrence of the given lexeme
from the vector.
-
+
+ ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat')'cat':3 'rat':5A
-
+
-
+ ts_delete ( vectortsvector, lexemestext[] )
tsvector
-
+
+
Removes any occurrences of the lexemes
in lexemes
from the vector.
-
+
+ ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat'])'cat':3
-
+
-
+ ts_filterts_filter ( vectortsvector, weights"char"[] )
tsvector
-
+
+
Selects only elements with the given weights
from the vector.
-
+
+ ts_filter('fat:2,4 cat:3b,7c rat:5A'::tsvector, '{a,b}')'cat':3B 'rat':5A
-
+
-
+ ts_headline
@@ -11616,7 +12701,8 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
querytsquery, optionstext )
text
-
+
+
Displays, in an abbreviated form, the match(es) for
the query in
the document, which must be raw text not
@@ -11625,33 +12711,44 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
the query. Use of this function is discussed in
, which also describes the
available options.
-
+
+ ts_headline('The fat cat ate the rat.', 'cat')The fat <b>cat</b> ate the rat.
-
+
-
+ ts_headline (
configregconfig,
- documentjson(b),
+ documentjson,
querytsquery, optionstext )
text
-
+
+
+ ts_headline (
+ configregconfig,
+ documentjsonb,
+ querytsquery
+ , optionstext )
+ text
+
+
Displays, in an abbreviated form, match(es) for
the query that occur in string values
within the JSON document.
See for more details.
-
+
+ ts_headline('{"cat":"raining cats and dogs"}'::jsonb, 'cat'){"cat": "raining <b>cats</b> and dogs"}
-
+
-
+ ts_rank
@@ -11661,19 +12758,21 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
querytsquery, normalizationinteger )
real
-
+
+
Computes a score showing how well
the vector matches
the query. See
for details.
-
+
+ ts_rank(to_tsvector('raining cats and dogs'), 'cat')0.06079271
-
+
-
+ ts_rank_cd
@@ -11683,19 +12782,21 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
querytsquery, normalizationinteger )
real
-
+
+
Computes a score showing how well
the vector matches
the query, using a cover density
algorithm. See for details.
-
+
+ ts_rank_cd(to_tsvector('raining cats and dogs'), 'cat')0.1
-
+
-
+ ts_rewrite
@@ -11703,83 +12804,93 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
targettsquery,
substitutetsquery )
tsquery
-
+
+
Replaces occurrences of target
with substitute
within the query.
See for details.
-
+
+ ts_rewrite('a & b'::tsquery, 'a'::tsquery, 'foo|bar'::tsquery)'b' & ( 'foo' | 'bar' )
-
+
-
+ ts_rewrite ( querytsquery,
selecttext )
tsquery
-
+
+
Replaces portions of the query according to
target(s) and substitute(s) obtained by executing
a SELECT command.
See for details.
-
+
+ SELECT ts_rewrite('a & b'::tsquery, 'SELECT t,s FROM aliases')'b' & ( 'foo' | 'bar' )
-
+
-
+ tsquery_phrasetsquery_phrase ( query1tsquery, query2tsquery )
tsquery
-
+
+
Constructs a phrase query that searches
for matches of query1
and query2 at successive lexemes (same
as <-> operator).
-
+
+ tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'))'fat' <-> 'cat'
-
+
-
+ tsquery_phrase ( query1tsquery, query2tsquery, distanceinteger )
tsquery
-
+
+
Constructs a phrase query that searches
for matches of query1 and
query2 that occur exactly
distance lexemes apart.
-
+
+ tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'), 10)'fat' <10> 'cat'
-
+
-
+ tsvector_to_arraytsvector_to_array ( tsvector )
text[]
-
+
+
Converts a tsvector to an array of lexemes.
-
+
+ tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector){cat,fat,rat}
-
+
-
+ unnestfor tsvector
@@ -11789,12 +12900,21 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
OUTpositionssmallint[],
OUTweightstext )
setof record
-
+
+
Expands a tsvector into a set of rows, one per lexeme.
-
- unnest('cat:3 fat:2,4 rat:5A'::tsvector)
- (cat,{3},{D})(fat,"{2,4}","{D,D}")(rat,{5},{A})(3 rows in result)
-
+
+
+ select * from unnest('cat:3 fat:2,4 rat:5A'::tsvector)
+
+
+ lexeme | positions | weights
+--------+-----------+---------
+ cat | {3} | {D}
+ fat | {2,4} | {D,D}
+ rat | {5} | {A}
+
+
@@ -11822,15 +12942,21 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
-
- FunctionDescriptionExample(s)
-
+
+ Function
+
+
+ Description
+
+
+ Example(s)
+
-
+ ts_debug
@@ -11844,38 +12970,42 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
OUTdictionaryregdictionary,
OUTlexemestext[] )
setof record
-
+
+
Extracts and normalizes tokens from
the document according to the specified or
default text search configuration, and returns information about how
each token was processed.
See for details.
-
+
+ ts_debug('english', 'The Brightest supernovaes')(asciiword,"Word, all ASCII",The,{english_stem},english_stem,{}) ...
-
+
-
+ ts_lexizets_lexize ( dictregdictionary, tokentext )
text[]
-
+
+
Returns an array of replacement lexemes if the input token is known to
the dictionary, or an empty array if the token is known to the
dictionary but it is a stop word, or NULL if it is not a known word.
See for details.
-
+
+ ts_lexize('english_stem', 'stars'){star}
-
+
-
+ ts_parse
@@ -11884,35 +13014,39 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
OUTtokidinteger,
OUTtokentext )
setof record
-
+
+
Extracts tokens from the document using the
named parser.
See for details.
-
+
+ ts_parse('default', 'foo - bar')(1,foo) ...
-
+
-
+ ts_parse ( parser_oidoid,
documenttext,
OUTtokidinteger,
OUTtokentext )
setof record
-
+
+
Extracts tokens from the document using a
parser specified by OID.
See for details.
-
+
+ ts_parse(3722, 'foo - bar')(1,foo) ...
-
+
-
+ ts_token_type
@@ -11921,35 +13055,39 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
OUTaliastext,
OUTdescriptiontext )
setof record
-
+
+
Returns a table that describes each type of token the named parser can
recognize.
See for details.
-
+
+ ts_token_type('default')(1,asciiword,"Word, all ASCII") ...
-
+
-
+ ts_token_type ( parser_oidoid,
OUTtokidinteger,
OUTaliastext,
OUTdescriptiontext )
setof record
-
+
+
Returns a table that describes each type of token a parser specified
by OID can recognize.
See for details.
-
+
+ ts_token_type(3722)(1,asciiword,"Word, all ASCII") ...
-
+
-
+ ts_stat
@@ -11959,15 +13097,17 @@ CREATE TYPE rainbow AS ENUM ('red', 'orange', 'yellow', 'green', 'blue', 'purple
OUTndocinteger,
OUTnentryinteger )
setof record
-
+
+
Executes the sqlquery, which must return a
single tsvector column, and returns statistics about each
distinct lexeme contained in the data.
See for details.
-
+
+ ts_stat('SELECT vector FROM apod')(foo,10,15) ...
-
+
@@ -24034,59 +25174,71 @@ SELECT (pg_stat_file('filename')).modification;
-
- FunctionDescriptionExample Usage
-
+
+ Function
+
+
+ Description
+
+
+ Example Usage
+
-
+ suppress_redundant_updates_triggersuppress_redundant_updates_trigger ( )
trigger
-
+
+
Suppresses do-nothing update operations. See below for details.
-
+
+ CREATE TRIGGER ... suppress_redundant_updates_trigger()
-
+
-
+ tsvector_update_triggertsvector_update_trigger ( )
trigger
-
+
+
Automatically updates a tsvector column from associated
plain-text document column(s). The text search configuration to use
is specified by name as a trigger argument. See
for details.
-
+
+ CREATE TRIGGER ... tsvector_update_trigger(tsvcol, 'pg_catalog.swedish', title, body)
-
+
-
+ tsvector_update_trigger_columntsvector_update_trigger_column ( )
trigger
-
+
+
Automatically updates a tsvector column from associated
plain-text document column(s). The text search configuration to use
is taken from a regconfig column of the table. See
for details.
-
+
+ CREATE TRIGGER ... tsvector_update_trigger_column(tsvcol, tsconfigcol, title, body)
-
+
diff --git a/doc/src/sgml/stylesheet-common.xsl b/doc/src/sgml/stylesheet-common.xsl
index b772f876c17..761484c7fef 100644
--- a/doc/src/sgml/stylesheet-common.xsl
+++ b/doc/src/sgml/stylesheet-common.xsl
@@ -101,11 +101,4 @@
-
-
-
-
-
-
-
diff --git a/doc/src/sgml/stylesheet-fo.xsl b/doc/src/sgml/stylesheet-fo.xsl
index 2f2517d8ce6..fe2a06a26a1 100644
--- a/doc/src/sgml/stylesheet-fo.xsl
+++ b/doc/src/sgml/stylesheet-fo.xsl
@@ -63,30 +63,14 @@
-
-
-
-
-
- bold
-
-
-
- bold
-
-
-
-
-
-
- 4em
+
+
+
+ -3.5em
- left
-
-
+
+
+
@@ -96,11 +80,6 @@
-
-
-
-
-
diff --git a/doc/src/sgml/stylesheet.css b/doc/src/sgml/stylesheet.css
index f369e12a3c8..11f88cc0be5 100644
--- a/doc/src/sgml/stylesheet.css
+++ b/doc/src/sgml/stylesheet.css
@@ -78,13 +78,24 @@ div.example {
/* formatting for entries in tables of functions: indent all but first line */
-th.functableentry,
-td.functableentry {
+th.func_table_entry p,
+td.func_table_entry p {
+ margin-top: 0.1em;
+ margin-bottom: 0.1em;
padding-left: 4em;
- text-indent: -3.5em;
text-align: left;
}
+p.func_signature {
+ text-indent: -3.5em;
+}
+
+td.func_table_entry pre.programlisting {
+ margin-top: 0.1em;
+ margin-bottom: 0.1em;
+ padding-left: 4em;
+}
+
/* 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. */