<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Predicate<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Predicate
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>BETWEEN</literal> <replaceable>datatype</replaceable> <literal>AND</literal> <replaceable>datatype</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Between (inclusive of the range endpoints).
- <?br?>
+ </para>
+ <para>
<literal>2 BETWEEN 1 AND 3</literal>
<returnvalue>t</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>2 BETWEEN 3 AND 1</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>NOT BETWEEN</literal> <replaceable>datatype</replaceable> <literal>AND</literal> <replaceable>datatype</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Not between (the negation of <literal>BETWEEN</literal>).
- <?br?>
+ </para>
+ <para>
<literal>2 NOT BETWEEN 1 AND 3</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>BETWEEN SYMMETRIC</literal> <replaceable>datatype</replaceable> <literal>AND</literal> <replaceable>datatype</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Between, after sorting the two endpoint values.
- <?br?>
+ </para>
+ <para>
<literal>2 BETWEEN SYMMETRIC 3 AND 1</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>NOT BETWEEN SYMMETRIC</literal> <replaceable>datatype</replaceable> <literal>AND</literal> <replaceable>datatype</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Not between, after sorting the two endpoint values.
- <?br?>
+ </para>
+ <para>
<literal>2 NOT BETWEEN SYMMETRIC 3 AND 1</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>IS DISTINCT FROM</literal> <replaceable>datatype</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Not equal, treating null as a comparable value.
- <?br?>
+ </para>
+ <para>
<literal>1 IS DISTINCT FROM NULL</literal>
<returnvalue>t</returnvalue> (rather than <literal>NULL</literal>)
- <?br?>
+ </para>
+ <para>
<literal>NULL IS DISTINCT FROM NULL</literal>
<returnvalue>f</returnvalue> (rather than <literal>NULL</literal>)
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>IS NOT DISTINCT FROM</literal> <replaceable>datatype</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Equal, treating null as a comparable value.
- <?br?>
+ </para>
+ <para>
<literal>1 IS NOT DISTINCT FROM NULL</literal>
<returnvalue>f</returnvalue> (rather than <literal>NULL</literal>)
- <?br?>
+ </para>
+ <para>
<literal>NULL IS NOT DISTINCT FROM NULL</literal>
<returnvalue>t</returnvalue> (rather than <literal>NULL</literal>)
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>IS NULL</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether value is null.
- <?br?>
+ </para>
+ <para>
<literal>1.5 IS NULL</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>IS NOT NULL</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether value is not null.
- <?br?>
+ </para>
+ <para>
<literal>'null' IS NOT NULL</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>ISNULL</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether value is null (nonstandard syntax).
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>datatype</replaceable> <literal>NOTNULL</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether value is not null (nonstandard syntax).
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>boolean</type> <literal>IS TRUE</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether boolean expression yields true.
- <?br?>
+ </para>
+ <para>
<literal>true IS TRUE</literal>
<returnvalue>t</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>NULL::boolean IS TRUE</literal>
<returnvalue>f</returnvalue> (rather than <literal>NULL</literal>)
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>boolean</type> <literal>IS NOT TRUE</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether boolean expression yields false or unknown.
- <?br?>
+ </para>
+ <para>
<literal>true IS NOT TRUE</literal>
<returnvalue>f</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>NULL::boolean IS NOT TRUE</literal>
<returnvalue>t</returnvalue> (rather than <literal>NULL</literal>)
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>boolean</type> <literal>IS FALSE</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether boolean expression yields false.
- <?br?>
+ </para>
+ <para>
<literal>true IS FALSE</literal>
<returnvalue>f</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>NULL::boolean IS FALSE</literal>
<returnvalue>f</returnvalue> (rather than <literal>NULL</literal>)
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>boolean</type> <literal>IS NOT FALSE</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether boolean expression yields true or unknown.
- <?br?>
+ </para>
+ <para>
<literal>true IS NOT FALSE</literal>
<returnvalue>t</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>NULL::boolean IS NOT FALSE</literal>
<returnvalue>t</returnvalue> (rather than <literal>NULL</literal>)
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>boolean</type> <literal>IS UNKNOWN</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether boolean expression yields unknown.
- <?br?>
+ </para>
+ <para>
<literal>true IS UNKNOWN</literal>
<returnvalue>f</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>NULL::boolean IS UNKNOWN</literal>
<returnvalue>t</returnvalue> (rather than <literal>NULL</literal>)
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>boolean</type> <literal>IS NOT UNKNOWN</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test whether boolean expression yields true or false.
- <?br?>
+ </para>
+ <para>
<literal>true IS NOT UNKNOWN</literal>
<returnvalue>t</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>NULL::boolean IS NOT UNKNOWN</literal>
<returnvalue>f</returnvalue> (rather than <literal>NULL</literal>)
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>num_nonnulls</primary>
</indexterm>
<function>num_nonnulls</function> ( <literal>VARIADIC</literal> <type>"any"</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of non-null arguments.
- <?br?>
+ </para>
+ <para>
<literal>num_nonnulls(1, NULL, 2)</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>num_nulls</primary>
</indexterm>
<function>num_nulls</function> ( <literal>VARIADIC</literal> <type>"any"</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of null arguments.
- <?br?>
+ </para>
+ <para>
<literal>num_nulls(1, NULL, 2)</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
Operators shown as accepting <replaceable>integral_type</replaceable>
are available for the types <type>smallint</type>, <type>integer</type>,
and <type>bigint</type>.
- Operators shown as accepting <replaceable>numeric_or_dp</replaceable>
- are available for the types <type>numeric</type> and <type>double
- precision</type>.
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 <type>integer</type> <literal>+</literal> <type>numeric</type>,
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>numeric_type</replaceable> <literal>+</literal> <replaceable>numeric_type</replaceable>
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Addition
- <?br?>
+ </para>
+ <para>
<literal>2 + 3</literal>
<returnvalue>5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>+</literal> <replaceable>numeric_type</replaceable>
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Unary plus (no operation)
- <?br?>
+ </para>
+ <para>
<literal>+ 3.5</literal>
<returnvalue>3.5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>numeric_type</replaceable> <literal>-</literal> <replaceable>numeric_type</replaceable>
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Subtraction
- <?br?>
+ </para>
+ <para>
<literal>2 - 3</literal>
<returnvalue>-1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>-</literal> <replaceable>numeric_type</replaceable>
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Negation
- <?br?>
+ </para>
+ <para>
<literal>- (-4)</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>numeric_type</replaceable> <literal>*</literal> <replaceable>numeric_type</replaceable>
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Multiplication
- <?br?>
+ </para>
+ <para>
<literal>2 * 3</literal>
<returnvalue>6</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>numeric_type</replaceable> <literal>/</literal> <replaceable>numeric_type</replaceable>
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Division (for integral types, division truncates the result towards
zero)
- <?br?>
+ </para>
+ <para>
<literal>5.0 / 2</literal>
<returnvalue>2.5000000000000000</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>5 / 2</literal>
<returnvalue>2</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>(-5) / 2</literal>
<returnvalue>-2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>numeric_type</replaceable> <literal>%</literal> <replaceable>numeric_type</replaceable>
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Modulo (remainder); available for <type>smallint</type>,
<type>integer</type>, <type>bigint</type>, and <type>numeric</type>
- <?br?>
+ </para>
+ <para>
<literal>5 % 4</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
- <replaceable>numeric_or_dp</replaceable> <literal>^</literal> <replaceable>numeric_or_dp</replaceable>
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <entry role="func_table_entry"><para role="func_signature">
+ <type>numeric</type> <literal>^</literal> <type>numeric</type>
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <type>double precision</type> <literal>^</literal> <type>double precision</type>
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Exponentiation (unlike typical mathematical practice, multiple uses of
<literal>^</literal> will associate left to right)
- <?br?>
+ </para>
+ <para>
<literal>2 ^ 3</literal>
<returnvalue>8</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>2 ^ 3 ^ 3</literal>
<returnvalue>512</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>|/</literal> <type>double precision</type>
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Square root
- <?br?>
+ </para>
+ <para>
<literal>|/ 25.0</literal>
<returnvalue>5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>||/</literal> <type>double precision</type>
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Cube root
- <?br?>
+ </para>
+ <para>
<literal>||/ 64.0</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>bigint</type> <literal>!</literal>
<returnvalue>numeric</returnvalue>
- <?br?>
+ </para>
+ <para>
Factorial
- <?br?>
+ </para>
+ <para>
<literal>5 !</literal>
<returnvalue>120</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>!!</literal> <type>bigint</type>
<returnvalue>numeric</returnvalue>
- <?br?>
+ </para>
+ <para>
Factorial (as a prefix operator)
- <?br?>
+ </para>
+ <para>
<literal>!! 5</literal>
<returnvalue>120</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>@</literal> <replaceable>numeric_type</replaceable>
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Absolute value
- <?br?>
+ </para>
+ <para>
<literal>@ -5.0</literal>
<returnvalue>5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>integral_type</replaceable> <literal>&</literal> <replaceable>integral_type</replaceable>
<returnvalue><replaceable>integral_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise AND
- <?br?>
+ </para>
+ <para>
<literal>91 & 15</literal>
<returnvalue>11</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>integral_type</replaceable> <literal>|</literal> <replaceable>integral_type</replaceable>
<returnvalue><replaceable>integral_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise OR
- <?br?>
+ </para>
+ <para>
<literal>32 | 3</literal>
<returnvalue>35</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>integral_type</replaceable> <literal>#</literal> <replaceable>integral_type</replaceable>
<returnvalue><replaceable>integral_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise exclusive OR
- <?br?>
+ </para>
+ <para>
<literal>17 # 5</literal>
<returnvalue>20</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>~</literal> <replaceable>integral_type</replaceable>
<returnvalue><replaceable>integral_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise NOT
- <?br?>
+ </para>
+ <para>
<literal>~1</literal>
<returnvalue>-2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>integral_type</replaceable> <literal><<</literal> <type>integer</type>
<returnvalue><replaceable>integral_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise shift left
- <?br?>
+ </para>
+ <para>
<literal>1 << 4</literal>
<returnvalue>16</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>integral_type</replaceable> <literal>>></literal> <type>integer</type>
<returnvalue><replaceable>integral_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise shift right
- <?br?>
+ </para>
+ <para>
<literal>8 >> 2</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>abs</primary>
</indexterm>
<function>abs</function> ( <replaceable>numeric_type</replaceable> )
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Absolute value
- <?br?>
+ </para>
+ <para>
<literal>abs(-17.4)</literal>
<returnvalue>17.4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>cbrt</primary>
</indexterm>
<function>cbrt</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Cube root
- <?br?>
+ </para>
+ <para>
<literal>cbrt(64.0)</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ceil</primary>
</indexterm>
- <function>ceil</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>ceil</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>ceil</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Nearest integer greater than or equal to argument
- <?br?>
+ </para>
+ <para>
<literal>ceil(42.2)</literal>
<returnvalue>43</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>ceil(-42.8)</literal>
<returnvalue>-42</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ceiling</primary>
</indexterm>
- <function>ceiling</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>ceiling</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>ceiling</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Nearest integer greater than or equal to argument (same
as <function>ceil</function>)
- <?br?>
+ </para>
+ <para>
<literal>ceiling(95.3)</literal>
<returnvalue>96</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>degrees</primary>
</indexterm>
<function>degrees</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts radians to degrees
- <?br?>
+ </para>
+ <para>
<literal>degrees(0.5)</literal>
<returnvalue>28.64788975654116</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>div</primary>
</indexterm>
<function>div</function> ( <parameter>y</parameter> <type>numeric</type>,
<parameter>x</parameter> <type>numeric</type> )
<returnvalue>numeric</returnvalue>
- <?br?>
+ </para>
+ <para>
Integer quotient of <parameter>y</parameter>/<parameter>x</parameter>
(truncates towards zero)
- <?br?>
+ </para>
+ <para>
<literal>div(9,4)</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>exp</primary>
</indexterm>
- <function>exp</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>exp</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>exp</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Exponential (<literal>e</literal> raised to the given power)
- <?br?>
+ </para>
+ <para>
<literal>exp(1.0)</literal>
<returnvalue>2.7182818284590452</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>floor</primary>
</indexterm>
- <function>floor</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>floor</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>floor</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Nearest integer less than or equal to argument
- <?br?>
+ </para>
+ <para>
<literal>floor(42.8)</literal>
<returnvalue>42</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>floor(-42.8)</literal>
<returnvalue>-43</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>gcd</primary>
</indexterm>
<function>gcd</function> ( <replaceable>numeric_type</replaceable>, <replaceable>numeric_type</replaceable> )
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Greatest common divisor (the largest positive number that divides both
inputs with no remainder); returns <literal>0</literal> if both inputs
are zero; available for <type>integer</type>, <type>bigint</type>,
and <type>numeric</type>
- <?br?>
+ </para>
+ <para>
<literal>gcd(1071, 462)</literal>
<returnvalue>21</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>lcm</primary>
</indexterm>
<function>lcm</function> ( <replaceable>numeric_type</replaceable>, <replaceable>numeric_type</replaceable> )
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Least common multiple (the smallest strictly positive number that is
an integral multiple of both inputs); returns <literal>0</literal> if
either input is zero; available for <type>integer</type>,
<type>bigint</type>, and <type>numeric</type>
- <?br?>
+ </para>
+ <para>
<literal>lcm(1071, 462)</literal>
<returnvalue>23562</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ln</primary>
</indexterm>
- <function>ln</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>ln</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>ln</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Natural logarithm
- <?br?>
+ </para>
+ <para>
<literal>ln(2.0)</literal>
<returnvalue>0.6931471805599453</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>log</primary>
</indexterm>
- <function>log</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>log</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>log</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Base 10 logarithm
- <?br?>
+ </para>
+ <para>
<literal>log(100)</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>log10</primary>
</indexterm>
- <function>log10</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>log10</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>log10</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Base 10 logarithm (same as <function>log</function>)
- <?br?>
+ </para>
+ <para>
<literal>log10(1000)</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>log</function> ( <parameter>b</parameter> <type>numeric</type>,
<parameter>x</parameter> <type>numeric</type> )
<returnvalue>numeric</returnvalue>
- <?br?>
+ </para>
+ <para>
Logarithm of <parameter>x</parameter> to base <parameter>b</parameter>
- <?br?>
+ </para>
+ <para>
<literal>log(2.0, 64.0)</literal>
<returnvalue>6.0000000000</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>min_scale</primary>
</indexterm>
<function>min_scale</function> ( <type>numeric</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Minimum scale (number of fractional decimal digits) needed
to represent the supplied value precisely
- <?br?>
+ </para>
+ <para>
<literal>min_scale(8.4100)</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>mod</primary>
</indexterm>
<function>mod</function> ( <parameter>y</parameter> <replaceable>numeric_type</replaceable>,
<parameter>x</parameter> <replaceable>numeric_type</replaceable> )
<returnvalue><replaceable>numeric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Remainder of <parameter>y</parameter>/<parameter>x</parameter>;
available for <type>smallint</type>, <type>integer</type>,
<type>bigint</type>, and <type>numeric</type>
- <?br?>
+ </para>
+ <para>
<literal>mod(9,4)</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pi</primary>
</indexterm>
<function>pi</function> ( )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Approximate value of <phrase role="symbol_font">π</phrase>
- <?br?>
+ </para>
+ <para>
<literal>pi()</literal>
<returnvalue>3.141592653589793</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>power</primary>
</indexterm>
- <function>power</function> ( <parameter>a</parameter> <replaceable>numeric_or_dp</replaceable>,
- <parameter>b</parameter> <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>power</function> ( <parameter>a</parameter> <type>numeric</type>,
+ <parameter>b</parameter> <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>power</function> ( <parameter>a</parameter> <type>double precision</type>,
+ <parameter>b</parameter> <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
<parameter>a</parameter> raised to the power of <parameter>b</parameter>
- <?br?>
+ </para>
+ <para>
<literal>power(9, 3)</literal>
<returnvalue>729</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>radians</primary>
</indexterm>
<function>radians</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts degrees to radians
- <?br?>
+ </para>
+ <para>
<literal>radians(45.0)</literal>
<returnvalue>0.7853981633974483</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>round</primary>
</indexterm>
- <function>round</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>round</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>round</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Rounds to nearest integer
- <?br?>
+ </para>
+ <para>
<literal>round(42.4)</literal>
<returnvalue>42</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>round</function> ( <parameter>v</parameter> <type>numeric</type>, <parameter>s</parameter> <type>integer</type> )
<returnvalue>numeric</returnvalue>
- <?br?>
+ </para>
+ <para>
Rounds <parameter>v</parameter> to <parameter>s</parameter> decimal
places
- <?br?>
+ </para>
+ <para>
<literal>round(42.4382, 2)</literal>
<returnvalue>42.44</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>scale</primary>
</indexterm>
<function>scale</function> ( <type>numeric</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Scale of the argument (the number of decimal digits in the fractional part)
- <?br?>
+ </para>
+ <para>
<literal>scale(8.4100)</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sign</primary>
</indexterm>
- <function>sign</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>sign</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>sign</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Sign of the argument (-1, 0, or +1)
- <?br?>
+ </para>
+ <para>
<literal>sign(-8.4)</literal>
<returnvalue>-1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sqrt</primary>
</indexterm>
- <function>sqrt</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>sqrt</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>sqrt</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Square root
- <?br?>
+ </para>
+ <para>
<literal>sqrt(2)</literal>
<returnvalue>1.4142135623730951</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>trim_scale</primary>
</indexterm>
<function>trim_scale</function> ( <type>numeric</type> )
<returnvalue>numeric</returnvalue>
- <?br?>
+ </para>
+ <para>
Reduces the value's scale (number of fractional decimal digits) by
removing trailing zeroes
- <?br?>
+ </para>
+ <para>
<literal>trim_scale(8.4100)</literal>
<returnvalue>8.41</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>trunc</primary>
</indexterm>
- <function>trunc</function> ( <replaceable>numeric_or_dp</replaceable> )
- <returnvalue><replaceable>numeric_or_dp</replaceable></returnvalue>
- <?br?>
+ <function>trunc</function> ( <type>numeric</type> )
+ <returnvalue>numeric</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>trunc</function> ( <type>double precision</type> )
+ <returnvalue>double precision</returnvalue>
+ </para>
+ <para>
Truncates to integer (towards zero)
- <?br?>
+ </para>
+ <para>
<literal>trunc(42.8)</literal>
<returnvalue>42</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>trunc(-42.8)</literal>
<returnvalue>-42</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>trunc</function> ( <parameter>v</parameter> <type>numeric</type>, <parameter>s</parameter> <type>integer</type> )
<returnvalue>numeric</returnvalue>
- <?br?>
+ </para>
+ <para>
Truncates <parameter>v</parameter> to <parameter>s</parameter>
decimal places
- <?br?>
+ </para>
+ <para>
<literal>trunc(42.4382, 2)</literal>
<returnvalue>42.43</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>width_bucket</primary>
</indexterm>
- <function>width_bucket</function> ( <parameter>operand</parameter> <replaceable>numeric_or_dp</replaceable>, <parameter>low</parameter> <replaceable>numeric_or_dp</replaceable>, <parameter>high</parameter> <replaceable>numeric_or_dp</replaceable>, <parameter>count</parameter> <type>integer</type> )
+ <function>width_bucket</function> ( <parameter>operand</parameter> <type>numeric</type>, <parameter>low</parameter> <type>numeric</type>, <parameter>high</parameter> <type>numeric</type>, <parameter>count</parameter> <type>integer</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para role="func_signature">
+ <function>width_bucket</function> ( <parameter>operand</parameter> <type>double precision</type>, <parameter>low</parameter> <type>double precision</type>, <parameter>high</parameter> <type>double precision</type>, <parameter>count</parameter> <type>integer</type> )
+ <returnvalue>integer</returnvalue>
+ </para>
+ <para>
Returns the number of the bucket in
which <parameter>operand</parameter> falls in a histogram
having <parameter>count</parameter> equal-width buckets spanning the
Returns <literal>0</literal>
or <literal><parameter>count</parameter>+1</literal> for an input
outside that range.
- <?br?>
+ </para>
+ <para>
<literal>width_bucket(5.35, 0.024, 10.06, 5)</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>width_bucket</function> ( <parameter>operand</parameter> <type>anyelement</type>, <parameter>thresholds</parameter> <type>anyarray</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of the bucket in
which <parameter>operand</parameter> falls given an array listing the
lower bounds of the buckets. Returns <literal>0</literal> for an
The <parameter>thresholds</parameter> array <emphasis>must be
sorted</emphasis>, smallest first, or unexpected results will be
obtained.
- <?br?>
+ </para>
+ <para>
<literal>width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[])</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>random</primary>
</indexterm>
<function>random</function> ( )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns a random value in the range 0.0 <= x < 1.0
- <?br?>
+ </para>
+ <para>
<literal>random()</literal>
<returnvalue>0.897124072839091</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>setseed</primary>
</indexterm>
<function>setseed</function> ( <type>double precision</type> )
<returnvalue>void</returnvalue>
- <?br?>
+ </para>
+ <para>
Sets the seed for subsequent <literal>random()</literal> calls;
argument must be between -1.0 and 1.0, inclusive
- <?br?>
+ </para>
+ <para>
<literal>setseed(0.12345)</literal>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>acos</primary>
</indexterm>
<function>acos</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse cosine, result in radians
- <?br?>
+ </para>
+ <para>
<literal>acos(1)</literal>
<returnvalue>0</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>acosd</primary>
</indexterm>
<function>acosd</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse cosine, result in degrees
- <?br?>
+ </para>
+ <para>
<literal>acosd(0.5)</literal>
<returnvalue>60</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>asin</primary>
</indexterm>
<function>asin</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse sine, result in radians
- <?br?>
+ </para>
+ <para>
<literal>asin(1)</literal>
<returnvalue>1.5707963267948966</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>asind</primary>
</indexterm>
<function>asind</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse sine, result in degrees
- <?br?>
+ </para>
+ <para>
<literal>asind(0.5)</literal>
<returnvalue>30</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>atan</primary>
</indexterm>
<function>atan</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse tangent, result in radians
- <?br?>
+ </para>
+ <para>
<literal>atan(1)</literal>
<returnvalue>0.7853981633974483</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>atand</primary>
</indexterm>
<function>atand</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse tangent, result in degrees
- <?br?>
+ </para>
+ <para>
<literal>atand(1)</literal>
<returnvalue>45</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>atan2</primary>
</indexterm>
<function>atan2</function> ( <replaceable>y</replaceable> <type>double precision</type>,
<replaceable>x</replaceable> <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse tangent of
<replaceable>y</replaceable>/<replaceable>x</replaceable>,
result in radians
- <?br?>
+ </para>
+ <para>
<literal>atan2(1,0)</literal>
<returnvalue>1.5707963267948966</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>atan2d</primary>
</indexterm>
<function>atan2d</function> ( <replaceable>y</replaceable> <type>double precision</type>,
<replaceable>x</replaceable> <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse tangent of
<replaceable>y</replaceable>/<replaceable>x</replaceable>,
result in degrees
- <?br?>
+ </para>
+ <para>
<literal>atan2d(1,0)</literal>
<returnvalue>90</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>cos</primary>
</indexterm>
<function>cos</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Cosine, argument in radians
- <?br?>
+ </para>
+ <para>
<literal>cos(0)</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>cosd</primary>
</indexterm>
<function>cosd</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Cosine, argument in degrees
- <?br?>
+ </para>
+ <para>
<literal>cosd(60)</literal>
<returnvalue>0.5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>cot</primary>
</indexterm>
<function>cot</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Cotangent, argument in radians
- <?br?>
+ </para>
+ <para>
<literal>cot(0.5)</literal>
<returnvalue>1.830487721712452</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>cotd</primary>
</indexterm>
<function>cotd</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Cotangent, argument in degrees
- <?br?>
+ </para>
+ <para>
<literal>cotd(45)</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sin</primary>
</indexterm>
<function>sin</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Sine, argument in radians
- <?br?>
+ </para>
+ <para>
<literal>sin(1)</literal>
<returnvalue>0.8414709848078965</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sind</primary>
</indexterm>
<function>sind</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Sine, argument in degrees
- <?br?>
+ </para>
+ <para>
<literal>sind(30)</literal>
<returnvalue>0.5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>tan</primary>
</indexterm>
<function>tan</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Tangent, argument in radians
- <?br?>
+ </para>
+ <para>
<literal>tan(1)</literal>
<returnvalue>1.5574077246549023</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>tand</primary>
</indexterm>
<function>tand</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Tangent, argument in degrees
- <?br?>
+ </para>
+ <para>
<literal>tand(45)</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sinh</primary>
</indexterm>
<function>sinh</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Hyperbolic sine
- <?br?>
+ </para>
+ <para>
<literal>sinh(1)</literal>
<returnvalue>1.1752011936438014</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>cosh</primary>
</indexterm>
<function>cosh</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Hyperbolic cosine
- <?br?>
+ </para>
+ <para>
<literal>cosh(0)</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>tanh</primary>
</indexterm>
<function>tanh</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Hyperbolic tangent
- <?br?>
+ </para>
+ <para>
<literal>tanh(1)</literal>
<returnvalue>0.7615941559557649</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>asinh</primary>
</indexterm>
<function>asinh</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse hyperbolic sine
- <?br?>
+ </para>
+ <para>
<literal>asinh(1)</literal>
<returnvalue>0.881373587019543</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>acosh</primary>
</indexterm>
<function>acosh</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse hyperbolic cosine
- <?br?>
+ </para>
+ <para>
<literal>acosh(1)</literal>
<returnvalue>0</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>atanh</primary>
</indexterm>
<function>atanh</function> ( <type>double precision</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Inverse hyperbolic tangent
- <?br?>
+ </para>
+ <para>
<literal>atanh(0.5)</literal>
<returnvalue>0.5493061443340548</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function/Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function/Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>character string</primary>
<secondary>concatenation</secondary>
</indexterm>
<type>text</type> <literal>||</literal> <type>text</type>
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Concatenates the two strings.
- <?br?>
+ </para>
+ <para>
<literal>'Post' || 'greSQL'</literal>
<returnvalue>PostgreSQL</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>||</literal> <type>anynonarray</type>
- or <type>anynonarray</type> <literal>||</literal> <type>text</type>
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para role="func_signature">
+ <type>anynonarray</type> <literal>||</literal> <type>text</type>
+ <returnvalue>text</returnvalue>
+ </para>
+ <para>
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 <literal>||</literal>
operators. If you want to concatenate an array's text equivalent,
cast it to <type>text</type> explicitly.)
- <?br?>
+ </para>
+ <para>
<literal>'Value: ' || 42</literal>
<returnvalue>Value: 42</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>normalized</primary>
</indexterm>
</indexterm>
<type>text</type> <literal>IS</literal> <optional><literal>NOT</literal></optional> <optional><parameter>form</parameter></optional> <literal>NORMALIZED</literal>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Checks whether the string is in the specified Unicode normalization
form. The optional <parameter>form</parameter> key word specifies the
form: <literal>NFC</literal> (the default), <literal>NFD</literal>,
only be used when the server encoding is <literal>UTF8</literal>. Note
that checking for normalization using this expression is often faster
than normalizing possibly already normalized strings.
- <?br?>
+ </para>
+ <para>
<literal>U&'\0061\0308bc' IS NFD NORMALIZED</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>bit_length</primary>
</indexterm>
<function>bit_length</function> ( <type>text</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns number of bits in the string (8
times the <function>octet_length</function>).
- <?br?>
+ </para>
+ <para>
<literal>bit_length('jose')</literal>
<returnvalue>32</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>char_length</primary>
</indexterm>
<see>character string, length</see>
</indexterm>
<function>char_length</function> ( <type>text</type> )
- or <function>character_length</function> ( <type>text</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para role="func_signature">
+ <indexterm>
+ <primary>character_length</primary>
+ </indexterm>
+ <function>character_length</function> ( <type>text</type> )
+ <returnvalue>integer</returnvalue>
+ </para>
+ <para>
Returns number of characters in the string.
- <?br?>
+ </para>
+ <para>
<literal>char_length('josé')</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>lower</primary>
</indexterm>
<function>lower</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts the string to all lower case, according to the rules of the
database's locale.
- <?br?>
+ </para>
+ <para>
<literal>lower('TOM')</literal>
<returnvalue>tom</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>normalize</primary>
</indexterm>
<function>normalize</function> ( <type>text</type>
<optional>, <parameter>form</parameter> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts the string to the specified Unicode
normalization form. The optional <parameter>form</parameter> key word
specifies the form: <literal>NFC</literal> (the default),
<literal>NFD</literal>, <literal>NFKC</literal>, or
<literal>NFKD</literal>. This function can only be used when the
server encoding is <literal>UTF8</literal>.
- <?br?>
+ </para>
+ <para>
<literal>normalize(U&'\0061\0308bc', NFC)</literal>
<returnvalue>U&'\00E4bc'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>octet_length</primary>
</indexterm>
<function>octet_length</function> ( <type>text</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns number of bytes in the string.
- <?br?>
+ </para>
+ <para>
<literal>octet_length('josé')</literal>
<returnvalue>5</returnvalue> (if server encoding is UTF8)
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>octet_length</primary>
</indexterm>
<function>octet_length</function> ( <type>character</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns number of bytes in the string. Since this version of the
function accepts type <type>character</type> directly, it will not
strip trailing spaces.
- <?br?>
+ </para>
+ <para>
<literal>octet_length('abc '::character(4))</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>overlay</primary>
</indexterm>
<function>overlay</function> ( <parameter>string</parameter> <type>text</type> <literal>PLACING</literal> <parameter>newsubstring</parameter> <type>text</type> <literal>FROM</literal> <parameter>start</parameter> <type>integer</type> <optional> <literal>FOR</literal> <parameter>count</parameter> <type>integer</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Replaces the substring of <parameter>string</parameter> that starts at
the <parameter>start</parameter>'th character and extends
for <parameter>count</parameter> characters
with <parameter>newsubstring</parameter>.
If <parameter>count</parameter> is omitted, it defaults to the length
of <parameter>newsubstring</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>overlay('Txxxxas' placing 'hom' from 2 for 4)</literal>
<returnvalue>Thomas</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>position</primary>
</indexterm>
<function>position</function> ( <parameter>substring</parameter> <type>text</type> <literal>IN</literal> <parameter>string</parameter> <type>text</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns starting index of specified <parameter>substring</parameter>
within <parameter>string</parameter>, or zero if it's not present.
- <?br?>
+ </para>
+ <para>
<literal>position('om' in 'Thomas')</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>substring</primary>
</indexterm>
<function>substring</function> ( <parameter>string</parameter> <type>text</type> <optional> <literal>FROM</literal> <parameter>start</parameter> <type>integer</type> </optional> <optional> <literal>FOR</literal> <parameter>count</parameter> <type>integer</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts the substring of <parameter>string</parameter> starting at
the <parameter>start</parameter>'th character if that is specified,
and stopping after <parameter>count</parameter> characters if that is
specified. Provide at least one of <parameter>start</parameter>
and <parameter>count</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>substring('Thomas' from 2 for 3)</literal>
<returnvalue>hom</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>substring('Thomas' from 3)</literal>
<returnvalue>omas</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>substring('Thomas' for 2)</literal>
<returnvalue>Th</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>substring</function> ( <parameter>string</parameter> <type>text</type> <literal>FROM</literal> <replaceable>pattern</replaceable> <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts substring matching POSIX regular expression; see
<xref linkend="functions-posix-regexp"/>.
- <?br?>
+ </para>
+ <para>
<literal>substring('Thomas' from '...$')</literal>
<returnvalue>mas</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>substring</function> ( <parameter>string</parameter> <type>text</type> <literal>FROM</literal> <replaceable>pattern</replaceable> <type>text</type> <literal>FOR</literal> <replaceable>escape</replaceable> <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts substring matching <acronym>SQL</acronym> regular expression;
see <xref linkend="functions-similarto-regexp"/>.
- <?br?>
+ </para>
+ <para>
<literal>substring('Thomas' from '%#"o_a#"_' for '#')</literal>
<returnvalue>oma</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>trim</primary>
</indexterm>
<optional> <parameter>characters</parameter> <type>text</type> </optional> <literal>FROM</literal>
<parameter>string</parameter> <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes the longest string containing only characters in
<parameter>characters</parameter> (a space by default) from the
start, end, or both ends (<literal>BOTH</literal> is the default)
of <parameter>string</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>trim(both 'xyz' from 'yxTomxx')</literal>
<returnvalue>Tom</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>trim</function> ( <optional> <literal>LEADING</literal> | <literal>TRAILING</literal> | <literal>BOTH</literal> </optional> <optional> <literal>FROM</literal> </optional>
<parameter>string</parameter> <type>text</type> <optional>,
<parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
This is a non-standard syntax for <function>trim()</function>.
- <?br?>
+ </para>
+ <para>
<literal>trim(both from 'yxTomxx', 'xyz')</literal>
<returnvalue>Tom</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>upper</primary>
</indexterm>
<function>upper</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts the string to all upper case, according to the rules of the
database's locale.
- <?br?>
+ </para>
+ <para>
<literal>upper('tom')</literal>
<returnvalue>TOM</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ascii</primary>
</indexterm>
<function>ascii</function> ( <type>text</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the numeric code of the first character of the argument.
In <acronym>UTF8</acronym> encoding, returns the Unicode code point
of the character. In other multibyte encodings, the argument must
be an <acronym>ASCII</acronym> character.
- <?br?>
+ </para>
+ <para>
<literal>ascii('x')</literal>
<returnvalue>120</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>btrim</primary>
</indexterm>
<function>btrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes the longest string containing only characters
in <parameter>characters</parameter> (a space by default)
from the start and end of <parameter>string</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>btrim('xyxtrimyyx', 'xyz')</literal>
<returnvalue>trim</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>chr</primary>
</indexterm>
<function>chr</function> ( <type>integer</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the character with the given code. In <acronym>UTF8</acronym>
encoding the argument is treated as a Unicode code point. In other
multibyte encodings the argument must designate
an <acronym>ASCII</acronym> character. <literal>chr(0)</literal> is
disallowed because text data types cannot store that character.
- <?br?>
+ </para>
+ <para>
<literal>chr(65)</literal>
<returnvalue>A</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>concat</primary>
</indexterm>
<function>concat</function> ( <parameter>val1</parameter> <type>"any"</type>
[, <parameter>val2</parameter> <type>"any"</type> [, ...] ] )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Concatenates the text representations of all the arguments.
NULL arguments are ignored.
- <?br?>
+ </para>
+ <para>
<literal>concat('abcde', 2, NULL, 22)</literal>
<returnvalue>abcde222</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>concat_ws</primary>
</indexterm>
<parameter>val1</parameter> <type>"any"</type>
[, <parameter>val2</parameter> <type>"any"</type> [, ...] ] )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
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.
- <?br?>
+ </para>
+ <para>
<literal>concat_ws(',', 'abcde', 2, NULL, 22)</literal>
<returnvalue>abcde,2,22</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>format</primary>
</indexterm>
<function>format</function> ( <parameter>formatstr</parameter> <type>text</type>
[, <parameter>formatarg</parameter> <type>"any"</type> [, ...] ] )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Formats arguments according to a format string;
see <xref linkend="functions-string-format"/>.
This function is similar to the C function <function>sprintf</function>.
- <?br?>
+ </para>
+ <para>
<literal>format('Hello %s, %1$s', 'World')</literal>
<returnvalue>Hello World, World</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>initcap</primary>
</indexterm>
<function>initcap</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
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.
- <?br?>
+ </para>
+ <para>
<literal>initcap('hi THOMAS')</literal>
<returnvalue>Hi Thomas</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>left</primary>
</indexterm>
<function>left</function> ( <parameter>string</parameter> <type>text</type>,
<parameter>n</parameter> <type>integer</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns first <replaceable>n</replaceable> characters in the
string, or when <replaceable>n</replaceable> is negative, returns
all but last |<replaceable>n</replaceable>| characters.
- <?br?>
+ </para>
+ <para>
<literal>left('abcde', 2)</literal>
<returnvalue>ab</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>length</primary>
</indexterm>
<function>length</function> ( <type>text</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of characters in the string.
- <?br?>
+ </para>
+ <para>
<literal>length('jose')</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>lpad</primary>
</indexterm>
<parameter>length</parameter> <type>integer</type>
<optional>, <parameter>fill</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Extends the <parameter>string</parameter> to length
<parameter>length</parameter> by prepending the characters
<parameter>fill</parameter> (a space by default). If the
<parameter>string</parameter> is already longer than
<parameter>length</parameter> then it is truncated (on the right).
- <?br?>
+ </para>
+ <para>
<literal>lpad('hi', 5, 'xy')</literal>
<returnvalue>xyxhi</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ltrim</primary>
</indexterm>
<function>ltrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes the longest string containing only characters in
<parameter>characters</parameter> (a space by default) from the start of
<parameter>string</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>ltrim('zzzytest', 'xyz')</literal>
<returnvalue>test</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>md5</primary>
</indexterm>
<function>md5</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the MD5 <link linkend="functions-hash-note">hash</link> of
the argument, with the result written in hexadecimal.
- <?br?>
+ </para>
+ <para>
<literal>md5('abc')</literal>
<returnvalue>900150983cd24fb0&zwsp;d6963f7d28e17f72</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>parse_ident</primary>
</indexterm>
<function>parse_ident</function> ( <parameter>qualified_identifier</parameter> <type>text</type>
[, <parameter>strict_mode</parameter> <type>boolean</type> <literal>DEFAULT</literal> <literal>true</literal> ] )
<returnvalue>text[]</returnvalue>
- <?br?>
+ </para>
+ <para>
Splits <parameter>qualified_identifier</parameter> into an array of
identifiers, removing any quoting of individual identifiers. By
default, extra characters after the last identifier are considered an
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 <type>name[]</type>.
- <?br?>
+ </para>
+ <para>
<literal>parse_ident('"SomeSchema".someTable')</literal>
<returnvalue>{SomeSchema,sometable}</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pg_client_encoding</primary>
</indexterm>
<function>pg_client_encoding</function> ( )
<returnvalue>name</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns current client encoding name.
- <?br?>
+ </para>
+ <para>
<literal>pg_client_encoding()</literal>
<returnvalue>UTF8</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>quote_ident</primary>
</indexterm>
<function>quote_ident</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the given string suitably quoted to be used as an identifier
in an <acronym>SQL</acronym> 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 <xref linkend="plpgsql-quote-literal-example"/>.
- <?br?>
+ </para>
+ <para>
<literal>quote_ident('Foo bar')</literal>
<returnvalue>"Foo bar"</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>quote_literal</primary>
</indexterm>
<function>quote_literal</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the given string suitably quoted to be used as a string literal
in an <acronym>SQL</acronym> statement string.
Embedded single-quotes and backslashes are properly doubled.
input; if the argument might be null,
<function>quote_nullable</function> is often more suitable.
See also <xref linkend="plpgsql-quote-literal-example"/>.
- <?br?>
+ </para>
+ <para>
<literal>quote_literal(E'O\'Reilly')</literal>
<returnvalue>'O''Reilly'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>quote_literal</function> ( <type>anyelement</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts the given value to text and then quotes it as a literal.
Embedded single-quotes and backslashes are properly doubled.
- <?br?>
+ </para>
+ <para>
<literal>quote_literal(42.5)</literal>
<returnvalue>'42.5'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>quote_nullable</primary>
</indexterm>
<function>quote_nullable</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the given string suitably quoted to be used as a string literal
in an <acronym>SQL</acronym> statement string; or, if the argument
is null, returns <literal>NULL</literal>.
Embedded single-quotes and backslashes are properly doubled.
See also <xref linkend="plpgsql-quote-literal-example"/>.
- <?br?>
+ </para>
+ <para>
<literal>quote_nullable(NULL)</literal>
<returnvalue>NULL</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>quote_nullable</function> ( <type>anyelement</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts the given value to text and then quotes it as a literal;
or, if the argument is null, returns <literal>NULL</literal>.
Embedded single-quotes and backslashes are properly doubled.
- <?br?>
+ </para>
+ <para>
<literal>quote_nullable(42.5)</literal>
<returnvalue>'42.5'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>regexp_match</primary>
</indexterm>
<function>regexp_match</function> ( <parameter>string</parameter> <type>text</type>, <parameter>pattern</parameter> <type>text</type> [, <parameter>flags</parameter> <type>text</type> ] )
<returnvalue>text[]</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns captured substring(s) resulting from the first match of a POSIX
regular expression to the <parameter>string</parameter>; see
<xref linkend="functions-posix-regexp"/>.
- <?br?>
+ </para>
+ <para>
<literal>regexp_match('foobarbequebaz', '(bar)(beque)')</literal>
<returnvalue>{bar,beque}</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>regexp_matches</primary>
</indexterm>
<function>regexp_matches</function> ( <parameter>string</parameter> <type>text</type>, <parameter>pattern</parameter> <type>text</type> [, <parameter>flags</parameter> <type>text</type> ] )
<returnvalue>setof text[]</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns captured substring(s) resulting from matching a POSIX regular
expression to the <parameter>string</parameter>; see
<xref linkend="functions-posix-regexp"/>.
- <?br?>
+ </para>
+ <para>
<literal>regexp_matches('foobarbequebaz', 'ba.', 'g')</literal>
- <returnvalue>{bar}<?br?>{baz}</returnvalue><?br?>(2 rows in result)
- </entry>
+ <returnvalue></returnvalue>
+<programlisting>
+ {bar}
+ {baz}
+</programlisting>
+ (2 rows in result)
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>regexp_replace</primary>
</indexterm>
<function>regexp_replace</function> ( <parameter>string</parameter> <type>text</type>, <parameter>pattern</parameter> <type>text</type>, <parameter>replacement</parameter> <type>text</type> [, <parameter>flags</parameter> <type>text</type> ] )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Replaces substring(s) matching a POSIX regular expression; see
<xref linkend="functions-posix-regexp"/>.
- <?br?>
+ </para>
+ <para>
<literal>regexp_replace('Thomas', '.[mN]a.', 'M')</literal>
<returnvalue>ThM</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>regexp_split_to_array</primary>
</indexterm>
<function>regexp_split_to_array</function> ( <parameter>string</parameter> <type>text</type>, <parameter>pattern</parameter> <type>text</type> [, <parameter>flags</parameter> <type>text</type> ] )
<returnvalue>text[]</returnvalue>
- <?br?>
+ </para>
+ <para>
Splits <parameter>string</parameter> using a POSIX regular
expression as the delimiter; see
<xref linkend="functions-posix-regexp"/>.
- <?br?>
+ </para>
+ <para>
<literal>regexp_split_to_array('hello world', '\s+')</literal>
<returnvalue>{hello,world}</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>regexp_split_to_table</primary>
</indexterm>
<function>regexp_split_to_table</function> ( <parameter>string</parameter> <type>text</type>, <parameter>pattern</parameter> <type>text</type> [, <parameter>flags</parameter> <type>text</type> ] )
<returnvalue>setof text</returnvalue>
- <?br?>
+ </para>
+ <para>
Splits <parameter>string</parameter> using a POSIX regular
expression as the delimiter; see
<xref linkend="functions-posix-regexp"/>.
- <?br?>
+ </para>
+ <para>
<literal>regexp_split_to_table('hello world', '\s+')</literal>
- <returnvalue>hello<?br?>world</returnvalue><?br?>(2 rows in result)
- </entry>
+ <returnvalue></returnvalue>
+<programlisting>
+ hello
+ world
+</programlisting>
+ (2 rows in result)
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>repeat</primary>
</indexterm>
<function>repeat</function> ( <parameter>string</parameter> <type>text</type>, <parameter>number</parameter> <type>integer</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Repeats <parameter>string</parameter> the specified
<parameter>number</parameter> of times.
- <?br?>
+ </para>
+ <para>
<literal>repeat('Pg', 4)</literal>
<returnvalue>PgPgPgPg</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>replace</primary>
</indexterm>
<parameter>from</parameter> <type>text</type>,
<parameter>to</parameter> <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Replaces all occurrences in <parameter>string</parameter> of
substring <parameter>from</parameter> with
substring <parameter>to</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>replace('abcdefabcdef', 'cd', 'XX')</literal>
<returnvalue>abXXefabXXef</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>reverse</primary>
</indexterm>
<function>reverse</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Reverses the order of the characters in the string.
- <?br?>
+ </para>
+ <para>
<literal>reverse('abcde')</literal>
<returnvalue>edcba</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>right</primary>
</indexterm>
<parameter>n</parameter> <type>integer</type> )
<type></type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns last <replaceable>n</replaceable> characters in the string,
or when <replaceable>n</replaceable> is negative, returns all but
first |<replaceable>n</replaceable>| characters.
- <?br?>
+ </para>
+ <para>
<literal>right('abcde', 2)</literal>
<returnvalue>de</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>rpad</primary>
</indexterm>
<optional>, <parameter>fill</parameter> <type>text</type> </optional> )
<type></type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Extends the <parameter>string</parameter> to length
<parameter>length</parameter> by appending the characters
<parameter>fill</parameter> (a space by default). If the
<parameter>string</parameter> is already longer than
<parameter>length</parameter> then it is truncated.
- <?br?>
+ </para>
+ <para>
<literal>rpad('hi', 5, 'xy')</literal>
<returnvalue>hixyx</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>rtrim</primary>
</indexterm>
<function>rtrim</function> ( <parameter>string</parameter> <type>text</type>
<optional>, <parameter>characters</parameter> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes the longest string containing only characters in
<parameter>characters</parameter> (a space by default) from the end of
<parameter>string</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>rtrim('testxxzx', 'xyz')</literal>
<returnvalue>test</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>split_part</primary>
</indexterm>
<parameter>delimiter</parameter> <type>text</type>,
<parameter>n</parameter> <type>integer</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Splits <parameter>string</parameter> at occurrences
of <parameter>delimiter</parameter> and returns
the <parameter>n</parameter>'th field (counting from one).
- <?br?>
+ </para>
+ <para>
<literal>split_part('abc~@~def~@~ghi', '~@~', 2)</literal>
<returnvalue>def</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>strpos</primary>
</indexterm>
<function>strpos</function> ( <parameter>string</parameter> <type>text</type>, <parameter>substring</parameter> <type>text</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns starting index of specified <parameter>substring</parameter>
within <parameter>string</parameter>, or zero if it's not present.
(Same as <literal>position(<parameter>substring</parameter> in
<parameter>string</parameter>)</literal>, but note the reversed
argument order.)
- <?br?>
+ </para>
+ <para>
<literal>strpos('high', 'ig')</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>substr</primary>
</indexterm>
<function>substr</function> ( <parameter>string</parameter> <type>text</type>, <parameter>start</parameter> <type>integer</type> <optional>, <parameter>count</parameter> <type>integer</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts the substring of <parameter>string</parameter> starting at
the <parameter>start</parameter>'th character,
and extending for <parameter>count</parameter> characters if that is
as <literal>substring(<parameter>string</parameter>
from <parameter>start</parameter>
for <parameter>count</parameter>)</literal>.)
- <?br?>
+ </para>
+ <para>
<literal>substr('alphabet', 3)</literal>
<returnvalue>phabet</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>substr('alphabet', 3, 2)</literal>
<returnvalue>ph</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>starts_with</primary>
</indexterm>
<function>starts_with</function> ( <parameter>string</parameter> <type>text</type>, <parameter>prefix</parameter> <type>text</type> )
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns true if <parameter>string</parameter> starts
with <parameter>prefix</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>starts_with('alphabet', 'alph')</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_ascii</primary>
</indexterm>
- <function>to_ascii</function> ( <parameter>string</parameter> <type>text</type>
- <optional>, <parameter>encoding</parameter> <type>name</type> or <type>integer</type> </optional> )
+ <function>to_ascii</function> ( <parameter>string</parameter> <type>text</type> )
+ <returnvalue>text</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>to_ascii</function> ( <parameter>string</parameter> <type>text</type>,
+ <parameter>encoding</parameter> <type>name</type> )
+ <returnvalue>text</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>to_ascii</function> ( <parameter>string</parameter> <type>text</type>,
+ <parameter>encoding</parameter> <type>integer</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts <parameter>string</parameter> to <acronym>ASCII</acronym>
- from another encoding, which may be identified by name or number;
- if <parameter>encoding</parameter> 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 <parameter>encoding</parameter> 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 <literal>LATIN1</literal>, <literal>LATIN2</literal>,
<literal>LATIN9</literal>, and <literal>WIN1250</literal> encodings.
- <?br?>
+ (See the <xref linkend="unaccent"/> module for another, more flexible
+ solution.)
+ </para>
+ <para>
<literal>to_ascii('Karél')</literal>
<returnvalue>Karel</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_hex</primary>
</indexterm>
- <function>to_hex</function> ( <parameter>number</parameter>
- <type>integer</type>
- or <type>bigint</type> )
+ <function>to_hex</function> ( <type>integer</type> )
+ <returnvalue>text</returnvalue>
+ </para>
+ <para role="func_signature">
+ <function>to_hex</function> ( <type>bigint</type> )
<returnvalue>text</returnvalue>
- <?br?>
- Converts <parameter>number</parameter> to its equivalent hexadecimal
- representation.
- <?br?>
+ </para>
+ <para>
+ Converts the number to its equivalent hexadecimal representation.
+ </para>
+ <para>
<literal>to_hex(2147483647)</literal>
<returnvalue>7fffffff</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>translate</primary>
</indexterm>
<parameter>from</parameter> <type>text</type>,
<parameter>to</parameter> <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Replaces each character in <parameter>string</parameter> that
matches a character in the <parameter>from</parameter> set with the
corresponding character in the <parameter>to</parameter>
set. If <parameter>from</parameter> is longer than
<parameter>to</parameter>, occurrences of the extra characters in
<parameter>from</parameter> are deleted.
- <?br?>
+ </para>
+ <para>
<literal>translate('12345', '143', 'ax')</literal>
<returnvalue>a2x5</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function/Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function/Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>binary string</primary>
<secondary>concatenation</secondary>
</indexterm>
<type>bytea</type> <literal>||</literal> <type>bytea</type>
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Concatenates the two binary strings.
- <?br?>
+ </para>
+ <para>
<literal>'\x123456'::bytea || '\x789a00bcde'::bytea</literal>
<returnvalue>\x123456789a00bcde</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>bit_length</primary>
</indexterm>
<function>bit_length</function> ( <type>bytea</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns number of bits in the binary string (8
times the <function>octet_length</function>).
- <?br?>
+ </para>
+ <para>
<literal>bit_length('\x123456'::bytea)</literal>
<returnvalue>24</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>octet_length</primary>
</indexterm>
<function>octet_length</function> ( <type>bytea</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns number of bytes in the binary string.
- <?br?>
+ </para>
+ <para>
<literal>octet_length('\x123456'::bytea)</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>overlay</primary>
</indexterm>
<function>overlay</function> ( <parameter>bytes</parameter> <type>bytea</type> <literal>PLACING</literal> <parameter>newsubstring</parameter> <type>bytea</type> <literal>FROM</literal> <parameter>start</parameter> <type>integer</type> <optional> <literal>FOR</literal> <parameter>count</parameter> <type>integer</type> </optional> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Replaces the substring of <parameter>bytes</parameter> that starts at
the <parameter>start</parameter>'th byte and extends
for <parameter>count</parameter> bytes
with <parameter>newsubstring</parameter>.
If <parameter>count</parameter> is omitted, it defaults to the length
of <parameter>newsubstring</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>overlay('\x1234567890'::bytea placing '\002\003'::bytea from 2 for 3)</literal>
<returnvalue>\x12020390</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>position</primary>
</indexterm>
<function>position</function> ( <parameter>substring</parameter> <type>bytea</type> <literal>IN</literal> <parameter>bytes</parameter> <type>bytea</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns starting index of specified <parameter>substring</parameter>
within <parameter>bytes</parameter>, or zero if it's not present.
- <?br?>
+ </para>
+ <para>
<literal>position('\x5678'::bytea in '\x1234567890'::bytea)</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>substring</primary>
</indexterm>
<function>substring</function> ( <parameter>bytes</parameter> <type>bytea</type> <optional> <literal>FROM</literal> <parameter>start</parameter> <type>integer</type> </optional> <optional> <literal>FOR</literal> <parameter>count</parameter> <type>integer</type> </optional> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts the substring of <parameter>bytes</parameter> starting at
the <parameter>start</parameter>'th byte if that is specified,
and stopping after <parameter>count</parameter> bytes if that is
specified. Provide at least one of <parameter>start</parameter>
and <parameter>count</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>substring('\x1234567890'::bytea from 3 for 2)</literal>
<returnvalue>\x5678</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>trim</primary>
</indexterm>
<parameter>bytesremoved</parameter> <type>bytea</type> <literal>FROM</literal>
<parameter>bytes</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes the longest string containing only bytes appearing in
<parameter>bytesremoved</parameter> from the start
and end of <parameter>bytes</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>trim('\x9012'::bytea from '\x1234567890'::bytea)</literal>
<returnvalue>\x345678</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>trim</function> ( <optional> <literal>BOTH</literal> </optional> <optional> <literal>FROM</literal> </optional>
<parameter>bytes</parameter> <type>bytea</type>,
<parameter>bytesremoved</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
This is a non-standard syntax for <function>trim()</function>.
- <?br?>
+ </para>
+ <para>
<literal>trim(both from '\x1234567890'::bytea, '\x9012'::bytea)</literal>
<returnvalue>\x345678</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>btrim</primary>
</indexterm>
<function>btrim</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>bytesremoved</parameter> <type>bytea</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes the longest string containing only bytes appearing in
<parameter>bytesremoved</parameter> from the start and end of
<parameter>bytes</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>btrim('\x1234567890'::bytea, '\x9012'::bytea)</literal>
<returnvalue>\x345678</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>get_bit</primary>
</indexterm>
<function>get_bit</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>n</parameter> <type>bigint</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts <link linkend="functions-zerobased-note">n'th</link> bit
from binary string.
- <?br?>
+ </para>
+ <para>
<literal>get_bit('\x1234567890'::bytea, 30)</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>get_byte</primary>
</indexterm>
<function>get_byte</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>n</parameter> <type>integer</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts <link linkend="functions-zerobased-note">n'th</link> byte
from binary string.
- <?br?>
+ </para>
+ <para>
<literal>get_byte('\x1234567890'::bytea, 4)</literal>
<returnvalue>144</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>length</primary>
</indexterm>
</indexterm>
<function>length</function> ( <type>bytea</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of bytes in the binary string.
- <?br?>
+ </para>
+ <para>
<literal>length('\x1234567890'::bytea)</literal>
<returnvalue>5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>length</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>encoding</parameter> <type>name</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of characters in the binary string, assuming
that it is text in the given <parameter>encoding</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>length('jose'::bytea, 'UTF8')</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>md5</primary>
</indexterm>
<function>md5</function> ( <type>bytea</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the MD5 <link linkend="functions-hash-note">hash</link> of
the binary string, with the result written in hexadecimal.
- <?br?>
+ </para>
+ <para>
<literal>md5('Th\000omas'::bytea)</literal>
<returnvalue>8ab2d3c9689aaf18&zwsp;b4958c334c82d8b1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>set_bit</primary>
</indexterm>
<parameter>n</parameter> <type>bigint</type>,
<parameter>newvalue</parameter> <type>integer</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Sets <link linkend="functions-zerobased-note">n'th</link> bit in
binary string to <parameter>newvalue</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>set_bit('\x1234567890'::bytea, 30, 0)</literal>
<returnvalue>\x1234563890</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>set_byte</primary>
</indexterm>
<parameter>n</parameter> <type>integer</type>,
<parameter>newvalue</parameter> <type>integer</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Sets <link linkend="functions-zerobased-note">n'th</link> byte in
binary string to <parameter>newvalue</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>set_byte('\x1234567890'::bytea, 4, 64)</literal>
<returnvalue>\x1234567840</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sha224</primary>
</indexterm>
<function>sha224</function> ( <type>bytea</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the SHA-224 <link linkend="functions-hash-note">hash</link>
of the binary string.
- <?br?>
+ </para>
+ <para>
<literal>sha224('abc'::bytea)</literal>
<returnvalue>\x23097d223405d8228642a477bda2&zwsp;55b32aadbce4bda0b3f7e36c9da7</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sha256</primary>
</indexterm>
<function>sha256</function> ( <type>bytea</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the SHA-256 <link linkend="functions-hash-note">hash</link>
of the binary string.
- <?br?>
+ </para>
+ <para>
<literal>sha256('abc'::bytea)</literal>
<returnvalue>\xba7816bf8f01cfea414140de5dae2223&zwsp;b00361a396177a9cb410ff61f20015ad</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sha384</primary>
</indexterm>
<function>sha384</function> ( <type>bytea</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the SHA-384 <link linkend="functions-hash-note">hash</link>
of the binary string.
- <?br?>
+ </para>
+ <para>
<literal>sha384('abc'::bytea)</literal>
<returnvalue>\xcb00753f45a35e8bb5a03d699ac65007&zwsp;272c32ab0eded1631a8b605a43ff5bed&zwsp;8086072ba1e7cc2358baeca134c825a7</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>sha512</primary>
</indexterm>
<function>sha512</function> ( <type>bytea</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the SHA-512 <link linkend="functions-hash-note">hash</link>
of the binary string.
- <?br?>
+ </para>
+ <para>
<literal>sha512('abc'::bytea)</literal>
<returnvalue>\xddaf35a193617abacc417349ae204131&zwsp;12e6fa4e89a97ea20a9eeee64b55d39a&zwsp;2192992a274fc1a836ba3c23a3feebbd&zwsp;454d4423643ce80e2a9ac94fa54ca49f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>substr</primary>
</indexterm>
<function>substr</function> ( <parameter>bytes</parameter> <type>bytea</type>, <parameter>start</parameter> <type>integer</type> <optional>, <parameter>count</parameter> <type>integer</type> </optional> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts the substring of <parameter>bytes</parameter> starting at
the <parameter>start</parameter>'th byte,
and extending for <parameter>count</parameter> bytes if that is
as <literal>substring(<parameter>bytes</parameter>
from <parameter>start</parameter>
for <parameter>count</parameter>)</literal>.)
- <?br?>
+ </para>
+ <para>
<literal>substr('\x1234567890'::bytea, 3, 2)</literal>
<returnvalue>\x5678</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>convert</primary>
</indexterm>
<parameter>src_encoding</parameter> <type>name</type>,
<parameter>dest_encoding</parameter> <type>name</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts a binary string representing text in
encoding <parameter>src_encoding</parameter>
to a binary string in encoding <parameter>dest_encoding</parameter>
(see <xref linkend="multibyte-conversions-supported"/> for
available conversions).
- <?br?>
+ </para>
+ <para>
<literal>convert('text_in_utf8', 'UTF8', 'LATIN1')</literal>
<returnvalue>\x746578745f696e5f75746638</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>convert_from</primary>
</indexterm>
<function>convert_from</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>src_encoding</parameter> <type>name</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts a binary string representing text in
encoding <parameter>src_encoding</parameter>
to <type>text</type> in the database encoding
(see <xref linkend="multibyte-conversions-supported"/> for
available conversions).
- <?br?>
+ </para>
+ <para>
<literal>convert_from('text_in_utf8', 'UTF8')</literal>
<returnvalue>text_in_utf8</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>convert_to</primary>
</indexterm>
<function>convert_to</function> ( <parameter>string</parameter> <type>text</type>,
<parameter>dest_encoding</parameter> <type>name</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts a <type>text</type> string (in the database encoding) to a
binary string encoded in encoding <parameter>dest_encoding</parameter>
(see <xref linkend="multibyte-conversions-supported"/> for
available conversions).
- <?br?>
+ </para>
+ <para>
<literal>convert_to('some_text', 'UTF8')</literal>
<returnvalue>\x736f6d655f74657874</returnvalue>
- </entry>
+ </para></entry>
</row>
<row id="function-encode">
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>encode</primary>
</indexterm>
<function>encode</function> ( <parameter>bytes</parameter> <type>bytea</type>,
<parameter>format</parameter> <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Encodes binary data into a textual representation; supported
<parameter>format</parameter> values are:
<link linkend="encode-format-base64"><literal>base64</literal></link>,
<link linkend="encode-format-escape"><literal>escape</literal></link>,
<link linkend="encode-format-hex"><literal>hex</literal></link>.
- <?br?>
+ </para>
+ <para>
<literal>encode('123\000\001', 'base64')</literal>
<returnvalue>MTIzAAE=</returnvalue>
- </entry>
+ </para></entry>
</row>
<row id="function-decode">
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>decode</primary>
</indexterm>
<function>decode</function> ( <parameter>string</parameter> <type>text</type>,
<parameter>format</parameter> <type>text</type> )
<returnvalue>bytea</returnvalue>
- <?br?>
+ </para>
+ <para>
Decodes binary data from a textual representation; supported
<parameter>format</parameter> values are the same as
for <function>encode</function>.
- <?br?>
+ </para>
+ <para>
<literal>decode('MTIzAAE=', 'base64')</literal>
<returnvalue>\x3132330001</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>bit</type> <literal>||</literal> <type>bit</type>
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Concatenation
- <?br?>
+ </para>
+ <para>
<literal>B'10001' || B'011'</literal>
<returnvalue>10001011</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>bit</type> <literal>&</literal> <type>bit</type>
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise AND (inputs must be of equal length)
- <?br?>
+ </para>
+ <para>
<literal>B'10001' & B'01101'</literal>
<returnvalue>00001</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>bit</type> <literal>|</literal> <type>bit</type>
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise OR (inputs must be of equal length)
- <?br?>
+ </para>
+ <para>
<literal>B'10001' | B'01101'</literal>
<returnvalue>11101</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>bit</type> <literal>#</literal> <type>bit</type>
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise exclusive OR (inputs must be of equal length)
- <?br?>
+ </para>
+ <para>
<literal>B'10001' # B'01101'</literal>
<returnvalue>11100</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>~</literal> <type>bit</type>
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise NOT
- <?br?>
+ </para>
+ <para>
<literal>~ B'10001'</literal>
<returnvalue>01110</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>bit</type> <literal><<</literal> <type>integer</type>
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise shift left
(string length is preserved)
- <?br?>
+ </para>
+ <para>
<literal>B'10001' << 3</literal>
<returnvalue>01000</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>bit</type> <literal>>></literal> <type>integer</type>
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Bitwise shift right
(string length is preserved)
- <?br?>
+ </para>
+ <para>
<literal>B'10001' >> 2</literal>
<returnvalue>00100</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>bit_length</primary>
</indexterm>
<function>bit_length</function> ( <type>bit</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns number of bits in the bit string.
- <?br?>
+ </para>
+ <para>
<literal>bit_length(B'10111')</literal>
<returnvalue>5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>length</primary>
</indexterm>
</indexterm>
<function>length</function> ( <type>bit</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns number of bits in the bit string.
- <?br?>
+ </para>
+ <para>
<literal>length(B'10111')</literal>
<returnvalue>5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>octet_length</primary>
</indexterm>
<function>octet_length</function> ( <type>bit</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns number of bytes in the bit string.
- <?br?>
+ </para>
+ <para>
<literal>octet_length(B'1011111011')</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>overlay</primary>
</indexterm>
<function>overlay</function> ( <parameter>bits</parameter> <type>bit</type> <literal>PLACING</literal> <parameter>newsubstring</parameter> <type>bit</type> <literal>FROM</literal> <parameter>start</parameter> <type>integer</type> <optional> <literal>FOR</literal> <parameter>count</parameter> <type>integer</type> </optional> )
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Replaces the substring of <parameter>bits</parameter> that starts at
the <parameter>start</parameter>'th bit and extends
for <parameter>count</parameter> bits
with <parameter>newsubstring</parameter>.
If <parameter>count</parameter> is omitted, it defaults to the length
of <parameter>newsubstring</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>overlay(B'01010101010101010' placing B'11111' from 2 for 3)</literal>
<returnvalue>0111110101010101010</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>position</primary>
</indexterm>
<function>position</function> ( <parameter>substring</parameter> <type>bit</type> <literal>IN</literal> <parameter>bits</parameter> <type>bit</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns starting index of specified <parameter>substring</parameter>
within <parameter>bits</parameter>, or zero if it's not present.
- <?br?>
+ </para>
+ <para>
<literal>position(B'010' in B'000001101011')</literal>
<returnvalue>8</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>substring</primary>
</indexterm>
<function>substring</function> ( <parameter>bits</parameter> <type>bit</type> <optional> <literal>FROM</literal> <parameter>start</parameter> <type>integer</type> </optional> <optional> <literal>FOR</literal> <parameter>count</parameter> <type>integer</type> </optional> )
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts the substring of <parameter>bits</parameter> starting at
the <parameter>start</parameter>'th bit if that is specified,
and stopping after <parameter>count</parameter> bits if that is
specified. Provide at least one of <parameter>start</parameter>
and <parameter>count</parameter>.
- <?br?>
+ </para>
+ <para>
<literal>substring(B'110010111111' from 3 for 2)</literal>
<returnvalue>00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>get_bit</primary>
</indexterm>
<function>get_bit</function> ( <parameter>bits</parameter> <type>bit</type>,
<parameter>n</parameter> <type>integer</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts <parameter>n</parameter>'th bit
from bit string; the first (leftmost) bit is bit 0.
- <?br?>
+ </para>
+ <para>
<literal>get_bit(B'101010101010101010', 6)</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>set_bit</primary>
</indexterm>
<parameter>n</parameter> <type>integer</type>,
<parameter>newvalue</parameter> <type>integer</type> )
<returnvalue>bit</returnvalue>
- <?br?>
+ </para>
+ <para>
Sets <parameter>n</parameter>'th bit in
bit string to <parameter>newvalue</parameter>;
the first (leftmost) bit is bit 0.
- <?br?>
+ </para>
+ <para>
<literal>set_bit(B'101010101010101010', 6, 0)</literal>
<returnvalue>101010001010101010</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>~</literal> <type>text</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
String matches regular expression, case sensitively
- <?br?>
+ </para>
+ <para>
<literal>'thomas' ~ '.*thom.*'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>~*</literal> <type>text</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
String matches regular expression, case insensitively
- <?br?>
+ </para>
+ <para>
<literal>'thomas' ~* '.*Thom.*'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>!~</literal> <type>text</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
String does not match regular expression, case sensitively
- <?br?>
+ </para>
+ <para>
<literal>'thomas' !~ '.*thomas.*'</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>!~*</literal> <type>text</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
String does not match regular expression, case insensitively
- <?br?>
+ </para>
+ <para>
<literal>'thomas' !~* '.*vadim.*'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_char</primary>
</indexterm>
- <function>to_char</function> ( <type>timestamp</type> <optional><literal>with time zone</literal></optional>, <type>text</type> )
+ <function>to_char</function> ( <type>timestamp</type>, <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para role="func_signature">
+ <function>to_char</function> ( <type>timestamp with time zone</type>, <type>text</type> )
+ <returnvalue>text</returnvalue>
+ </para>
+ <para>
Converts time stamp to string according to the given format.
- <?br?>
+ </para>
+ <para>
<literal>to_char(timestamp '2002-04-20 17:31:12.66', 'HH12:MI:SS')</literal>
<returnvalue>05:31:12</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>to_char</function> ( <type>interval</type>, <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts interval to string according to the given format.
- <?br?>
+ </para>
+ <para>
<literal>to_char(interval '15h 2m 12s', 'HH24:MI:SS')</literal>
<returnvalue>15:02:12</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>to_char</function> ( <replaceable>numeric_type</replaceable>, <type>text</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts number to string according to the given format; available
for <type>integer</type>, <type>bigint</type>, <type>numeric</type>,
<type>real</type>, <type>double precision</type>.
- <?br?>
+ </para>
+ <para>
<literal>to_char(125, '999')</literal>
<returnvalue>125</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>to_char(125.8::real, '999D9')</literal>
<returnvalue>125.8</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>to_char(-125.8, '999D99S')</literal>
<returnvalue>125.80-</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_date</primary>
</indexterm>
<function>to_date</function> ( <type>text</type>, <type>text</type> )
<returnvalue>date</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts string to date according to the given format.
- <?br?>
+ </para>
+ <para>
<literal>to_date('05 Dec 2000', 'DD Mon YYYY')</literal>
<returnvalue>2000-12-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_number</primary>
</indexterm>
<function>to_number</function> ( <type>text</type>, <type>text</type> )
<returnvalue>numeric</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts string to numeric according to the given format.
- <?br?>
+ </para>
+ <para>
<literal>to_number('12,454.8-', '99G999D9S')</literal>
<returnvalue>-12454.8</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_timestamp</primary>
</indexterm>
<function>to_timestamp</function> ( <type>text</type>, <type>text</type> )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts string to time stamp according to the given format.
(See also <function>to_timestamp(double precision)</function> in
<xref linkend="functions-datetime-table"/>.)
- <?br?>
+ </para>
+ <para>
<literal>to_timestamp('05 Dec 2000', 'DD Mon YYYY')</literal>
<returnvalue>2000-12-05 00:00:00-05</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>date</type> <literal>+</literal> <type>integer</type>
<returnvalue>date</returnvalue>
- <?br?>
+ </para>
+ <para>
Add a number of days to a date
- <?br?>
+ </para>
+ <para>
<literal>date '2001-09-28' + 7</literal>
<returnvalue>2001-10-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>date</type> <literal>+</literal> <type>interval</type>
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Add an interval to a date
- <?br?>
+ </para>
+ <para>
<literal>date '2001-09-28' + interval '1 hour'</literal>
<returnvalue>2001-09-28 01:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>date</type> <literal>+</literal> <type>time</type>
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Add a time-of-day to a date
- <?br?>
+ </para>
+ <para>
<literal>date '2001-09-28' + time '03:00'</literal>
<returnvalue>2001-09-28 03:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>interval</type> <literal>+</literal> <type>interval</type>
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Add intervals
- <?br?>
+ </para>
+ <para>
<literal>interval '1 day' + interval '1 hour'</literal>
<returnvalue>1 day 01:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>timestamp</type> <literal>+</literal> <type>interval</type>
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Add an interval to a timestamp
- <?br?>
+ </para>
+ <para>
<literal>timestamp '2001-09-28 01:00' + interval '23 hours'</literal>
<returnvalue>2001-09-29 00:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>time</type> <literal>+</literal> <type>interval</type>
<returnvalue>time</returnvalue>
- <?br?>
+ </para>
+ <para>
Add an interval to a time
- <?br?>
+ </para>
+ <para>
<literal>time '01:00' + interval '3 hours'</literal>
<returnvalue>04:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>-</literal> <type>interval</type>
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Negate an interval
- <?br?>
+ </para>
+ <para>
<literal>- interval '23 hours'</literal>
<returnvalue>-23:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>date</type> <literal>-</literal> <type>date</type>
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract dates, producing the number of days elapsed
- <?br?>
+ </para>
+ <para>
<literal>date '2001-10-01' - date '2001-09-28'</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>date</type> <literal>-</literal> <type>integer</type>
<returnvalue>date</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract a number of days from a date
- <?br?>
+ </para>
+ <para>
<literal>date '2001-10-01' - 7</literal>
<returnvalue>2001-09-24</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>date</type> <literal>-</literal> <type>interval</type>
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract an interval from a date
- <?br?>
+ </para>
+ <para>
<literal>date '2001-09-28' - interval '1 hour'</literal>
<returnvalue>2001-09-27 23:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>time</type> <literal>-</literal> <type>time</type>
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract times
- <?br?>
+ </para>
+ <para>
<literal>time '05:00' - time '03:00'</literal>
<returnvalue>02:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>time</type> <literal>-</literal> <type>interval</type>
<returnvalue>time</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract an interval from a time
- <?br?>
+ </para>
+ <para>
<literal>time '05:00' - interval '2 hours'</literal>
<returnvalue>03:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>timestamp</type> <literal>-</literal> <type>interval</type>
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract an interval from a timestamp
- <?br?>
+ </para>
+ <para>
<literal>timestamp '2001-09-28 23:00' - interval '23 hours'</literal>
<returnvalue>2001-09-28 00:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>interval</type> <literal>-</literal> <type>interval</type>
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract intervals
- <?br?>
+ </para>
+ <para>
<literal>interval '1 day' - interval '1 hour'</literal>
<returnvalue>1 day -01:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>timestamp</type> <literal>-</literal> <type>timestamp</type>
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract timestamps
- <?br?>
+ </para>
+ <para>
<literal>timestamp '2001-09-29 03:00' - timestamp '2001-09-27 12:00'</literal>
<returnvalue>1 day 15:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>interval</type> <literal>*</literal> <type>double precision</type>
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Multiply an interval by a scalar
- <?br?>
+ </para>
+ <para>
<literal>interval '1 second' * 900</literal>
<returnvalue>00:15:00</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>interval '1 day' * 21</literal>
<returnvalue>21 days</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>interval '1 hour' * 3.5</literal>
<returnvalue>03:30:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>interval</type> <literal>/</literal> <type>double precision</type>
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Divide an interval by a scalar
- <?br?>
+ </para>
+ <para>
<literal>interval '1 hour' / 1.5</literal>
<returnvalue>00:40:00</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>age</primary>
</indexterm>
<function>age</function> ( <type>timestamp</type>, <type>timestamp</type> )
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract arguments, producing a <quote>symbolic</quote> result that
uses years and months, rather than just days
- <?br?>
+ </para>
+ <para>
<literal>age(timestamp '2001-04-10', timestamp '1957-06-13')</literal>
<returnvalue>43 years 9 mons 27 days</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>age</function> ( <type>timestamp</type> )
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtract argument from <function>current_date</function> (at midnight)
- <?br?>
+ </para>
+ <para>
<literal>age(timestamp '1957-06-13')</literal>
<returnvalue>62 years 6 mons 10 days</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>clock_timestamp</primary>
</indexterm>
<function>clock_timestamp</function> ( )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time (changes during statement execution);
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>clock_timestamp()</literal>
<returnvalue>2019-12-23 14:39:53.662522-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>current_date</primary>
</indexterm>
<function>current_date</function>
<returnvalue>date</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date; see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>current_date</literal>
<returnvalue>2019-12-23</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>current_time</primary>
</indexterm>
<function>current_time</function>
<returnvalue>time with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Current time of day; see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>current_time</literal>
<returnvalue>14:39:53.662522-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>current_time</function> ( <type>integer</type> )
<returnvalue>time with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Current time of day, with limited precision;
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>current_time(2)</literal>
<returnvalue>14:39:53.66-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>current_timestamp</primary>
</indexterm>
<function>current_timestamp</function>
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time (start of current transaction);
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>current_timestamp</literal>
<returnvalue>2019-12-23 14:39:53.662522-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>current_timestamp</function> ( <type>integer</type> )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time (start of current transaction), with limited precision;
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>current_timestamp(0)</literal>
<returnvalue>2019-12-23 14:39:53-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>date_part</primary>
</indexterm>
<function>date_part</function> ( <type>text</type>, <type>timestamp</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Get timestamp subfield (equivalent to <function>extract</function>);
see <xref linkend="functions-datetime-extract"/>
- <?br?>
+ </para>
+ <para>
<literal>date_part('hour', timestamp '2001-02-16 20:38:40')</literal>
<returnvalue>20</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>date_part</function> ( <type>text</type>, <type>interval</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Get interval subfield (equivalent to <function>extract</function>);
see <xref linkend="functions-datetime-extract"/>
- <?br?>
+ </para>
+ <para>
<literal>date_part('month', interval '2 years 3 months')</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>date_trunc</primary>
</indexterm>
<function>date_trunc</function> ( <type>text</type>, <type>timestamp</type> )
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Truncate to specified precision; see <xref linkend="functions-datetime-trunc"/>
- <?br?>
+ </para>
+ <para>
<literal>date_trunc('hour', timestamp '2001-02-16 20:38:40')</literal>
<returnvalue>2001-02-16 20:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>date_trunc</function> ( <type>text</type>, <type>timestamp with time zone</type>, <type>text</type> )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Truncate to specified precision in the specified time zone; see
<xref linkend="functions-datetime-trunc"/>
- <?br?>
+ </para>
+ <para>
<literal>date_trunc('day', timestamptz '2001-02-16 20:38:40+00', 'Australia/Sydney')</literal>
<returnvalue>2001-02-16 13:00:00+00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>date_trunc</function> ( <type>text</type>, <type>interval</type> )
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Truncate to specified precision; see
<xref linkend="functions-datetime-trunc"/>
- <?br?>
+ </para>
+ <para>
<literal>date_trunc('hour', interval '2 days 3 hours 40 minutes')</literal>
<returnvalue>2 days 03:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>extract</primary>
</indexterm>
<function>extract</function> ( <parameter>field</parameter> <literal>from</literal> <type>timestamp</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Get timestamp subfield; see <xref linkend="functions-datetime-extract"/>
- <?br?>
+ </para>
+ <para>
<literal>extract(hour from timestamp '2001-02-16 20:38:40')</literal>
<returnvalue>20</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>extract</function> ( <parameter>field</parameter> <literal>from</literal> <type>interval</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Get interval subfield; see <xref linkend="functions-datetime-extract"/>
- <?br?>
+ </para>
+ <para>
<literal>extract(month from interval '2 years 3 months')</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>isfinite</primary>
</indexterm>
<function>isfinite</function> ( <type>date</type> )
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test for finite date (not +/-infinity)
- <?br?>
+ </para>
+ <para>
<literal>isfinite(date '2001-02-16')</literal>
<returnvalue>true</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>isfinite</function> ( <type>timestamp</type> )
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test for finite timestamp (not +/-infinity)
- <?br?>
+ </para>
+ <para>
<literal>isfinite(timestamp 'infinity')</literal>
<returnvalue>false</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>isfinite</function> ( <type>interval</type> )
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Test for finite interval (currently always true)
- <?br?>
+ </para>
+ <para>
<literal>isfinite(interval '4 hours')</literal>
<returnvalue>true</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>justify_days</primary>
</indexterm>
<function>justify_days</function> ( <type>interval</type> )
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Adjust interval so 30-day time periods are represented as months
- <?br?>
+ </para>
+ <para>
<literal>justify_days(interval '35 days')</literal>
<returnvalue>1 mon 5 days</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>justify_hours</primary>
</indexterm>
<function>justify_hours</function> ( <type>interval</type> )
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Adjust interval so 24-hour time periods are represented as days
- <?br?>
+ </para>
+ <para>
<literal>justify_hours(interval '27 hours')</literal>
<returnvalue>1 day 03:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>justify_interval</primary>
</indexterm>
<function>justify_interval</function> ( <type>interval</type> )
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Adjust interval using <function>justify_days</function>
and <function>justify_hours</function>, with additional sign
adjustments
- <?br?>
+ </para>
+ <para>
<literal>justify_interval(interval '1 mon -1 hour')</literal>
<returnvalue>29 days 23:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>localtime</primary>
</indexterm>
<function>localtime</function>
<returnvalue>time</returnvalue>
- <?br?>
+ </para>
+ <para>
Current time of day;
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>localtime</literal>
<returnvalue>14:39:53.662522</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>localtime</function> ( <type>integer</type> )
<returnvalue>time</returnvalue>
- <?br?>
+ </para>
+ <para>
Current time of day, with limited precision;
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>localtime(0)</literal>
<returnvalue>14:39:53</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>localtimestamp</primary>
</indexterm>
<function>localtimestamp</function>
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time (start of current transaction);
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>localtimestamp</literal>
<returnvalue>2019-12-23 14:39:53.662522</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>localtimestamp</function> ( <type>integer</type> )
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time (start of current
transaction), with limited precision;
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>localtimestamp(2)</literal>
<returnvalue>2019-12-23 14:39:53.66</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>make_date</primary>
</indexterm>
<parameter>month</parameter> <type>int</type>,
<parameter>day</parameter> <type>int</type> )
<returnvalue>date</returnvalue>
- <?br?>
+ </para>
+ <para>
Create date from year, month and day fields
- <?br?>
+ </para>
+ <para>
<literal>make_date(2013, 7, 15)</literal>
<returnvalue>2013-07-15</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry"><indexterm>
+ <entry role="func_table_entry"><para role="func_signature"><indexterm>
<primary>make_interval</primary>
</indexterm>
<function>make_interval</function> ( <optional> <parameter>year</parameter> <type>int</type>
<optional>, <parameter>sec</parameter> <type>double precision</type>
</optional></optional></optional></optional></optional></optional></optional> )
<returnvalue>interval</returnvalue>
- <?br?>
+ </para>
+ <para>
Create interval from years, months, weeks, days, hours, minutes and
seconds fields, each of which can default to zero
- <?br?>
+ </para>
+ <para>
<literal>make_interval(days => 10)</literal>
<returnvalue>10 days</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>make_time</primary>
</indexterm>
<parameter>min</parameter> <type>int</type>,
<parameter>sec</parameter> <type>double precision</type> )
<returnvalue>time</returnvalue>
- <?br?>
+ </para>
+ <para>
Create time from hour, minute and seconds fields
- <?br?>
+ </para>
+ <para>
<literal>make_time(8, 15, 23.5)</literal>
<returnvalue>08:15:23.5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>make_timestamp</primary>
</indexterm>
<parameter>min</parameter> <type>int</type>,
<parameter>sec</parameter> <type>double precision</type> )
<returnvalue>timestamp</returnvalue>
- <?br?>
+ </para>
+ <para>
Create timestamp from year, month, day, hour, minute and seconds fields
- <?br?>
+ </para>
+ <para>
<literal>make_timestamp(2013, 7, 15, 8, 15, 23.5)</literal>
<returnvalue>2013-07-15 08:15:23.5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>make_timestamptz</primary>
</indexterm>
<parameter>sec</parameter> <type>double precision</type>
<optional>, <parameter>timezone</parameter> <type>text</type> </optional> )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Create timestamp with time zone from year, month, day, hour, minute
and seconds fields; if <parameter>timezone</parameter> is not
specified, the current time zone is used
- <?br?>
+ </para>
+ <para>
<literal>make_timestamptz(2013, 7, 15, 8, 15, 23.5)</literal>
<returnvalue>2013-07-15 08:15:23.5+01</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>now</primary>
</indexterm>
<function>now</function> ( )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time (start of current transaction);
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>now()</literal>
<returnvalue>2019-12-23 14:39:53.662522-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>statement_timestamp</primary>
</indexterm>
<function>statement_timestamp</function> ( )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time (start of current statement);
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>statement_timestamp()</literal>
<returnvalue>2019-12-23 14:39:53.662522-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>timeofday</primary>
</indexterm>
<function>timeofday</function> ( )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time
(like <function>clock_timestamp</function>, but as a <type>text</type> string);
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>timeofday()</literal>
<returnvalue>Mon Dec 23 14:39:53.662522 2019 EST</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>transaction_timestamp</primary>
</indexterm>
<function>transaction_timestamp</function> ( )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Current date and time (start of current transaction);
see <xref linkend="functions-datetime-current"/>
- <?br?>
+ </para>
+ <para>
<literal>transaction_timestamp()</literal>
<returnvalue>2019-12-23 14:39:53.662522-05</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_timestamp</primary>
</indexterm>
<function>to_timestamp</function> ( <type>double precision</type> )
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Convert Unix epoch (seconds since 1970-01-01 00:00:00+00) to
timestamp with time zone
- <?br?>
+ </para>
+ <para>
<literal>to_timestamp(1284352323)</literal>
<returnvalue>2010-09-13 04:32:03+00</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>timestamp without time zone</type> <literal>AT TIME ZONE</literal> <replaceable>zone</replaceable>
<returnvalue>timestamp with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts given time stamp <emphasis>without</emphasis> time zone to
time stamp <emphasis>with</emphasis> time zone, assuming the given
value is in the named time zone.
- <?br?>
+ </para>
+ <para>
<literal>timestamp '2001-02-16 20:38:40' at time zone 'America/Denver'</literal>
<returnvalue>2001-02-17 03:38:40+00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>timestamp with time zone</type> <literal>AT TIME ZONE</literal> <replaceable>zone</replaceable>
<returnvalue>timestamp without time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts given time stamp <emphasis>with</emphasis> time zone to
time stamp <emphasis>without</emphasis> time zone, as the time would
appear in that zone.
- <?br?>
+ </para>
+ <para>
<literal>timestamp with time zone '2001-02-16 20:38:40-05' at time zone 'America/Denver'</literal>
<returnvalue>2001-02-16 18:38:40</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>time with time zone</type> <literal>AT TIME ZONE</literal> <replaceable>zone</replaceable>
<returnvalue>time with time zone</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts given time <emphasis>with</emphasis> time zone to a new time
zone. Since no date is supplied, this uses the currently active UTC
offset for the named destination zone.
- <?br?>
+ </para>
+ <para>
<literal>time with time zone '05:34:17-05' at time zone 'UTC'</literal>
<returnvalue>10:34:17+00</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>enum_first</primary>
</indexterm>
<function>enum_first</function> ( <type>anyenum</type> )
<returnvalue>anyenum</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the first value of the input enum type.
- <?br?>
+ </para>
+ <para>
<literal>enum_first(null::rainbow)</literal>
<returnvalue>red</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>enum_last</primary>
</indexterm>
<function>enum_last</function> ( <type>anyenum</type> )
<returnvalue>anyenum</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the last value of the input enum type.
- <?br?>
+ </para>
+ <para>
<literal>enum_last(null::rainbow)</literal>
<returnvalue>purple</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>enum_range</primary>
</indexterm>
<function>enum_range</function> ( <type>anyenum</type> )
<returnvalue>anyarray</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns all values of the input enum type in an ordered array.
- <?br?>
+ </para>
+ <para>
<literal>enum_range(null::rainbow)</literal>
<returnvalue>{red,orange,yellow,&zwsp;green,blue,purple}</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>enum_range</function> ( <type>anyenum</type>, <type>anyenum</type> )
<returnvalue>anyarray</returnvalue>
- <?br?>
+ </para>
+ <para>
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.
- <?br?>
+ </para>
+ <para>
<literal>enum_range('orange'::rainbow, 'green'::rainbow)</literal>
<returnvalue>{orange,yellow,green}</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>enum_range(NULL, 'green'::rainbow)</literal>
<returnvalue>{red,orange,&zwsp;yellow,green}</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>enum_range('orange'::rainbow, NULL)</literal>
<returnvalue>{orange,yellow,green,&zwsp;blue,purple}</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>+</literal> <type>point</type>
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Adds the coordinates of the second <type>point</type> to those of each
point of the first argument, thus performing translation.
Available for <type>point</type>, <type>box</type>, <type>path</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(1,1),(0,0)' + point '(2,0)'</literal>
<returnvalue>(3,1),(2,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>path</type> <literal>+</literal> <type>path</type>
<returnvalue>path</returnvalue>
- <?br?>
+ </para>
+ <para>
Concatenates two open paths (returns NULL if either path is closed).
- <?br?>
+ </para>
+ <para>
<literal>path '[(0,0),(1,1)]' + path '[(2,2),(3,3),(4,4)]'</literal>
<returnvalue>[(0,0),(1,1),(2,2),(3,3),(4,4)]</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>-</literal> <type>point</type>
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Subtracts the coordinates of the second <type>point</type> from those
of each point of the first argument, thus performing translation.
Available for <type>point</type>, <type>box</type>, <type>path</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(1,1),(0,0)' - point '(2,0)'</literal>
<returnvalue>(-1,1),(-2,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>*</literal> <type>point</type>
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Multiplies each point of the first argument by the second
<type>point</type> (treating a point as being a complex number
represented by real and imaginary parts, and performing standard
still considered to have sides parallel to the axes. Hence the box's
size is not preserved, as a true rotation would do.</para></footnote>
<type>path</type>, <type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>path '((0,0),(1,0),(1,1))' * point '(3.0,0)'</literal>
<returnvalue>((0,0),(3,0),(3,3))</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>path '((0,0),(1,0),(1,1))' * point(cosd(45), sind(45))</literal>
<returnvalue>((0,0),&zwsp;(0.7071067811865475,0.7071067811865475),&zwsp;(0,1.414213562373095))</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>/</literal> <type>point</type>
<returnvalue><replaceable>geometric_type</replaceable></returnvalue>
- <?br?>
+ </para>
+ <para>
Divides each point of the first argument by the second
<type>point</type> (treating a point as being a complex number
represented by real and imaginary parts, and performing standard
Available for <type>point</type>, <type>box</type>,<footnoteref
linkend="functions-geometry-rotation-fn"/> <type>path</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>path '((0,0),(1,0),(1,1))' / point '(2.0,0)'</literal>
<returnvalue>((0,0),(0.5,0),(0.5,0.5))</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>path '((0,0),(1,0),(1,1))' / point(cosd(45), sind(45))</literal>
<returnvalue>((0,0),&zwsp;(0.7071067811865476,-0.7071067811865476),&zwsp;(1.4142135623730951,0))</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>@-@</literal> <replaceable>geometric_type</replaceable>
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the total length.
Available for <type>lseg</type>, <type>path</type>.
- <?br?>
+ </para>
+ <para>
<literal>@-@ path '[(0,0),(1,0),(1,1)]'</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>@@</literal> <replaceable>geometric_type</replaceable>
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the center point.
Available for <type>box</type>, <type>lseg</type>, <type>path</type>,
<type>polygon</type>, <type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>@@ box '(2,2),(0,0)'</literal>
<returnvalue>(1,1)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>#</literal> <replaceable>geometric_type</replaceable>
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of points.
Available for <type>path</type>, <type>polygon</type>.
- <?br?>
+ </para>
+ <para>
<literal># path '((1,0),(0,1),(-1,0))'</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>#</literal> <replaceable>geometric_type</replaceable>
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the point of intersection, or NULL if there is none.
Available for <type>lseg</type>, <type>line</type>.
- <?br?>
+ </para>
+ <para>
<literal>lseg '[(0,0),(1,1)]' # lseg '[(1,0),(0,1)]'</literal>
<returnvalue>(0.5,0.5)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>box</type> <literal>#</literal> <type>box</type>
<returnvalue>box</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the intersection of two boxes, or NULL if there is none.
- <?br?>
+ </para>
+ <para>
<literal>box '(2,2),(-1,-1)' # box '(1,1),(-2,-2)'</literal>
<returnvalue>(1,1),(-1,-1)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>##</literal> <replaceable>geometric_type</replaceable>
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the closest point to the first object on the second object.
Available for these pairs of types:
(<type>point</type>, <type>box</type>),
(<type>lseg</type>, <type>line</type>),
(<type>line</type>, <type>box</type>),
(<type>line</type>, <type>lseg</type>).
- <?br?>
+ </para>
+ <para>
<literal>point '(0,0)' ## lseg '[(2,0),(0,2)]'</literal>
<returnvalue>(1,1)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal><-></literal> <replaceable>geometric_type</replaceable>
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the distance between the objects.
Available for all seven geometric types, for all combinations
of <type>point</type> with another geometric type, and for
(<type>lseg</type>, <type>line</type>),
(<type>polygon</type>, <type>circle</type>)
(and the commutator cases).
- <?br?>
+ </para>
+ <para>
<literal>circle '<(0,0),1>' <-> circle '<(5,0),1>'</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>@></literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does first object contain second?
Available for these pairs of types:
(<literal>box</literal>, <literal>point</literal>),
(<literal>polygon</literal>, <literal>polygon</literal>),
(<literal>circle</literal>, <literal>point</literal>),
(<literal>circle</literal>, <literal>circle</literal>).
- <?br?>
+ </para>
+ <para>
<literal>circle '<(0,0),2>' @> point '(1,1)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal><@</literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object contained in or on second?
Available for these pairs of types:
(<literal>point</literal>, <literal>box</literal>),
(<literal>lseg</literal>, <literal>line</literal>),
(<literal>polygon</literal>, <literal>polygon</literal>),
(<literal>circle</literal>, <literal>circle</literal>).
- <?br?>
+ </para>
+ <para>
<literal>point '(1,1)' <@ circle '<(0,0),2>'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>&&</literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Do these objects overlap? (One point in common makes this true.)
Available for <type>box</type>, <type>polygon</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(1,1),(0,0)' && box '(2,2),(0,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal><<</literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object strictly left of second?
Available for <type>point</type>, <type>box</type>,
<type>polygon</type>, <type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>circle '<(0,0),1>' << circle '<(5,0),1>'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>>></literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object strictly right of second?
Available for <type>point</type>, <type>box</type>,
<type>polygon</type>, <type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>circle '<(5,0),1>' >> circle '<(0,0),1>'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>&<</literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does first object not extend to the right of second?
Available for <type>box</type>, <type>polygon</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(1,1),(0,0)' &< box '(2,2),(0,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>&></literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does first object not extend to the left of second?
Available for <type>box</type>, <type>polygon</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(3,3),(0,0)' &> box '(2,2),(0,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal><<|</literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object strictly below second?
Available for <type>box</type>, <type>polygon</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(3,3),(0,0)' <<| box '(5,5),(3,4)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>|>></literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object strictly above second?
Available for <type>box</type>, <type>polygon</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(5,5),(3,4)' |>> box '(3,3),(0,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>&<|</literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does first object not extend above second?
Available for <type>box</type>, <type>polygon</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(1,1),(0,0)' &<| box '(2,2),(0,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>|&></literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does first object not extend below second?
Available for <type>box</type>, <type>polygon</type>,
<type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>box '(3,3),(0,0)' |&> box '(2,2),(0,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>box</type> <literal><^</literal> <type>box</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object below second (allows edges to touch)?
- <?br?>
+ </para>
+ <para>
<literal>box '((1,1),(0,0))' <^ box '((2,2),(1,1))'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>point</type> <literal><^</literal> <type>point</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object strictly below second?
(This operator is misnamed; it should be <literal><<|</literal>.)
- <?br?>
+ </para>
+ <para>
<literal>point '(1,0)' <^ point '(1,1)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>box</type> <literal>>^</literal> <type>box</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object above second (allows edges to touch)?
- <?br?>
+ </para>
+ <para>
<literal>box '((2,2),(1,1))' >^ box '((1,1),(0,0))'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>point</type> <literal>>^</literal> <type>point</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first object strictly above second?
(This operator is misnamed; it should be <literal>|>></literal>.)
- <?br?>
+ </para>
+ <para>
<literal>point '(1,1)' >^ point '(1,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>?#</literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Do these objects intersect?
Available for these pairs of types:
(<type>box</type>, <type>box</type>),
(<type>line</type>, <type>box</type>),
(<type>line</type>, <type>line</type>),
(<type>path</type>, <type>path</type>).
- <?br?>
+ </para>
+ <para>
<literal>lseg '[(-1,0),(1,0)]' ?# box '(2,2),(-2,-2)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
- <literal>?-</literal> <replaceable>geometric_type</replaceable>
+ <entry role="func_table_entry"><para role="func_signature">
+ <literal>?-</literal> <type>line</type>
+ <returnvalue>boolean</returnvalue>
+ </para>
+ <para role="func_signature">
+ <literal>?-</literal> <type>lseg</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is line horizontal?
- Available for <type>lseg</type>, <type>line</type>.
- <?br?>
+ </para>
+ <para>
<literal>?- lseg '[(-1,0),(1,0)]'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>point</type> <literal>?-</literal> <type>point</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Are points horizontally aligned (that is, have same y coordinate)?
- <?br?>
+ </para>
+ <para>
<literal>point '(1,0)' ?- point '(0,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
- <literal>?|</literal> <replaceable>geometric_type</replaceable>
+ <entry role="func_table_entry"><para role="func_signature">
+ <literal>?|</literal> <type>line</type>
+ <returnvalue>boolean</returnvalue>
+ </para>
+ <para role="func_signature">
+ <literal>?|</literal> <type>lseg</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is line vertical?
- Available for <type>lseg</type>, <type>line</type>.
- <?br?>
+ </para>
+ <para>
<literal>?| lseg '[(-1,0),(1,0)]'</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>point</type> <literal>?|</literal> <type>point</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Are points vertically aligned (that is, have same x coordinate)?
- <?br?>
+ </para>
+ <para>
<literal>point '(0,1)' ?| point '(0,0)'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
- <replaceable>geometric_type</replaceable> <literal>?-|</literal> <replaceable>geometric_type</replaceable>
+ <entry role="func_table_entry"><para role="func_signature">
+ <type>line</type> <literal>?-|</literal> <type>line</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para role="func_signature">
+ <type>lseg</type> <literal>?-|</literal> <type>lseg</type>
+ <returnvalue>boolean</returnvalue>
+ </para>
+ <para>
Are lines perpendicular?
- Available for <type>lseg</type>, <type>line</type>.
- <?br?>
+ </para>
+ <para>
<literal>lseg '[(0,0),(0,1)]' ?-| lseg '[(0,0),(1,0)]'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
- <replaceable>geometric_type</replaceable> <literal>?||</literal> <replaceable>geometric_type</replaceable>
+ <entry role="func_table_entry"><para role="func_signature">
+ <type>line</type> <literal>?||</literal> <type>line</type>
+ <returnvalue>boolean</returnvalue>
+ </para>
+ <para role="func_signature">
+ <type>lseg</type> <literal>?||</literal> <type>lseg</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Are lines parallel?
- Available for <type>lseg</type>, <type>line</type>.
- <?br?>
+ </para>
+ <para>
<literal>lseg '[(-1,0),(1,0)]' ?|| lseg '[(-1,2),(1,2)]'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<replaceable>geometric_type</replaceable> <literal>~=</literal> <replaceable>geometric_type</replaceable>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Are these objects the same?
Available for <type>point</type>, <type>box</type>,
<type>polygon</type>, <type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>polygon '((0,0),(1,1))' ~= polygon '((1,1),(0,0))'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>area</primary>
</indexterm>
<function>area</function> ( <replaceable>geometric_type</replaceable> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes area.
Available for <type>box</type>, <type>path</type>, <type>circle</type>.
A <type>path</type> input must be closed, else NULL is returned.
Also, if the <type>path</type> is self-intersecting, the result may be
meaningless.
- <?br?>
+ </para>
+ <para>
<literal>area(box '(2,2),(0,0)')</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>center</primary>
</indexterm>
<function>center</function> ( <replaceable>geometric_type</replaceable> )
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes center point.
Available for <type>box</type>, <type>circle</type>.
- <?br?>
+ </para>
+ <para>
<literal>center(box '(1,2),(0,0)')</literal>
<returnvalue>(0.5,1)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>diagonal</primary>
</indexterm>
<function>diagonal</function> ( <type>box</type> )
<returnvalue>lseg</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts box's diagonal as a line segment
(same as <function>lseg(box)</function>).
- <?br?>
+ </para>
+ <para>
<literal>diagonal(box '(1,2),(0,0)')</literal>
<returnvalue>[(1,2),(0,0)]</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>diameter</primary>
</indexterm>
<function>diameter</function> ( <type>circle</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes diameter of circle.
- <?br?>
+ </para>
+ <para>
<literal>diameter(circle '<(0,0),2>')</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>height</primary>
</indexterm>
<function>height</function> ( <type>box</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes vertical size of box.
- <?br?>
+ </para>
+ <para>
<literal>height(box '(1,2),(0,0)')</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>isclosed</primary>
</indexterm>
<function>isclosed</function> ( <type>path</type> )
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is path closed?
- <?br?>
+ </para>
+ <para>
<literal>isclosed(path '((0,0),(1,1),(2,0))')</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>isopen</primary>
</indexterm>
<function>isopen</function> ( <type>path</type> )
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is path open?
- <?br?>
+ </para>
+ <para>
<literal>isopen(path '[(0,0),(1,1),(2,0)]')</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>length</primary>
</indexterm>
<function>length</function> ( <replaceable>geometric_type</replaceable> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the total length.
Available for <type>lseg</type>, <type>path</type>.
- <?br?>
+ </para>
+ <para>
<literal>length(path '((-1,0),(1,0))')</literal>
<returnvalue>4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>npoints</primary>
</indexterm>
<function>npoints</function> ( <replaceable>geometric_type</replaceable> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of points.
Available for <type>path</type>, <type>polygon</type>.
- <?br?>
+ </para>
+ <para>
<literal>npoints(path '[(0,0),(1,1),(2,0)]')</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>pclose</primary>
</indexterm>
<function>pclose</function> ( <type>path</type> )
<returnvalue>path</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts path to closed form.
- <?br?>
+ </para>
+ <para>
<literal>pclose(path '[(0,0),(1,1),(2,0)]')</literal>
<returnvalue>((0,0),(1,1),(2,0))</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>popen</primary>
</indexterm>
<function>popen</function> ( <type>path</type> )
<returnvalue>path</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts path to open form.
- <?br?>
+ </para>
+ <para>
<literal>popen(path '((0,0),(1,1),(2,0))')</literal>
<returnvalue>[(0,0),(1,1),(2,0)]</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>radius</primary>
</indexterm>
<function>radius</function> ( <type>circle</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes radius of circle.
- <?br?>
+ </para>
+ <para>
<literal>radius(circle '<(0,0),2>')</literal>
<returnvalue>2</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>slope</primary>
</indexterm>
<function>slope</function> ( <type>point</type>, <type>point</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes slope of a line drawn through the two points.
- <?br?>
+ </para>
+ <para>
<literal>slope(point '(0,0)', point '(2,1)')</literal>
<returnvalue>0.5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>width</primary>
</indexterm>
<function>width</function> ( <type>box</type> )
<returnvalue>double precision</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes horizontal size of box.
- <?br?>
+ </para>
+ <para>
<literal>width(box '(1,2),(0,0)')</literal>
<returnvalue>1</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>box</primary>
</indexterm>
<function>box</function> ( <type>circle</type> )
<returnvalue>box</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes box inscribed within the circle.
- <?br?>
+ </para>
+ <para>
<literal>box(circle '<(0,0),2>')</literal>
<returnvalue>(1.414213562373095,1.414213562373095),&zwsp;(-1.414213562373095,-1.414213562373095)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>box</function> ( <type>point</type> )
<returnvalue>box</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts point to empty box.
- <?br?>
+ </para>
+ <para>
<literal>box(point '(1,0)')</literal>
<returnvalue>(1,0),(1,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>box</function> ( <type>point</type>, <type>point</type> )
<returnvalue>box</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts any two corner points to box.
- <?br?>
+ </para>
+ <para>
<literal>box(point '(0,1)', point '(1,0)')</literal>
<returnvalue>(1,1),(0,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>box</function> ( <type>polygon</type> )
<returnvalue>box</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes bounding box of polygon.
- <?br?>
+ </para>
+ <para>
<literal>box(polygon '((0,0),(1,1),(2,0))')</literal>
<returnvalue>(2,1),(0,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>bound_box</primary>
</indexterm>
<function>bound_box</function> ( <type>box</type>, <type>box</type> )
<returnvalue>box</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes bounding box of two boxes.
- <?br?>
+ </para>
+ <para>
<literal>bound_box(box '(1,1),(0,0)', box '(4,4),(3,3)')</literal>
<returnvalue>(4,4),(0,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>circle</primary>
</indexterm>
<function>circle</function> ( <type>box</type> )
<returnvalue>circle</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes smallest circle enclosing box.
- <?br?>
+ </para>
+ <para>
<literal>circle(box '(1,1),(0,0)')</literal>
<returnvalue><(0.5,0.5),0.7071067811865476></returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>circle</function> ( <type>point</type>, <type>double precision</type> )
<returnvalue>circle</returnvalue>
- <?br?>
+ </para>
+ <para>
Constructs circle from center and radius.
- <?br?>
+ </para>
+ <para>
<literal>circle(point '(0,0)', 2.0)</literal>
<returnvalue><(0,0),2></returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>circle</function> ( <type>polygon</type> )
<returnvalue>circle</returnvalue>
- <?br?>
+ </para>
+ <para>
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.
- <?br?>
+ </para>
+ <para>
<literal>circle(polygon '((0,0),(1,3),(2,0))')</literal>
<returnvalue><(1,1),1.6094757082487299></returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>line</primary>
</indexterm>
<function>line</function> ( <type>point</type>, <type>point</type> )
<returnvalue>line</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts two points to the line through them.
- <?br?>
+ </para>
+ <para>
<literal>line(point '(-1,0)', point '(1,0)')</literal>
<returnvalue>{0,-1,0}</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>lseg</primary>
</indexterm>
<function>lseg</function> ( <type>box</type> )
<returnvalue>lseg</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts box's diagonal as a line segment.
- <?br?>
+ </para>
+ <para>
<literal>lseg(box '(1,0),(-1,0)')</literal>
<returnvalue>[(1,0),(-1,0)]</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>lseg</function> ( <type>point</type>, <type>point</type> )
<returnvalue>lseg</returnvalue>
- <?br?>
+ </para>
+ <para>
Constructs line segment from two endpoints.
- <?br?>
+ </para>
+ <para>
<literal>lseg(point '(-1,0)', point '(1,0)')</literal>
<returnvalue>[(-1,0),(1,0)]</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>path</primary>
</indexterm>
<function>path</function> ( <type>polygon</type> )
<returnvalue>path</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts polygon to a closed path with the same list of points.
- <?br?>
+ </para>
+ <para>
<literal>path(polygon '((0,0),(1,1),(2,0))')</literal>
<returnvalue>((0,0),(1,1),(2,0))</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>point</primary>
</indexterm>
<function>point</function> ( <type>double precision</type>, <type>double precision</type> )
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Constructs point from its coordinates.
- <?br?>
+ </para>
+ <para>
<literal>point(23.4, -44.5)</literal>
<returnvalue>(23.4,-44.5)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>point</function> ( <type>box</type> )
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes center of box.
- <?br?>
+ </para>
+ <para>
<literal>point(box '(1,0),(-1,0)')</literal>
<returnvalue>(0,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>point</function> ( <type>circle</type> )
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes center of circle.
- <?br?>
+ </para>
+ <para>
<literal>point(circle '<(0,0),2>')</literal>
<returnvalue>(0,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>point</function> ( <type>lseg</type> )
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes center of line segment.
- <?br?>
+ </para>
+ <para>
<literal>point(lseg '[(-1,0),(1,0)]')</literal>
<returnvalue>(0,0)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>point</function> ( <type>polygon</type> )
<returnvalue>point</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes center of polygon (the mean of the
positions of the polygon's points).
- <?br?>
+ </para>
+ <para>
<literal>point(polygon '((0,0),(1,1),(2,0))')</literal>
<returnvalue>(1,0.3333333333333333)</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>polygon</primary>
</indexterm>
<function>polygon</function> ( <type>box</type> )
<returnvalue>polygon</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts box to a 4-point polygon.
- <?br?>
+ </para>
+ <para>
<literal>polygon(box '(1,1),(0,0)')</literal>
<returnvalue>((0,0),(0,1),(1,1),(1,0))</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>polygon</function> ( <type>circle</type> )
<returnvalue>polygon</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts circle to a 12-point polygon.
- <?br?>
+ </para>
+ <para>
<literal>polygon(circle '<(0,0),2>')</literal>
<returnvalue>((-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))</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>polygon</function> ( <type>integer</type>, <type>circle</type> )
<returnvalue>polygon</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts circle to an <replaceable>n</replaceable>-point polygon.
- <?br?>
+ </para>
+ <para>
<literal>polygon(4, circle '<(3,0),1>')</literal>
<returnvalue>((2,0),&zwsp;(3,1),&zwsp;(4,1.2246063538223773e-16),&zwsp;(3,-1))</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>polygon</function> ( <type>path</type> )
<returnvalue>polygon</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts closed path to a polygon with the same list of points.
- <?br?>
+ </para>
+ <para>
<literal>polygon(path '((0,0),(1,1),(2,0))')</literal>
<returnvalue>((0,0),(1,1),(2,0))</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal><<</literal> <type>inet</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
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.
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1.5' << inet '192.168.1/24'</literal>
<returnvalue>t</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.0.5' << inet '192.168.1/24'</literal>
<returnvalue>f</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1/24' << inet '192.168.1/24'</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal><<=</literal> <type>inet</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is subnet contained by or equal to subnet?
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1/24' <<= inet '192.168.1/24'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal>>></literal> <type>inet</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does subnet strictly contain subnet?
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1/24' >> inet '192.168.1.5'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal>>>=</literal> <type>inet</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does subnet contain or equal subnet?
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1/24' >>= inet '192.168.1/24'</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal>&&</literal> <type>inet</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does either subnet contain or equal the other?
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1/24' && inet '192.168.1.80/28'</literal>
<returnvalue>t</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1/24' && inet '192.168.2.0/28'</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>~</literal> <type>inet</type>
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes bitwise NOT.
- <?br?>
+ </para>
+ <para>
<literal>~ inet '192.168.1.6'</literal>
<returnvalue>63.87.254.249</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal>&</literal> <type>inet</type>
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes bitwise AND.
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1.6' & inet '0.0.0.255'</literal>
<returnvalue>0.0.0.6</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal>|</literal> <type>inet</type>
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes bitwise OR.
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1.6' | inet '0.0.0.255'</literal>
<returnvalue>192.168.1.255</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal>+</literal> <type>bigint</type>
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Adds an offset to an address.
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1.6' + 25</literal>
<returnvalue>192.168.1.31</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>bigint</type> <literal>+</literal> <type>inet</type>
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Adds an offset to an address.
- <?br?>
+ </para>
+ <para>
<literal>200 + inet '::ffff:fff0:1'</literal>
<returnvalue>::ffff:255.240.0.201</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal>-</literal> <type>bigint</type>
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Subtracts an offset from an address.
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1.43' - 36</literal>
<returnvalue>192.168.1.7</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>inet</type> <literal>-</literal> <type>inet</type>
<returnvalue>bigint</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the difference of two addresses.
- <?br?>
+ </para>
+ <para>
<literal>inet '192.168.1.43' - inet '192.168.1.19'</literal>
<returnvalue>24</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>inet '::1' - inet '::ffff:1'</literal>
<returnvalue>-4294901760</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>abbrev</primary>
</indexterm>
<function>abbrev</function> ( <type>inet</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Creates an abbreviated display format as text.
(The result is the same as the <type>inet</type> output function
produces; it is <quote>abbreviated</quote> only in comparison to the
result of an explicit cast to <type>text</type>, which for historical
reasons will never suppress the netmask part.)
- <?br?>
+ </para>
+ <para>
<literal>abbrev(inet '10.1.0.0/32')</literal>
<returnvalue>10.1.0.0</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>abbrev</function> ( <type>cidr</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
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
<xref linkend="datatype-net-cidr-table"/>.)
- <?br?>
+ </para>
+ <para>
<literal>abbrev(cidr '10.1.0.0/16')</literal>
<returnvalue>10.1/16</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>broadcast</primary>
</indexterm>
<function>broadcast</function> ( <type>inet</type> )
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the broadcast address for the address's network.
- <?br?>
+ </para>
+ <para>
<literal>broadcast(inet '192.168.1.5/24')</literal>
<returnvalue>192.168.1.255/24</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>family</primary>
</indexterm>
<function>family</function> ( <type>inet</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the address's family: <literal>4</literal> for IPv4,
<literal>6</literal> for IPv6.
- <?br?>
+ </para>
+ <para>
<literal>family(inet '::1')</literal>
<returnvalue>6</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>host</primary>
</indexterm>
<function>host</function> ( <type>inet</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the IP address as text, ignoring the netmask.
- <?br?>
+ </para>
+ <para>
<literal>host(inet '192.168.1.0/24')</literal>
<returnvalue>192.168.1.0</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>hostmask</primary>
</indexterm>
<function>hostmask</function> ( <type>inet</type> )
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the host mask for the address's network.
- <?br?>
+ </para>
+ <para>
<literal>hostmask(inet '192.168.23.20/30')</literal>
<returnvalue>0.0.0.3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>inet_merge</primary>
</indexterm>
<function>inet_merge</function> ( <type>inet</type>, <type>inet</type> )
<returnvalue>cidr</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the smallest network that includes both of the given networks.
- <?br?>
+ </para>
+ <para>
<literal>inet_merge(inet '192.168.1.5/24', inet '192.168.2.5/24')</literal>
<returnvalue>192.168.0.0/22</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>inet_same_family</primary>
</indexterm>
<function>inet_same_family</function> ( <type>inet</type>, <type>inet</type> )
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Tests whether the addresses belong to the same IP family.
- <?br?>
+ </para>
+ <para>
<literal>inet_same_family(inet '192.168.1.5/24', inet '::1')</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>masklen</primary>
</indexterm>
<function>masklen</function> ( <type>inet</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the netmask length in bits.
- <?br?>
+ </para>
+ <para>
<literal>masklen(inet '192.168.1.5/24')</literal>
<returnvalue>24</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>netmask</primary>
</indexterm>
<function>netmask</function> ( <type>inet</type> )
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes the network mask for the address's network.
- <?br?>
+ </para>
+ <para>
<literal>netmask(inet '192.168.1.5/24')</literal>
<returnvalue>255.255.255.0</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>network</primary>
</indexterm>
<function>network</function> ( <type>inet</type> )
<returnvalue>cidr</returnvalue>
- <?br?>
+ </para>
+ <para>
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 <type>cidr</type>.)
- <?br?>
+ </para>
+ <para>
<literal>network(inet '192.168.1.5/24')</literal>
<returnvalue>192.168.1.0/24</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>set_masklen</primary>
</indexterm>
<function>set_masklen</function> ( <type>inet</type>, <type>integer</type> )
<returnvalue>inet</returnvalue>
- <?br?>
+ </para>
+ <para>
Sets the netmask length for an <type>inet</type> value.
The address part does not change.
- <?br?>
+ </para>
+ <para>
<literal>set_masklen(inet '192.168.1.5/24', 16)</literal>
<returnvalue>192.168.1.5/16</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>set_masklen</function> ( <type>cidr</type>, <type>integer</type> )
<returnvalue>cidr</returnvalue>
- <?br?>
+ </para>
+ <para>
Sets the netmask length for a <type>cidr</type> value.
Address bits to the right of the new netmask are set to zero.
- <?br?>
+ </para>
+ <para>
<literal>set_masklen(cidr '192.168.1.0/24', 16)</literal>
<returnvalue>192.168.0.0/16</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>text</primary>
</indexterm>
<function>text</function> ( <type>inet</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the unabbreviated IP address and netmask length as text.
(This has the same result as an explicit cast to <type>text</type>.)
- <?br?>
+ </para>
+ <para>
<literal>text(inet '192.168.1.5')</literal>
<returnvalue>192.168.1.5/32</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>trunc</primary>
</indexterm>
<function>trunc</function> ( <type>macaddr</type> )
<returnvalue>macaddr</returnvalue>
- <?br?>
+ </para>
+ <para>
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 <productname>PostgreSQL</productname>).
- <?br?>
+ </para>
+ <para>
<literal>trunc(macaddr '12:34:56:78:90:ab')</literal>
<returnvalue>12:34:56:00:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>trunc</function> ( <type>macaddr8</type> )
<returnvalue>macaddr8</returnvalue>
- <?br?>
+ </para>
+ <para>
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 <productname>PostgreSQL</productname>).
- <?br?>
+ </para>
+ <para>
<literal>trunc(macaddr8 '12:34:56:78:90:ab:cd:ef')</literal>
<returnvalue>12:34:56:00:00:00:00:00</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>macaddr8_set7bit</primary>
</indexterm>
<function>macaddr8_set7bit</function> ( <type>macaddr8</type> )
<returnvalue>macaddr8</returnvalue>
- <?br?>
+ </para>
+ <para>
Sets the 7th bit of the address to one, creating what is known as
modified EUI-64, for inclusion in an IPv6 address.
- <?br?>
+ </para>
+ <para>
<literal>macaddr8_set7bit(macaddr8 '00:34:56:ab:cd:ef')</literal>
<returnvalue>02:34:56:ff:fe:ab:cd:ef</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Operator<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Operator
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>tsvector</type> <literal>@@</literal> <type>tsquery</type>
- or
+ <returnvalue>boolean</returnvalue>
+ </para>
+ <para role="func_signature">
<type>tsquery</type> <literal>@@</literal> <type>tsvector</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does <type>tsvector</type> match <type>tsquery</type>?
- <?br?>
+ (The arguments can be given in either order.)
+ </para>
+ <para>
<literal>to_tsvector('fat cats ate rats') @@ to_tsquery('cat & rat')</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>@@</literal> <type>tsquery</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does text string, after implicit invocation
of <function>to_tsvector()</function>, match <type>tsquery</type>?
- <?br?>
+ </para>
+ <para>
<literal>'fat cats ate rats' @@ to_tsquery('cat & rat')</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>tsvector</type> <literal>@@@</literal> <type>tsquery</type>
- or
+ <returnvalue>boolean</returnvalue>
+ </para>
+ <para role="func_signature">
<type>tsquery</type> <literal>@@@</literal> <type>tsvector</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
This is a deprecated synonym for <literal>@@</literal>.
- <?br?>
+ </para>
+ <para>
<literal>to_tsvector('fat cats ate rats') @@@ to_tsquery('cat & rat')</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>tsvector</type> <literal>||</literal> <type>tsvector</type>
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Concatenates two <type>tsvector</type>s. If both inputs contain
lexeme positions, the second input's positions are adjusted
accordingly.
- <?br?>
+ </para>
+ <para>
<literal>'a:1 b:2'::tsvector || 'c:1 d:2 b:3'::tsvector</literal>
<returnvalue>'a':1 'b':2,5 'c':3 'd':4</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>tsquery</type> <literal>&&</literal> <type>tsquery</type>
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
ANDs two <type>tsquery</type>s together, producing a query that
matches documents that match both input queries.
- <?br?>
+ </para>
+ <para>
<literal>'fat | rat'::tsquery && 'cat'::tsquery</literal>
<returnvalue>( 'fat' | 'rat' ) & 'cat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>tsquery</type> <literal>||</literal> <type>tsquery</type>
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
ORs two <type>tsquery</type>s together, producing a query that
matches documents that match either input query.
- <?br?>
+ </para>
+ <para>
<literal>'fat | rat'::tsquery || 'cat'::tsquery</literal>
<returnvalue>'fat' | 'rat' | 'cat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<literal>!!</literal> <type>tsquery</type>
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Negates a <type>tsquery</type>, producing a query that matches
documents that do not match the input query.
- <?br?>
+ </para>
+ <para>
<literal>!! 'cat'::tsquery</literal>
<returnvalue>!'cat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>tsquery</type> <literal><-></literal> <type>tsquery</type>
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Constructs a phrase query, which matches if the two input queries
match at successive lexemes.
- <?br?>
+ </para>
+ <para>
<literal>to_tsquery('fat') <-> to_tsquery('rat')</literal>
<returnvalue>'fat' <-> 'rat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>tsquery</type> <literal>@></literal> <type>tsquery</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Does first <type>tsquery</type> contain the second? (This considers
only whether all the lexemes appearing in one query appear in the
other, ignoring the combining operators.)
- <?br?>
+ </para>
+ <para>
<literal>'cat'::tsquery @> 'cat & rat'::tsquery</literal>
<returnvalue>f</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<type>tsquery</type> <literal><@</literal> <type>tsquery</type>
<returnvalue>boolean</returnvalue>
- <?br?>
+ </para>
+ <para>
Is first <type>tsquery</type> contained in the second? (This
considers only whether all the lexemes appearing in one query appear
in the other, ignoring the combining operators.)
- <?br?>
+ </para>
+ <para>
<literal>'cat'::tsquery <@ 'cat & rat'::tsquery</literal>
<returnvalue>t</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>'cat'::tsquery <@ '!cat & rat'::tsquery</literal>
<returnvalue>t</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>array_to_tsvector</primary>
</indexterm>
<function>array_to_tsvector</function> ( <type>text[]</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts an array of lexemes to a <type>tsvector</type>.
The given strings are used as-is without further processing.
- <?br?>
+ </para>
+ <para>
<literal>array_to_tsvector('{fat,cat,rat}'::text[])</literal>
<returnvalue>'cat' 'fat' 'rat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>get_current_ts_config</primary>
</indexterm>
<function>get_current_ts_config</function> ( )
<returnvalue>regconfig</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the OID of the current default text search configuration
(as set by <xref linkend="guc-default-text-search-config"/>).
- <?br?>
+ </para>
+ <para>
<literal>get_current_ts_config()</literal>
<returnvalue>english</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>length</primary>
</indexterm>
<function>length</function> ( <type>tsvector</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of lexemes in the <type>tsvector</type>.
- <?br?>
+ </para>
+ <para>
<literal>length('fat:2,4 cat:3 rat:5A'::tsvector)</literal>
<returnvalue>3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>numnode</primary>
</indexterm>
<function>numnode</function> ( <type>tsquery</type> )
<returnvalue>integer</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns the number of lexemes plus operators in
the <type>tsquery</type>.
- <?br?>
+ </para>
+ <para>
<literal>numnode('(fat & rat) | cat'::tsquery)</literal>
<returnvalue>5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>plainto_tsquery</primary>
</indexterm>
<optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
<replaceable>query</replaceable> <type>text</type> )
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts text to a <type>tsquery</type>, 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.
- <?br?>
+ </para>
+ <para>
<literal>plainto_tsquery('english', 'The Fat Rats')</literal>
<returnvalue>'fat' & 'rat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>phraseto_tsquery</primary>
</indexterm>
<optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
<replaceable>query</replaceable> <type>text</type> )
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts text to a <type>tsquery</type>, 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.
- <?br?>
+ </para>
+ <para>
<literal>phraseto_tsquery('english', 'The Fat Rats')</literal>
<returnvalue>'fat' <-> 'rat'</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>phraseto_tsquery('english', 'The Cat and Rats')</literal>
<returnvalue>'cat' <2> 'rat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>websearch_to_tsquery</primary>
</indexterm>
<optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
<replaceable>query</replaceable> <type>text</type> )
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts text to a <type>tsquery</type>, normalizing words according
to the specified or default configuration. Quoted word sequences are
converted to phrase tests. The word <quote>or</quote> 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.
- <?br?>
+ </para>
+ <para>
<literal>websearch_to_tsquery('english', '"fat rat" or cat dog')</literal>
<returnvalue>'fat' <-> 'rat' | 'cat' & 'dog'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>querytree</primary>
</indexterm>
<function>querytree</function> ( <type>tsquery</type> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Produces a representation of the indexable portion of
a <type>tsquery</type>. A result that is empty or
just <literal>T</literal> indicates a non-indexable query.
- <?br?>
+ </para>
+ <para>
<literal>querytree('foo & ! bar'::tsquery)</literal>
<returnvalue>'foo'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>setweight</primary>
</indexterm>
<function>setweight</function> ( <replaceable>vector</replaceable> <type>tsvector</type>, <replaceable>weight</replaceable> <type>"char"</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Assigns the specified <replaceable>weight</replaceable> to each element
of the <replaceable>vector</replaceable>.
- <?br?>
+ </para>
+ <para>
<literal>setweight('fat:2,4 cat:3 rat:5B'::tsvector, 'A')</literal>
<returnvalue>'cat':3A 'fat':2A,4A 'rat':5A</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>setweight</primary>
<secondary>setweight for specific lexeme(s)</secondary>
</indexterm>
<function>setweight</function> ( <replaceable>vector</replaceable> <type>tsvector</type>, <replaceable>weight</replaceable> <type>"char"</type>, <replaceable>lexemes</replaceable> <type>text[]</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Assigns the specified <replaceable>weight</replaceable> to elements
of the <replaceable>vector</replaceable> that are listed
in <replaceable>lexemes</replaceable>.
- <?br?>
+ </para>
+ <para>
<literal>setweight('fat:2,4 cat:3 rat:5,6B'::tsvector, 'A', '{cat,rat}')</literal>
<returnvalue>'cat':3A 'fat':2,4 'rat':5A,6A</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>strip</primary>
</indexterm>
<function>strip</function> ( <type>tsvector</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes positions and weights from the <type>tsvector</type>.
- <?br?>
+ </para>
+ <para>
<literal>strip('fat:2,4 cat:3 rat:5A'::tsvector)</literal>
<returnvalue>'cat' 'fat' 'rat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_tsquery</primary>
</indexterm>
<optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
<replaceable>query</replaceable> <type>text</type> )
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts text to a <type>tsquery</type>, normalizing words according to
the specified or default configuration. The words must be combined
by valid <type>tsquery</type> operators.
- <?br?>
+ </para>
+ <para>
<literal>to_tsquery('english', 'The & Fat & Rats')</literal>
<returnvalue>'fat' & 'rat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>to_tsvector</primary>
</indexterm>
<optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
<replaceable>document</replaceable> <type>text</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts text to a <type>tsvector</type>, normalizing words according
to the specified or default configuration. Position information is
included in the result.
- <?br?>
+ </para>
+ <para>
<literal>to_tsvector('english', 'The Fat Rats')</literal>
<returnvalue>'fat':2 'rat':3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>to_tsvector</function> (
<optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
- <replaceable>document</replaceable> <type>json(b)</type> )
+ <replaceable>document</replaceable> <type>json</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para role="func_signature">
+ <function>to_tsvector</function> (
+ <optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
+ <replaceable>document</replaceable> <type>jsonb</type> )
+ <returnvalue>tsvector</returnvalue>
+ </para>
+ <para>
Converts each string value in the JSON document to
a <type>tsvector</type>, normalizing words according to the specified
or default configuration. The results are then concatenated in
values. (Beware that <quote>document order</quote> of the fields of a
JSON object is implementation-dependent when the input
is <type>jsonb</type>; observe the difference in the examples.)
- <?br?>
+ </para>
+ <para>
<literal>to_tsvector('english', '{"aa": "The Fat Rats", "b": "dog"}'::json)</literal>
<returnvalue>'dog':5 'fat':2 'rat':3</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>to_tsvector('english', '{"aa": "The Fat Rats", "b": "dog"}'::jsonb)</literal>
<returnvalue>'dog':1 'fat':4 'rat':5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
+ <indexterm>
+ <primary>json_to_tsvector</primary>
+ </indexterm>
+ <function>json_to_tsvector</function> (
+ <optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
+ <replaceable>document</replaceable> <type>json</type>,
+ <replaceable>filter</replaceable> <type>jsonb</type> )
+ <returnvalue>tsvector</returnvalue>
+ </para>
+ <para role="func_signature">
<indexterm>
- <primary>json(b)_to_tsvector</primary>
+ <primary>jsonb_to_tsvector</primary>
</indexterm>
- <function>json(b)_to_tsvector</function> (
+ <function>jsonb_to_tsvector</function> (
<optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
- <replaceable>document</replaceable> <type>json(b)</type>,
+ <replaceable>document</replaceable> <type>jsonb</type>,
<replaceable>filter</replaceable> <type>jsonb</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Selects each item in the JSON document that is requested by
the <replaceable>filter</replaceable> and converts each one to
a <type>tsvector</type>, normalizing words according to the specified
<literal>"all"</literal> (to include all the above).
As a special case, the <replaceable>filter</replaceable> can also be a
simple JSON value that is one of these keywords.
- <?br?>
+ </para>
+ <para>
<literal>json_to_tsvector('english', '{"a": "The Fat Rats", "b": 123}'::json, '["string", "numeric"]')</literal>
<returnvalue>'123':5 'fat':2 'rat':3</returnvalue>
- <?br?>
+ </para>
+ <para>
<literal>json_to_tsvector('english', '{"cat": "The Fat Rats", "dog": 123}'::json, '"all"')</literal>
<returnvalue>'123':9 'cat':1 'dog':7 'fat':4 'rat':5</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_delete</primary>
</indexterm>
<function>ts_delete</function> ( <replaceable>vector</replaceable> <type>tsvector</type>, <replaceable>lexeme</replaceable> <type>text</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes any occurrence of the given <replaceable>lexeme</replaceable>
from the <replaceable>vector</replaceable>.
- <?br?>
+ </para>
+ <para>
<literal>ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, 'fat')</literal>
<returnvalue>'cat':3 'rat':5A</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>ts_delete</function> ( <replaceable>vector</replaceable> <type>tsvector</type>, <replaceable>lexemes</replaceable> <type>text[]</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Removes any occurrences of the lexemes
in <replaceable>lexemes</replaceable>
from the <replaceable>vector</replaceable>.
- <?br?>
+ </para>
+ <para>
<literal>ts_delete('fat:2,4 cat:3 rat:5A'::tsvector, ARRAY['fat','rat'])</literal>
<returnvalue>'cat':3</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_filter</primary>
</indexterm>
<function>ts_filter</function> ( <replaceable>vector</replaceable> <type>tsvector</type>, <replaceable>weights</replaceable> <type>"char"[]</type> )
<returnvalue>tsvector</returnvalue>
- <?br?>
+ </para>
+ <para>
Selects only elements with the given <replaceable>weights</replaceable>
from the <replaceable>vector</replaceable>.
- <?br?>
+ </para>
+ <para>
<literal>ts_filter('fat:2,4 cat:3b,7c rat:5A'::tsvector, '{a,b}')</literal>
<returnvalue>'cat':3B 'rat':5A</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_headline</primary>
</indexterm>
<replaceable>query</replaceable> <type>tsquery</type>
<optional>, <replaceable>options</replaceable> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Displays, in an abbreviated form, the match(es) for
the <replaceable>query</replaceable> in
the <replaceable>document</replaceable>, which must be raw text not
the query. Use of this function is discussed in
<xref linkend="textsearch-headline"/>, which also describes the
available <replaceable>options</replaceable>.
- <?br?>
+ </para>
+ <para>
<literal>ts_headline('The fat cat ate the rat.', 'cat')</literal>
<returnvalue>The fat <b>cat</b> ate the rat.</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
+ <function>ts_headline</function> (
+ <optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
+ <replaceable>document</replaceable> <type>json</type>,
+ <replaceable>query</replaceable> <type>tsquery</type>
+ <optional>, <replaceable>options</replaceable> <type>text</type> </optional> )
+ <returnvalue>text</returnvalue>
+ </para>
+ <para role="func_signature">
<function>ts_headline</function> (
<optional> <replaceable>config</replaceable> <type>regconfig</type>, </optional>
- <replaceable>document</replaceable> <type>json(b)</type>,
+ <replaceable>document</replaceable> <type>jsonb</type>,
<replaceable>query</replaceable> <type>tsquery</type>
<optional>, <replaceable>options</replaceable> <type>text</type> </optional> )
<returnvalue>text</returnvalue>
- <?br?>
+ </para>
+ <para>
Displays, in an abbreviated form, match(es) for
the <replaceable>query</replaceable> that occur in string values
within the JSON <replaceable>document</replaceable>.
See <xref linkend="textsearch-headline"/> for more details.
- <?br?>
+ </para>
+ <para>
<literal>ts_headline('{"cat":"raining cats and dogs"}'::jsonb, 'cat')</literal>
<returnvalue>{"cat": "raining <b>cats</b> and dogs"}</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_rank</primary>
</indexterm>
<replaceable>query</replaceable> <type>tsquery</type>
<optional>, <replaceable>normalization</replaceable> <type>integer</type> </optional> )
<returnvalue>real</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes a score showing how well
the <replaceable>vector</replaceable> matches
the <replaceable>query</replaceable>. See
<xref linkend="textsearch-ranking"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_rank(to_tsvector('raining cats and dogs'), 'cat')</literal>
<returnvalue>0.06079271</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_rank_cd</primary>
</indexterm>
<replaceable>query</replaceable> <type>tsquery</type>
<optional>, <replaceable>normalization</replaceable> <type>integer</type> </optional> )
<returnvalue>real</returnvalue>
- <?br?>
+ </para>
+ <para>
Computes a score showing how well
the <replaceable>vector</replaceable> matches
the <replaceable>query</replaceable>, using a cover density
algorithm. See <xref linkend="textsearch-ranking"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_rank_cd(to_tsvector('raining cats and dogs'), 'cat')</literal>
<returnvalue>0.1</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_rewrite</primary>
</indexterm>
<replaceable>target</replaceable> <type>tsquery</type>,
<replaceable>substitute</replaceable> <type>tsquery</type> )
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Replaces occurrences of <replaceable>target</replaceable>
with <replaceable>substitute</replaceable>
within the <replaceable>query</replaceable>.
See <xref linkend="textsearch-query-rewriting"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_rewrite('a & b'::tsquery, 'a'::tsquery, 'foo|bar'::tsquery)</literal>
<returnvalue>'b' & ( 'foo' | 'bar' )</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>ts_rewrite</function> ( <replaceable>query</replaceable> <type>tsquery</type>,
<replaceable>select</replaceable> <type>text</type> )
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Replaces portions of the <replaceable>query</replaceable> according to
target(s) and substitute(s) obtained by executing
a <command>SELECT</command> command.
See <xref linkend="textsearch-query-rewriting"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>SELECT ts_rewrite('a & b'::tsquery, 'SELECT t,s FROM aliases')</literal>
<returnvalue>'b' & ( 'foo' | 'bar' )</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>tsquery_phrase</primary>
</indexterm>
<function>tsquery_phrase</function> ( <replaceable>query1</replaceable> <type>tsquery</type>, <replaceable>query2</replaceable> <type>tsquery</type> )
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Constructs a phrase query that searches
for matches of <replaceable>query1</replaceable>
and <replaceable>query2</replaceable> at successive lexemes (same
as <literal><-></literal> operator).
- <?br?>
+ </para>
+ <para>
<literal>tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'))</literal>
<returnvalue>'fat' <-> 'cat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>tsquery_phrase</function> ( <replaceable>query1</replaceable> <type>tsquery</type>, <replaceable>query2</replaceable> <type>tsquery</type>, <replaceable>distance</replaceable> <type>integer</type> )
<returnvalue>tsquery</returnvalue>
- <?br?>
+ </para>
+ <para>
Constructs a phrase query that searches
for matches of <replaceable>query1</replaceable> and
<replaceable>query2</replaceable> that occur exactly
<replaceable>distance</replaceable> lexemes apart.
- <?br?>
+ </para>
+ <para>
<literal>tsquery_phrase(to_tsquery('fat'), to_tsquery('cat'), 10)</literal>
<returnvalue>'fat' <10> 'cat'</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>tsvector_to_array</primary>
</indexterm>
<function>tsvector_to_array</function> ( <type>tsvector</type> )
<returnvalue>text[]</returnvalue>
- <?br?>
+ </para>
+ <para>
Converts a <type>tsvector</type> to an array of lexemes.
- <?br?>
+ </para>
+ <para>
<literal>tsvector_to_array('fat:2,4 cat:3 rat:5A'::tsvector)</literal>
<returnvalue>{cat,fat,rat}</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>unnest</primary>
<secondary>for tsvector</secondary>
<literal>OUT</literal> <replaceable>positions</replaceable> <type>smallint[]</type>,
<literal>OUT</literal> <replaceable>weights</replaceable> <type>text</type> )
<returnvalue>setof record</returnvalue>
- <?br?>
+ </para>
+ <para>
Expands a <type>tsvector</type> into a set of rows, one per lexeme.
- <?br?>
- <literal>unnest('cat:3 fat:2,4 rat:5A'::tsvector)</literal>
- <returnvalue>(cat,{3},{D})<?br?>(fat,"{2,4}","{D,D}")<?br?>(rat,{5},{A})</returnvalue><?br?>(3 rows in result)
- </entry>
+ </para>
+ <para>
+ <literal>select * from unnest('cat:3 fat:2,4 rat:5A'::tsvector)</literal>
+ <returnvalue></returnvalue>
+<programlisting>
+ lexeme | positions | weights
+--------+-----------+---------
+ cat | {3} | {D}
+ fat | {2,4} | {D,D}
+ rat | {5} | {A}
+</programlisting>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example(s)
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example(s)
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_debug</primary>
</indexterm>
<literal>OUT</literal> <replaceable>dictionary</replaceable> <type>regdictionary</type>,
<literal>OUT</literal> <replaceable>lexemes</replaceable> <type>text[]</type> )
<returnvalue>setof record</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts and normalizes tokens from
the <replaceable>document</replaceable> according to the specified or
default text search configuration, and returns information about how
each token was processed.
See <xref linkend="textsearch-configuration-testing"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_debug('english', 'The Brightest supernovaes')</literal>
<returnvalue>(asciiword,"Word, all ASCII",The,{english_stem},english_stem,{}) ...</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_lexize</primary>
</indexterm>
<function>ts_lexize</function> ( <replaceable>dict</replaceable> <type>regdictionary</type>, <replaceable>token</replaceable> <type>text</type> )
<returnvalue>text[]</returnvalue>
- <?br?>
+ </para>
+ <para>
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 <xref linkend="textsearch-dictionary-testing"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_lexize('english_stem', 'stars')</literal>
<returnvalue>{star}</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_parse</primary>
</indexterm>
<literal>OUT</literal> <replaceable>tokid</replaceable> <type>integer</type>,
<literal>OUT</literal> <replaceable>token</replaceable> <type>text</type> )
<returnvalue>setof record</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts tokens from the <replaceable>document</replaceable> using the
named parser.
See <xref linkend="textsearch-parser-testing"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_parse('default', 'foo - bar')</literal>
<returnvalue>(1,foo) ...</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>ts_parse</function> ( <replaceable>parser_oid</replaceable> <type>oid</type>,
<replaceable>document</replaceable> <type>text</type>,
<literal>OUT</literal> <replaceable>tokid</replaceable> <type>integer</type>,
<literal>OUT</literal> <replaceable>token</replaceable> <type>text</type> )
<returnvalue>setof record</returnvalue>
- <?br?>
+ </para>
+ <para>
Extracts tokens from the <replaceable>document</replaceable> using a
parser specified by OID.
See <xref linkend="textsearch-parser-testing"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_parse(3722, 'foo - bar')</literal>
<returnvalue>(1,foo) ...</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_token_type</primary>
</indexterm>
<literal>OUT</literal> <replaceable>alias</replaceable> <type>text</type>,
<literal>OUT</literal> <replaceable>description</replaceable> <type>text</type> )
<returnvalue>setof record</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns a table that describes each type of token the named parser can
recognize.
See <xref linkend="textsearch-parser-testing"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_token_type('default')</literal>
<returnvalue>(1,asciiword,"Word, all ASCII") ...</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<function>ts_token_type</function> ( <replaceable>parser_oid</replaceable> <type>oid</type>,
<literal>OUT</literal> <replaceable>tokid</replaceable> <type>integer</type>,
<literal>OUT</literal> <replaceable>alias</replaceable> <type>text</type>,
<literal>OUT</literal> <replaceable>description</replaceable> <type>text</type> )
<returnvalue>setof record</returnvalue>
- <?br?>
+ </para>
+ <para>
Returns a table that describes each type of token a parser specified
by OID can recognize.
See <xref linkend="textsearch-parser-testing"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_token_type(3722)</literal>
<returnvalue>(1,asciiword,"Word, all ASCII") ...</returnvalue>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>ts_stat</primary>
</indexterm>
<literal>OUT</literal> <replaceable>ndoc</replaceable> <type>integer</type>,
<literal>OUT</literal> <replaceable>nentry</replaceable> <type>integer</type> )
<returnvalue>setof record</returnvalue>
- <?br?>
+ </para>
+ <para>
Executes the <replaceable>sqlquery</replaceable>, which must return a
single <type>tsvector</type> column, and returns statistics about each
distinct lexeme contained in the data.
See <xref linkend="textsearch-statistics"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>ts_stat('SELECT vector FROM apod')</literal>
<returnvalue>(foo,10,15) ...</returnvalue>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>
<tgroup cols="1">
<thead>
<row>
- <entry role="functableentry">
- Function<?br?>Description<?br?>Example Usage
- </entry>
+ <entry role="func_table_entry"><para role="func_signature">
+ Function
+ </para>
+ <para>
+ Description
+ </para>
+ <para>
+ Example Usage
+ </para></entry>
</row>
</thead>
<tbody>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>suppress_redundant_updates_trigger</primary>
</indexterm>
<function>suppress_redundant_updates_trigger</function> ( )
<returnvalue>trigger</returnvalue>
- <?br?>
+ </para>
+ <para>
Suppresses do-nothing update operations. See below for details.
- <?br?>
+ </para>
+ <para>
<literal>CREATE TRIGGER ... suppress_redundant_updates_trigger()</literal>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>tsvector_update_trigger</primary>
</indexterm>
<function>tsvector_update_trigger</function> ( )
<returnvalue>trigger</returnvalue>
- <?br?>
+ </para>
+ <para>
Automatically updates a <type>tsvector</type> column from associated
plain-text document column(s). The text search configuration to use
is specified by name as a trigger argument. See
<xref linkend="textsearch-update-triggers"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>CREATE TRIGGER ... tsvector_update_trigger(tsvcol, 'pg_catalog.swedish', title, body)</literal>
- </entry>
+ </para></entry>
</row>
<row>
- <entry role="functableentry">
+ <entry role="func_table_entry"><para role="func_signature">
<indexterm>
<primary>tsvector_update_trigger_column</primary>
</indexterm>
<function>tsvector_update_trigger_column</function> ( )
<returnvalue>trigger</returnvalue>
- <?br?>
+ </para>
+ <para>
Automatically updates a <type>tsvector</type> column from associated
plain-text document column(s). The text search configuration to use
is taken from a <type>regconfig</type> column of the table. See
<xref linkend="textsearch-update-triggers"/> for details.
- <?br?>
+ </para>
+ <para>
<literal>CREATE TRIGGER ... tsvector_update_trigger_column(tsvcol, tsconfigcol, title, body)</literal>
- </entry>
+ </para></entry>
</row>
</tbody>
</tgroup>