Commit b2fd8ebe authored by Tom Lane's avatar Tom Lane

Doc: update remaining tables of functions/operators for new layout.

This converts the contrib documentation to the new style, and mops up
a couple of function tables that were outside chapter 9 in the main
docs.

A few contrib modules choose not to present their functions in the
standard tabular format.  There might be room to rethink those decisions
now that the standard format is more friendly to verbose descriptions.
But I have not undertaken to do that here; I just converted existing
tables.
parent c265ed9b
...@@ -29,47 +29,67 @@ ...@@ -29,47 +29,67 @@
<table id="functions-adminpack-table"> <table id="functions-adminpack-table">
<title><filename>adminpack</filename> Functions</title> <title><filename>adminpack</filename> Functions</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row><entry>Name</entry> <entry>Return Type</entry> <entry>Description</entry> <row>
<entry role="func_table_entry"><para role="func_signature">
Function
</para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>pg_catalog.pg_file_write(filename text, data text, append boolean)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>bigint</type></entry> <function>pg_catalog.pg_file_write</function> ( <parameter>filename</parameter> <type>text</type>, <parameter>data</parameter> <type>text</type>, <parameter>append</parameter> <type>boolean</type> )
<entry> <returnvalue>bigint</returnvalue>
Write, or append to, a text file </para>
</entry> <para>
Writes, or appends to, a text file.
</para></entry>
</row> </row>
<row> <row>
<entry><function>pg_catalog.pg_file_sync(filename text)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>void</type></entry> <function>pg_catalog.pg_file_sync</function> ( <parameter>filename</parameter> <type>text</type> )
<entry> <returnvalue>void</returnvalue>
Flush a file or directory to disk </para>
</entry> <para>
Flushes a file or directory to disk.
</para></entry>
</row> </row>
<row> <row>
<entry><function>pg_catalog.pg_file_rename(oldname text, newname text <optional>, archivename text</optional>)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <function>pg_catalog.pg_file_rename</function> ( <parameter>oldname</parameter> <type>text</type>, <parameter>newname</parameter> <type>text</type> <optional>, <parameter>archivename</parameter> <type>text</type> </optional> )
<entry> <returnvalue>boolean</returnvalue>
Rename a file </para>
</entry> <para>
Renames a file.
</para></entry>
</row> </row>
<row> <row>
<entry><function>pg_catalog.pg_file_unlink(filename text)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <function>pg_catalog.pg_file_unlink</function> ( <parameter>filename</parameter> <type>text</type> )
<entry> <returnvalue>boolean</returnvalue>
Remove a file </para>
</entry> <para>
Removes a file.
</para></entry>
</row> </row>
<row> <row>
<entry><function>pg_catalog.pg_logdir_ls()</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof record</type></entry> <function>pg_catalog.pg_logdir_ls</function> ()
<entry> <returnvalue>setof record</returnvalue>
List the log files in the <varname>log_directory</varname> directory </para>
</entry> <para>
Lists the log files in the <varname>log_directory</varname> directory.
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -112,113 +112,112 @@ ...@@ -112,113 +112,112 @@
<title>Usage</title> <title>Usage</title>
<para> <para>
<xref linkend="cube-operators-table"/> shows the operators provided for <xref linkend="cube-operators-table"/> shows the specialized operators
type <type>cube</type>. provided for type <type>cube</type>.
</para> </para>
<table id="cube-operators-table"> <table id="cube-operators-table">
<title>Cube Operators</title> <title>Cube Operators</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Operator</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Result</entry> Operator
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><literal>a = b</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>cube</type> <literal>&amp;&amp;</literal> <type>cube</type>
<entry>The cubes a and b are identical.</entry> <returnvalue>boolean</returnvalue>
</row> </para>
<para>
<row> Do the cubes overlap?
<entry><literal>a &amp;&amp; b</literal></entry> </para></entry>
<entry><type>boolean</type></entry>
<entry>The cubes a and b overlap.</entry>
</row>
<row>
<entry><literal>a @&gt; b</literal></entry>
<entry><type>boolean</type></entry>
<entry>The cube a contains the cube b.</entry>
</row>
<row>
<entry><literal>a &lt;@ b</literal></entry>
<entry><type>boolean</type></entry>
<entry>The cube a is contained in the cube b.</entry>
</row>
<row>
<entry><literal>a &lt; b</literal></entry>
<entry><type>boolean</type></entry>
<entry>The cube a is less than the cube b.</entry>
</row>
<row>
<entry><literal>a &lt;= b</literal></entry>
<entry><type>boolean</type></entry>
<entry>The cube a is less than or equal to the cube b.</entry>
</row>
<row>
<entry><literal>a &gt; b</literal></entry>
<entry><type>boolean</type></entry>
<entry>The cube a is greater than the cube b.</entry>
</row> </row>
<row> <row>
<entry><literal>a &gt;= b</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>cube</type> <literal>@&gt;</literal> <type>cube</type>
<entry>The cube a is greater than or equal to the cube b.</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Does the first cube contain the second?
</para></entry>
</row> </row>
<row> <row>
<entry><literal>a &lt;&gt; b</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>cube</type> <literal>&lt;@</literal> <type>cube</type>
<entry>The cube a is not equal to the cube b.</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Is the first cube contained in the second?
</para></entry>
</row> </row>
<row> <row>
<entry><literal>a -&gt; n</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <type>cube</type> <literal>-&gt;</literal> <type>integer</type>
<entry>Get <replaceable>n</replaceable>-th coordinate of cube (counting from 1).</entry> <returnvalue>float8</returnvalue>
</para>
<para>
Extracts the <parameter>n</parameter>-th coordinate of the cube
(counting from 1).
</para></entry>
</row> </row>
<row> <row>
<entry><literal>a ~&gt; n</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <type>cube</type> <literal>~&gt;</literal> <type>integer</type>
<entry> <returnvalue>float8</returnvalue>
Get <replaceable>n</replaceable>-th coordinate of cube in following way: </para>
n = 2 * k - 1 means lower bound of <replaceable>k</replaceable>-th <para>
dimension, n = 2 * k means upper bound of Extracts the <parameter>n</parameter>-th coordinate of the cube,
<replaceable>k</replaceable>-th dimension. Negative counting in the following way: <parameter>n</parameter> = 2
<replaceable>n</replaceable> denotes the inverse value of the corresponding * <parameter>k</parameter> - 1 means lower bound
of <parameter>k</parameter>-th dimension, <parameter>n</parameter> = 2
* <parameter>k</parameter> means upper bound of
<parameter>k</parameter>-th dimension. Negative
<parameter>n</parameter> denotes the inverse value of the corresponding
positive coordinate. This operator is designed for KNN-GiST support. positive coordinate. This operator is designed for KNN-GiST support.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><literal>a &lt;-&gt; b</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <type>cube</type> <literal>&lt;-&gt;</literal> <type>cube</type>
<entry>Euclidean distance between a and b.</entry> <returnvalue>float8</returnvalue>
</para>
<para>
Computes the Euclidean distance between the two cubes.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>a &lt;#&gt; b</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <type>cube</type> <literal>&lt;#&gt;</literal> <type>cube</type>
<entry>Taxicab (L-1 metric) distance between a and b.</entry> <returnvalue>float8</returnvalue>
</para>
<para>
Computes the taxicab (L-1 metric) distance between the two cubes.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>a &lt;=&gt; b</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <type>cube</type> <literal>&lt;=&gt;</literal> <type>cube</type>
<entry>Chebyshev (L-inf metric) distance between a and b.</entry> <returnvalue>float8</returnvalue>
</para>
<para>
Computes the Chebyshev (L-inf metric) distance between the two cubes.
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
...@@ -232,12 +231,14 @@ ...@@ -232,12 +231,14 @@
</para> </para>
<para> <para>
The scalar ordering operators (<literal>&lt;</literal>, <literal>&gt;=</literal>, etc) In addition to the above operators, the usual comparison
do not make a lot of sense for any practical purpose but sorting. These operators shown in <xref linkend="functions-comparison-op-table"/> are
available for type <type>cube</type>. These
operators first compare the first coordinates, and if those are equal, operators first compare the first coordinates, and if those are equal,
compare the second coordinates, etc. They exist mainly to support the compare the second coordinates, etc. They exist mainly to support the
b-tree index operator class for <type>cube</type>, which can be useful for b-tree index operator class for <type>cube</type>, which can be useful for
example if you would like a UNIQUE constraint on a <type>cube</type> column. example if you would like a UNIQUE constraint on a <type>cube</type> column.
Otherwise, this ordering is not of much practical use.
</para> </para>
<para> <para>
...@@ -281,192 +282,259 @@ SELECT c FROM test ORDER BY c ~&gt; 3 DESC LIMIT 5; ...@@ -281,192 +282,259 @@ SELECT c FROM test ORDER BY c ~&gt; 3 DESC LIMIT 5;
<table id="cube-functions-table"> <table id="cube-functions-table">
<title>Cube Functions</title> <title>Cube Functions</title>
<tgroup cols="4"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Result</entry> Function
<entry>Description</entry> </para>
<entry>Example</entry> <para>
Description
</para>
<para>
Example(s)
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><literal>cube(float8)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube</function> ( <type>float8</type> )
<entry>Makes a one dimensional cube with both coordinates the same. <returnvalue>cube</returnvalue>
</entry> </para>
<entry> <para>
<literal>cube(1) == '(1)'</literal> Makes a one dimensional cube with both coordinates the same.
</entry> </para>
<para>
<literal>cube(1)</literal>
<returnvalue>(1)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube(float8, float8)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube</function> ( <type>float8</type>, <type>float8</type> )
<entry>Makes a one dimensional cube. <returnvalue>cube</returnvalue>
</entry> </para>
<entry> <para>
<literal>cube(1,2) == '(1),(2)'</literal> Makes a one dimensional cube.
</entry> </para>
<para>
<literal>cube(1,2)</literal>
<returnvalue>(1),(2)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube(float8[])</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube</function> ( <type>float8[]</type> )
<entry>Makes a zero-volume cube using the coordinates <returnvalue>cube</returnvalue>
defined by the array. </para>
</entry> <para>
<entry> Makes a zero-volume cube using the coordinates defined by the array.
<literal>cube(ARRAY[1,2]) == '(1,2)'</literal> </para>
</entry> <para>
<literal>cube(ARRAY[1,2,3])</literal>
<returnvalue>(1, 2, 3)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube(float8[], float8[])</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube</function> ( <type>float8[]</type>, <type>float8[]</type> )
<entry>Makes a cube with upper right and lower left <returnvalue>cube</returnvalue>
coordinates as defined by the two arrays, which must be of the </para>
same length. <para>
</entry> Makes a cube with upper right and lower left coordinates as defined by
<entry> the two arrays, which must be of the same length.
<literal>cube(ARRAY[1,2], ARRAY[3,4]) == '(1,2),(3,4)' </para>
</literal> <para>
</entry> <literal>cube(ARRAY[1,2], ARRAY[3,4])</literal>
<returnvalue>(1, 2),(3, 4)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube(cube, float8)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube</function> ( <type>cube</type>, <type>float8</type> )
<entry>Makes a new cube by adding a dimension on to an existing cube, <returnvalue>cube</returnvalue>
</para>
<para>
Makes a new cube by adding a dimension on to an existing cube,
with the same values for both endpoints of the new coordinate. This with the same values for both endpoints of the new coordinate. This
is useful for building cubes piece by piece from calculated values. is useful for building cubes piece by piece from calculated values.
</entry> </para>
<entry> <para>
<literal>cube('(1,2),(3,4)'::cube, 5) == '(1,2,5),(3,4,5)'</literal> <literal>cube('(1,2),(3,4)'::cube, 5)</literal>
</entry> <returnvalue>(1, 2, 5),(3, 4, 5)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube(cube, float8, float8)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube</function> ( <type>cube</type>, <type>float8</type>, <type>float8</type> )
<entry>Makes a new cube by adding a dimension on to an existing <returnvalue>cube</returnvalue>
cube. This is useful for building cubes piece by piece from calculated </para>
values. <para>
</entry> Makes a new cube by adding a dimension on to an existing cube. This is
<entry> useful for building cubes piece by piece from calculated values.
<literal>cube('(1,2),(3,4)'::cube, 5, 6) == '(1,2,5),(3,4,6)'</literal> </para>
</entry> <para>
<literal>cube('(1,2),(3,4)'::cube, 5, 6)</literal>
<returnvalue>(1, 2, 5),(3, 4, 6)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_dim(cube)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>integer</type></entry> <function>cube_dim</function> ( <type>cube</type> )
<entry>Returns the number of dimensions of the cube. <returnvalue>integer</returnvalue>
</entry> </para>
<entry> <para>
<literal>cube_dim('(1,2),(3,4)') == '2'</literal> Returns the number of dimensions of the cube.
</entry> </para>
<para>
<literal>cube_dim('(1,2),(3,4)')</literal>
<returnvalue>2</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_ll_coord(cube, integer)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <function>cube_ll_coord</function> ( <type>cube</type>, <type>integer</type> )
<entry>Returns the <replaceable>n</replaceable>-th coordinate value for the lower <returnvalue>float8</returnvalue>
</para>
<para>
Returns the <parameter>n</parameter>-th coordinate value for the lower
left corner of the cube. left corner of the cube.
</entry> </para>
<entry> <para>
<literal>cube_ll_coord('(1,2),(3,4)', 2) == '2'</literal> <literal>cube_ll_coord('(1,2),(3,4)', 2)</literal>
</entry> <returnvalue>2</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_ur_coord(cube, integer)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <function>cube_ur_coord</function> ( <type>cube</type>, <type>integer</type> )
<entry>Returns the <replaceable>n</replaceable>-th coordinate value for the <returnvalue>float8</returnvalue>
</para>
<para>
Returns the <parameter>n</parameter>-th coordinate value for the
upper right corner of the cube. upper right corner of the cube.
</entry> </para>
<entry> <para>
<literal>cube_ur_coord('(1,2),(3,4)', 2) == '4'</literal> <literal>cube_ur_coord('(1,2),(3,4)', 2)</literal>
</entry> <returnvalue>4</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_is_point(cube)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <function>cube_is_point</function> ( <type>cube</type> )
<entry>Returns true if the cube is a point, that is, <returnvalue>boolean</returnvalue>
the two defining corners are the same.</entry> </para>
<entry> <para>
</entry> Returns true if the cube is a point, that is,
the two defining corners are the same.
</para>
<para>
<literal>cube_is_point(cube(1,1))</literal>
<returnvalue>t</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_distance(cube, cube)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <function>cube_distance</function> ( <type>cube</type>, <type>cube</type> )
<entry>Returns the distance between two cubes. If both <returnvalue>float8</returnvalue>
</para>
<para>
Returns the distance between two cubes. If both
cubes are points, this is the normal distance function. cubes are points, this is the normal distance function.
</entry> </para>
<entry> <para>
</entry> <literal>cube_distance('(1,2)', '(3,4)')</literal>
<returnvalue>2.8284271247461903</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_subset(cube, integer[])</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube_subset</function> ( <type>cube</type>, <type>integer[]</type> )
<entry>Makes a new cube from an existing cube, using a list of <returnvalue>cube</returnvalue>
</para>
<para>
Makes a new cube from an existing cube, using a list of
dimension indexes from an array. Can be used to extract the endpoints dimension indexes from an array. Can be used to extract the endpoints
of a single dimension, or to drop dimensions, or to reorder them as of a single dimension, or to drop dimensions, or to reorder them as
desired. desired.
</entry> </para>
<entry> <para>
<literal>cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[2]) == '(3),(7)'</literal> <literal>cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[2])</literal>
<literal>cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[3,2,1,1]) == <returnvalue>(3),(7)</returnvalue>
'(5,3,1,1),(8,7,6,6)'</literal> </para>
</entry> <para>
<literal>cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[3,2,1,1])</literal>
<returnvalue>(5, 3, 1, 1),(8, 7, 6, 6)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_union(cube, cube)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube_union</function> ( <type>cube</type>, <type>cube</type> )
<entry>Produces the union of two cubes. <returnvalue>cube</returnvalue>
</entry> </para>
<entry> <para>
</entry> Produces the union of two cubes.
</para>
<para>
<literal>cube_union('(1,2)', '(3,4)')</literal>
<returnvalue>(1, 2),(3, 4)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_inter(cube, cube)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube_inter</function> ( <type>cube</type>, <type>cube</type> )
<entry>Produces the intersection of two cubes. <returnvalue>cube</returnvalue>
</entry> </para>
<entry> <para>
</entry> Produces the intersection of two cubes.
</para>
<para>
<literal>cube_inter('(1,2)', '(3,4)')</literal>
<returnvalue>(3, 4),(1, 2)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>cube_enlarge(c cube, r double, n integer)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <function>cube_enlarge</function> ( <parameter>c</parameter> <type>cube</type>, <parameter>r</parameter> <type>double</type>, <parameter>n</parameter> <type>integer</type> )
<entry>Increases the size of the cube by the specified <returnvalue>cube</returnvalue>
radius <replaceable>r</replaceable> in at least <replaceable>n</replaceable> dimensions. </para>
If the radius is negative the cube is shrunk instead. <para>
All defined dimensions are changed by the radius <replaceable>r</replaceable>. Increases the size of the cube by the specified
Lower-left coordinates are decreased by <replaceable>r</replaceable> and radius <parameter>r</parameter> in at least <parameter>n</parameter>
upper-right coordinates are increased by <replaceable>r</replaceable>. If a dimensions. If the radius is negative the cube is shrunk instead.
lower-left coordinate is increased to more than the corresponding All defined dimensions are changed by the
upper-right coordinate (this can only happen when <replaceable>r</replaceable> radius <parameter>r</parameter>. Lower-left coordinates are decreased
&lt; 0) than both coordinates are set to their average. by <parameter>r</parameter> and upper-right coordinates are increased
If <replaceable>n</replaceable> is greater than the number of defined dimensions by <parameter>r</parameter>. If a lower-left coordinate is increased
and the cube is being enlarged (<replaceable>r</replaceable> &gt; 0), then extra to more than the corresponding upper-right coordinate (this can only
dimensions are added to make <replaceable>n</replaceable> altogether; happen when <parameter>r</parameter> &lt; 0) than both coordinates are
0 is used as the initial value for the extra coordinates. set to their average. If <parameter>n</parameter> is greater than the
This function is useful for creating bounding boxes around a point for number of defined dimensions and the cube is being enlarged
searching for nearby points. (<parameter>r</parameter> &gt; 0), then extra dimensions are added to
</entry> make <parameter>n</parameter> altogether; 0 is used as the initial
<entry> value for the extra coordinates. This function is useful for creating
<literal>cube_enlarge('(1,2),(3,4)', 0.5, 3) == bounding boxes around a point for searching for nearby points.
'(0.5,1.5,-0.5),(3.5,4.5,0.5)'</literal> </para>
</entry> <para>
<literal>cube_enlarge('(1,2),(3,4)', 0.5, 3)</literal>
<returnvalue>(0.5, 1.5, -0.5),(3.5, 4.5, 0.5)</returnvalue>
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -67,74 +67,118 @@ ...@@ -67,74 +67,118 @@
<table id="earthdistance-cube-functions"> <table id="earthdistance-cube-functions">
<title>Cube-Based Earthdistance Functions</title> <title>Cube-Based Earthdistance Functions</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Function
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>earth()</function><indexterm><primary>earth</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <indexterm><primary>earth</primary></indexterm>
<entry>Returns the assumed radius of the Earth.</entry> <function>earth</function> ()
<returnvalue>float8</returnvalue>
</para>
<para>
Returns the assumed radius of the Earth.
</para></entry>
</row> </row>
<row> <row>
<entry><function>sec_to_gc(float8)</function><indexterm><primary>sec_to_gc</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <indexterm><primary>sec_to_gc</primary></indexterm>
<entry>Converts the normal straight line <function>sec_to_gc</function> ( <type>float8</type> )
<returnvalue>float8</returnvalue>
</para>
<para>
Converts the normal straight line
(secant) distance between two points on the surface of the Earth (secant) distance between two points on the surface of the Earth
to the great circle distance between them. to the great circle distance between them.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>gc_to_sec(float8)</function><indexterm><primary>gc_to_sec</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <indexterm><primary>gc_to_sec</primary></indexterm>
<entry>Converts the great circle distance between two points on the <function>gc_to_sec</function> ( <type>float8</type> )
<returnvalue>float8</returnvalue>
</para>
<para>
Converts the great circle distance between two points on the
surface of the Earth to the normal straight line (secant) distance surface of the Earth to the normal straight line (secant) distance
between them. between them.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>ll_to_earth(float8, float8)</function><indexterm><primary>ll_to_earth</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>earth</type></entry> <indexterm><primary>ll_to_earth</primary></indexterm>
<entry>Returns the location of a point on the surface of the Earth given <function>ll_to_earth</function> ( <type>float8</type>, <type>float8</type> )
<returnvalue>earth</returnvalue>
</para>
<para>
Returns the location of a point on the surface of the Earth given
its latitude (argument 1) and longitude (argument 2) in degrees. its latitude (argument 1) and longitude (argument 2) in degrees.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>latitude(earth)</function><indexterm><primary>latitude</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <indexterm><primary>latitude</primary></indexterm>
<entry>Returns the latitude in degrees of a point on the surface of the <function>latitude</function> ( <type>earth</type> )
<returnvalue>float8</returnvalue>
</para>
<para>
Returns the latitude in degrees of a point on the surface of the
Earth. Earth.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>longitude(earth)</function><indexterm><primary>longitude</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <indexterm><primary>longitude</primary></indexterm>
<entry>Returns the longitude in degrees of a point on the surface of the <function>longitude</function> ( <type>earth</type> )
<returnvalue>float8</returnvalue>
</para>
<para>
Returns the longitude in degrees of a point on the surface of the
Earth. Earth.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>earth_distance(earth, earth)</function><indexterm><primary>earth_distance</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <indexterm><primary>earth_distance</primary></indexterm>
<entry>Returns the great circle distance between two points on the <function>earth_distance</function> ( <type>earth</type>, <type>earth</type> )
<returnvalue>float8</returnvalue>
</para>
<para>
Returns the great circle distance between two points on the
surface of the Earth. surface of the Earth.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>earth_box(earth, float8)</function><indexterm><primary>earth_box</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>cube</type></entry> <indexterm><primary>earth_box</primary></indexterm>
<entry>Returns a box suitable for an indexed search using the cube <function>earth_box</function> ( <type>earth</type>, <type>float8</type> )
<returnvalue>cube</returnvalue>
</para>
<para>
Returns a box suitable for an indexed search using the <type>cube</type>
<literal>@&gt;</literal> <literal>@&gt;</literal>
operator for points within a given great circle distance of a location. operator for points within a given great circle distance of a location.
Some points in this box are further than the specified great circle Some points in this box are further than the specified great circle
distance from the location, so a second check using distance from the location, so a second check using
<function>earth_distance</function> should be included in the query. <function>earth_distance</function> should be included in the query.
</entry> </para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -161,21 +205,27 @@ ...@@ -161,21 +205,27 @@
<table id="earthdistance-point-operators"> <table id="earthdistance-point-operators">
<title>Point-Based Earthdistance Operators</title> <title>Point-Based Earthdistance Operators</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Operator</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Operator
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><type>point</type> <literal>&lt;@&gt;</literal> <type>point</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>float8</type></entry> <type>point</type> <literal>&lt;@&gt;</literal> <type>point</type>
<entry>Gives the distance in statute miles between <returnvalue>float8</returnvalue>
</para>
<para>
Computes the distance in statute miles between
two points on the Earth's surface. two points on the Earth's surface.
</entry> </para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -99,116 +99,221 @@ key =&gt; NULL ...@@ -99,116 +99,221 @@ key =&gt; NULL
<table id="hstore-op-table"> <table id="hstore-op-table">
<title><type>hstore</type> Operators</title> <title><type>hstore</type> Operators</title>
<tgroup cols="1">
<tgroup cols="4">
<thead> <thead>
<row> <row>
<entry>Operator</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Description</entry> Operator
<entry>Example</entry> </para>
<entry>Result</entry> <para>
Description
</para>
<para>
Example(s)
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><type>hstore</type> <literal>-&gt;</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>get value for key (<literal>NULL</literal> if not present)</entry> <type>hstore</type> <literal>-&gt;</literal> <type>text</type>
<entry><literal>'a=&gt;x, b=&gt;y'::hstore -&gt; 'a'</literal></entry> <returnvalue>text</returnvalue>
<entry><literal>x</literal></entry> </para>
<para>
Returns value associated with given key, or <literal>NULL</literal> if
not present.
</para>
<para>
<literal>'a=&gt;x, b=&gt;y'::hstore -&gt; 'a'</literal>
<returnvalue>x</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>-&gt;</literal> <type>text[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>get values for keys (<literal>NULL</literal> if not present)</entry> <type>hstore</type> <literal>-&gt;</literal> <type>text[]</type>
<entry><literal>'a=&gt;x, b=&gt;y, c=&gt;z'::hstore -&gt; ARRAY['c','a']</literal></entry> <returnvalue>text[]</returnvalue>
<entry><literal>{"z","x"}</literal></entry> </para>
<para>
Returns values associated with given keys, or <literal>NULL</literal>
if not present.
</para>
<para>
<literal>'a=&gt;x, b=&gt;y, c=&gt;z'::hstore -&gt; ARRAY['c','a']</literal>
<returnvalue>{"z","x"}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>||</literal> <type>hstore</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>concatenate <type>hstore</type>s</entry> <type>hstore</type> <literal>||</literal> <type>hstore</type>
<entry><literal>'a=&gt;b, c=&gt;d'::hstore || 'c=&gt;x, d=&gt;q'::hstore</literal></entry> <returnvalue>hstore</returnvalue>
<entry><literal>"a"=&gt;"b", "c"=&gt;"x", "d"=&gt;"q"</literal></entry> </para>
<para>
Concatenates two <type>hstore</type>s.
</para>
<para>
<literal>'a=&gt;b, c=&gt;d'::hstore || 'c=&gt;x, d=&gt;q'::hstore</literal>
<returnvalue>"a"=&gt;"b", "c"=&gt;"x", "d"=&gt;"q"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>?</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>does <type>hstore</type> contain key?</entry> <type>hstore</type> <literal>?</literal> <type>text</type>
<entry><literal>'a=&gt;1'::hstore ? 'a'</literal></entry> <returnvalue>boolean</returnvalue>
<entry><literal>t</literal></entry> </para>
<para>
Does <type>hstore</type> contain key?
</para>
<para>
<literal>'a=&gt;1'::hstore ? 'a'</literal>
<returnvalue>t</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>?&amp;</literal> <type>text[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>does <type>hstore</type> contain all specified keys?</entry> <type>hstore</type> <literal>?&amp;</literal> <type>text[]</type>
<entry><literal>'a=&gt;1,b=&gt;2'::hstore ?&amp; ARRAY['a','b']</literal></entry> <returnvalue>boolean</returnvalue>
<entry><literal>t</literal></entry> </para>
<para>
Does <type>hstore</type> contain all the specified keys?
</para>
<para>
<literal>'a=&gt;1,b=&gt;2'::hstore ?&amp; ARRAY['a','b']</literal>
<returnvalue>t</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>?|</literal> <type>text[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>does <type>hstore</type> contain any of the specified keys?</entry> <type>hstore</type> <literal>?|</literal> <type>text[]</type>
<entry><literal>'a=&gt;1,b=&gt;2'::hstore ?| ARRAY['b','c']</literal></entry> <returnvalue>boolean</returnvalue>
<entry><literal>t</literal></entry> </para>
<para>
Does <type>hstore</type> contain any of the specified keys?
</para>
<para>
<literal>'a=&gt;1,b=&gt;2'::hstore ?| ARRAY['b','c']</literal>
<returnvalue>t</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>@&gt;</literal> <type>hstore</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>does left operand contain right?</entry> <type>hstore</type> <literal>@&gt;</literal> <type>hstore</type>
<entry><literal>'a=&gt;b, b=&gt;1, c=&gt;NULL'::hstore @&gt; 'b=&gt;1'</literal></entry> <returnvalue>boolean</returnvalue>
<entry><literal>t</literal></entry> </para>
<para>
Does left operand contain right?
</para>
<para>
<literal>'a=&gt;b, b=&gt;1, c=&gt;NULL'::hstore @&gt; 'b=&gt;1'</literal>
<returnvalue>t</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>&lt;@</literal> <type>hstore</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>is left operand contained in right?</entry> <type>hstore</type> <literal>&lt;@</literal> <type>hstore</type>
<entry><literal>'a=&gt;c'::hstore &lt;@ 'a=&gt;b, b=&gt;1, c=&gt;NULL'</literal></entry> <returnvalue>boolean</returnvalue>
<entry><literal>f</literal></entry> </para>
<para>
Is left operand contained in right?
</para>
<para>
<literal>'a=&gt;c'::hstore &lt;@ 'a=&gt;b, b=&gt;1, c=&gt;NULL'</literal>
<returnvalue>f</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>-</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>delete key from left operand</entry> <type>hstore</type> <literal>-</literal> <type>text</type>
<entry><literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - 'b'::text</literal></entry> <returnvalue>hstore</returnvalue>
<entry><literal>"a"=&gt;"1", "c"=&gt;"3"</literal></entry> </para>
<para>
Deletes key from left operand.
</para>
<para>
<literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - 'b'::text</literal>
<returnvalue>"a"=&gt;"1", "c"=&gt;"3"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>-</literal> <type>text[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>delete keys from left operand</entry> <type>hstore</type> <literal>-</literal> <type>text[]</type>
<entry><literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - ARRAY['a','b']</literal></entry> <returnvalue>hstore</returnvalue>
<entry><literal>"c"=&gt;"3"</literal></entry> </para>
<para>
Deletes keys from left operand.
</para>
<para>
<literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - ARRAY['a','b']</literal>
<returnvalue>"c"=&gt;"3"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>hstore</type> <literal>-</literal> <type>hstore</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>delete matching pairs from left operand</entry> <type>hstore</type> <literal>-</literal> <type>hstore</type>
<entry><literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - 'a=&gt;4, b=&gt;2'::hstore</literal></entry> <returnvalue>hstore</returnvalue>
<entry><literal>"a"=&gt;"1", "c"=&gt;"3"</literal></entry> </para>
<para>
Deletes pairs from left operand that match pairs in the right operand.
</para>
<para>
<literal>'a=&gt;1, b=&gt;2, c=&gt;3'::hstore - 'a=&gt;4, b=&gt;2'::hstore</literal>
<returnvalue>"a"=&gt;"1", "c"=&gt;"3"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><type>record</type> <literal>#=</literal> <type>hstore</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>replace fields in <type>record</type> with matching values from <type>hstore</type></entry> <type>anyelement</type> <literal>#=</literal> <type>hstore</type>
<entry>see Examples section</entry> <returnvalue>anyelement</returnvalue>
<entry></entry> </para>
<para>
Replaces fields in the left operand (which must be a composite type)
with matching values from <type>hstore</type>.
</para>
<para>
<literal>ROW(1,3) #= 'f1=>11'::hstore</literal>
<returnvalue>(11,3)</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>%%</literal> <type>hstore</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>convert <type>hstore</type> to array of alternating keys and values</entry> <literal>%%</literal> <type>hstore</type>
<entry><literal>%% 'a=&gt;foo, b=&gt;bar'::hstore</literal></entry> <returnvalue>text[]</returnvalue>
<entry><literal>{a,foo,b,bar}</literal></entry> </para>
<para>
Converts <type>hstore</type> to an array of alternating keys and
values.
</para>
<para>
<literal>%% 'a=&gt;foo, b=&gt;bar'::hstore</literal>
<returnvalue>{a,foo,b,bar}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>%#</literal> <type>hstore</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>convert <type>hstore</type> to two-dimensional key/value array</entry> <literal>%#</literal> <type>hstore</type>
<entry><literal>%# 'a=&gt;foo, b=&gt;bar'::hstore</literal></entry> <returnvalue>text[]</returnvalue>
<entry><literal>{{a,foo},{b,bar}}</literal></entry> </para>
<para>
Converts <type>hstore</type> to a two-dimensional key/value array.
</para>
<para>
<literal>%# 'a=&gt;foo, b=&gt;bar'::hstore</literal>
<returnvalue>{{a,foo},{b,bar}}</returnvalue>
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
...@@ -225,233 +330,389 @@ key =&gt; NULL ...@@ -225,233 +330,389 @@ key =&gt; NULL
<table id="hstore-func-table"> <table id="hstore-func-table">
<title><type>hstore</type> Functions</title> <title><type>hstore</type> Functions</title>
<tgroup cols="1">
<tgroup cols="5">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Return Type</entry> Function
<entry>Description</entry> </para>
<entry>Example</entry> <para>
<entry>Result</entry> Description
</para>
<para>
Example(s)
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>hstore(record)</function><indexterm><primary>hstore</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>hstore</type></entry> <indexterm><primary>hstore</primary></indexterm>
<entry>construct an <type>hstore</type> from a record or row</entry> <function>hstore</function> ( <type>record</type> )
<entry><literal>hstore(ROW(1,2))</literal></entry> <returnvalue>hstore</returnvalue>
<entry><literal>f1=&gt;1,f2=&gt;2</literal></entry> </para>
<para>
Constructs an <type>hstore</type> from a record or row.
</para>
<para>
<literal>hstore(ROW(1,2))</literal>
<returnvalue>"f1"=&gt;"1", "f2"=&gt;"2"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore(text[])</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>hstore</type></entry> <function>hstore</function> ( <type>text[]</type> )
<entry>construct an <type>hstore</type> from an array, which may be either <returnvalue>hstore</returnvalue>
a key/value array, or a two-dimensional array</entry> </para>
<entry><literal>hstore(ARRAY['a','1','b','2']) || hstore(ARRAY[['c','3'],['d','4']])</literal></entry> <para>
<entry><literal>a=&gt;1, b=&gt;2, c=&gt;3, d=&gt;4</literal></entry> Constructs an <type>hstore</type> from an array, which may be either
a key/value array, or a two-dimensional array.
</para>
<para>
<literal>hstore(ARRAY['a','1','b','2'])</literal>
<returnvalue>"a"=&gt;"1", "b"=&gt;"2"</returnvalue>
</para>
<para>
<literal>hstore(ARRAY[['c','3'],['d','4']])</literal>
<returnvalue>"c"=&gt;"3", "d"=&gt;"4"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore(text[], text[])</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>hstore</type></entry> <function>hstore</function> ( <type>text[]</type>, <type>text[]</type> )
<entry>construct an <type>hstore</type> from separate key and value arrays</entry> <returnvalue>hstore</returnvalue>
<entry><literal>hstore(ARRAY['a','b'], ARRAY['1','2'])</literal></entry> </para>
<entry><literal>"a"=&gt;"1","b"=&gt;"2"</literal></entry> <para>
Constructs an <type>hstore</type> from separate key and value arrays.
</para>
<para>
<literal>hstore(ARRAY['a','b'], ARRAY['1','2'])</literal>
<returnvalue>"a"=&gt;"1", "b"=&gt;"2"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore(text, text)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>hstore</type></entry> <function>hstore</function> ( <type>text</type>, <type>text</type> )
<entry>make single-item <type>hstore</type></entry> <returnvalue>hstore</returnvalue>
<entry><literal>hstore('a', 'b')</literal></entry> </para>
<entry><literal>"a"=&gt;"b"</literal></entry> <para>
Makes a single-item <type>hstore</type>.
</para>
<para>
<literal>hstore('a', 'b')</literal>
<returnvalue>"a"=&gt;"b"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>akeys(hstore)</function><indexterm><primary>akeys</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text[]</type></entry> <indexterm><primary>akeys</primary></indexterm>
<entry>get <type>hstore</type>'s keys as an array</entry> <function>akeys</function> ( <type>hstore</type> )
<entry><literal>akeys('a=&gt;1,b=&gt;2')</literal></entry> <returnvalue>text[]</returnvalue>
<entry><literal>{a,b}</literal></entry> </para>
<para>
Extracts an <type>hstore</type>'s keys as an array.
</para>
<para>
<literal>akeys('a=&gt;1,b=&gt;2')</literal>
<returnvalue>{a,b}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>skeys(hstore)</function><indexterm><primary>skeys</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof text</type></entry> <indexterm><primary>skeys</primary></indexterm>
<entry>get <type>hstore</type>'s keys as a set</entry> <function>skeys</function> ( <type>hstore</type> )
<entry><literal>skeys('a=&gt;1,b=&gt;2')</literal></entry> <returnvalue>setof text</returnvalue>
<entry> </para>
<para>
Extracts an <type>hstore</type>'s keys as a set.
</para>
<para>
<literal>skeys('a=&gt;1,b=&gt;2')</literal>
<returnvalue></returnvalue>
<programlisting> <programlisting>
a a
b b
</programlisting></entry> </programlisting>
</para></entry>
</row> </row>
<row> <row>
<entry><function>avals(hstore)</function><indexterm><primary>avals</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text[]</type></entry> <indexterm><primary>avals</primary></indexterm>
<entry>get <type>hstore</type>'s values as an array</entry> <function>avals</function> ( <type>hstore</type> )
<entry><literal>avals('a=&gt;1,b=&gt;2')</literal></entry> <returnvalue>text[]</returnvalue>
<entry><literal>{1,2}</literal></entry> </para>
<para>
Extracts an <type>hstore</type>'s values as an array.
</para>
<para>
<literal>avals('a=&gt;1,b=&gt;2')</literal>
<returnvalue>{1,2}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>svals(hstore)</function><indexterm><primary>svals</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof text</type></entry> <indexterm><primary>svals</primary></indexterm>
<entry>get <type>hstore</type>'s values as a set</entry> <function>svals</function> ( <type>hstore</type> )
<entry><literal>svals('a=&gt;1,b=&gt;2')</literal></entry> <returnvalue>setof text</returnvalue>
<entry> </para>
<para>
Extracts an <type>hstore</type>'s values as a set.
</para>
<para>
<literal>svals('a=&gt;1,b=&gt;2')</literal>
<returnvalue></returnvalue>
<programlisting> <programlisting>
1 1
2 2
</programlisting></entry> </programlisting>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore_to_array(hstore)</function><indexterm><primary>hstore_to_array</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text[]</type></entry> <indexterm><primary>hstore_to_array</primary></indexterm>
<entry>get <type>hstore</type>'s keys and values as an array of alternating <function>hstore_to_array</function> ( <type>hstore</type> )
keys and values</entry> <returnvalue>text[]</returnvalue>
<entry><literal>hstore_to_array('a=&gt;1,b=&gt;2')</literal></entry> </para>
<entry><literal>{a,1,b,2}</literal></entry> <para>
Extracts an <type>hstore</type>'s keys and values as an array of
alternating keys and values.
</para>
<para>
<literal>hstore_to_array('a=&gt;1,b=&gt;2')</literal>
<returnvalue>{a,1,b,2}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore_to_matrix(hstore)</function><indexterm><primary>hstore_to_matrix</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text[]</type></entry> <indexterm><primary>hstore_to_matrix</primary></indexterm>
<entry>get <type>hstore</type>'s keys and values as a two-dimensional array</entry> <function>hstore_to_matrix</function> ( <type>hstore</type> )
<entry><literal>hstore_to_matrix('a=&gt;1,b=&gt;2')</literal></entry> <returnvalue>text[]</returnvalue>
<entry><literal>{{a,1},{b,2}}</literal></entry> </para>
<para>
Extracts an <type>hstore</type>'s keys and values as a two-dimensional
array.
</para>
<para>
<literal>hstore_to_matrix('a=&gt;1,b=&gt;2')</literal>
<returnvalue>{{a,1},{b,2}}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore_to_json(hstore)</function><indexterm><primary>hstore_to_json</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>json</type></entry> <indexterm><primary>hstore_to_json</primary></indexterm>
<entry>get <type>hstore</type> as a <type>json</type> value, converting <function>hstore_to_json</function> ( <type>hstore</type> )
all non-null values to JSON strings</entry> <returnvalue>json</returnvalue>
<entry><literal>hstore_to_json('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal></entry> </para>
<entry><literal>{"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"}</literal></entry> <para>
Converts an <type>hstore</type> to a <type>json</type> value,
converting all non-null values to JSON strings.
</para>
<para>
This function is used implicitly when an <type>hstore</type> value is
cast to <type>json</type>.
</para>
<para>
<literal>hstore_to_json('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal>
<returnvalue>{"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore_to_jsonb(hstore)</function><indexterm><primary>hstore_to_jsonb</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>jsonb</type></entry> <indexterm><primary>hstore_to_jsonb</primary></indexterm>
<entry>get <type>hstore</type> as a <type>jsonb</type> value, converting <function>hstore_to_jsonb</function> ( <type>hstore</type> )
all non-null values to JSON strings</entry> <returnvalue>jsonb</returnvalue>
<entry><literal>hstore_to_jsonb('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal></entry> </para>
<entry><literal>{"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"}</literal></entry> <para>
Converts an <type>hstore</type> to a <type>jsonb</type> value,
converting all non-null values to JSON strings.
</para>
<para>
This function is used implicitly when an <type>hstore</type> value is
cast to <type>jsonb</type>.
</para>
<para>
<literal>hstore_to_jsonb('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal>
<returnvalue>{"a key": "1", "b": "t", "c": null, "d": "12345", "e": "012345", "f": "1.234", "g": "2.345e+4"}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore_to_json_loose(hstore)</function><indexterm><primary>hstore_to_json_loose</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>json</type></entry> <indexterm><primary>hstore_to_json_loose</primary></indexterm>
<entry>get <type>hstore</type> as a <type>json</type> value, but attempt to distinguish numerical and Boolean values so they are unquoted in the JSON</entry> <function>hstore_to_json_loose</function> ( <type>hstore</type> )
<entry><literal>hstore_to_json_loose('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal></entry> <returnvalue>json</returnvalue>
<entry><literal>{"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4}</literal></entry> </para>
<para>
Converts an <type>hstore</type> to a <type>json</type> value, but
attempts to distinguish numerical and Boolean values so they are
unquoted in the JSON.
</para>
<para>
<literal>hstore_to_json_loose('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal>
<returnvalue>{"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>hstore_to_jsonb_loose(hstore)</function><indexterm><primary>hstore_to_jsonb_loose</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>jsonb</type></entry> <indexterm><primary>hstore_to_jsonb_loose</primary></indexterm>
<entry>get <type>hstore</type> as a <type>jsonb</type> value, but attempt to distinguish numerical and Boolean values so they are unquoted in the JSON</entry> <function>hstore_to_jsonb_loose</function> ( <type>hstore</type> )
<entry><literal>hstore_to_jsonb_loose('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal></entry> <returnvalue>jsonb</returnvalue>
<entry><literal>{"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4}</literal></entry> </para>
<para>
Converts an <type>hstore</type> to a <type>jsonb</type> value, but
attempts to distinguish numerical and Boolean values so they are
unquoted in the JSON.
</para>
<para>
<literal>hstore_to_jsonb_loose('"a key"=&gt;1, b=&gt;t, c=&gt;null, d=&gt;12345, e=&gt;012345, f=&gt;1.234, g=&gt;2.345e+4')</literal>
<returnvalue>{"a key": 1, "b": true, "c": null, "d": 12345, "e": "012345", "f": 1.234, "g": 2.345e+4}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>slice(hstore, text[])</function><indexterm><primary>slice</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>hstore</type></entry> <indexterm><primary>slice</primary></indexterm>
<entry>extract a subset of an <type>hstore</type></entry> <function>slice</function> ( <type>hstore</type>, <type>text[]</type> )
<entry><literal>slice('a=&gt;1,b=&gt;2,c=&gt;3'::hstore, ARRAY['b','c','x'])</literal></entry> <returnvalue>hstore</returnvalue>
<entry><literal>"b"=&gt;"2", "c"=&gt;"3"</literal></entry> </para>
<para>
Extracts a subset of an <type>hstore</type> containing only the
specified keys.
</para>
<para>
<literal>slice('a=&gt;1,b=&gt;2,c=&gt;3'::hstore, ARRAY['b','c','x'])</literal>
<returnvalue>"b"=&gt;"2", "c"=&gt;"3"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>each(hstore)</function><indexterm><primary>each</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof(key text, value text)</type></entry> <indexterm><primary>each</primary></indexterm>
<entry>get <type>hstore</type>'s keys and values as a set</entry> <function>each</function> ( <type>hstore</type> )
<entry><literal>select * from each('a=&gt;1,b=&gt;2')</literal></entry> <returnvalue>setof record</returnvalue>
<entry> ( <parameter>key</parameter> <type>text</type>,
<parameter>value</parameter> <type>text</type> )
</para>
<para>
Extracts an <type>hstore</type>'s keys and values as a set of records.
</para>
<para>
<literal>select * from each('a=&gt;1,b=&gt;2')</literal>
<returnvalue></returnvalue>
<programlisting> <programlisting>
key | value key | value
-----+------- -----+-------
a | 1 a | 1
b | 2 b | 2
</programlisting></entry> </programlisting>
</para></entry>
</row> </row>
<row> <row>
<entry><function>exist(hstore,text)</function><indexterm><primary>exist</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <indexterm><primary>exist</primary></indexterm>
<entry>does <type>hstore</type> contain key?</entry> <function>exist</function> ( <type>hstore</type>, <type>text</type> )
<entry><literal>exist('a=&gt;1','a')</literal></entry> <returnvalue>boolean</returnvalue>
<entry><literal>t</literal></entry> </para>
<para>
Does <type>hstore</type> contain key?
</para>
<para>
<literal>exist('a=&gt;1','a')</literal>
<returnvalue>t</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>defined(hstore,text)</function><indexterm><primary>defined</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <indexterm><primary>defined</primary></indexterm>
<entry>does <type>hstore</type> contain non-<literal>NULL</literal> value for key?</entry> <function>defined</function> ( <type>hstore</type>, <type>text</type> )
<entry><literal>defined('a=&gt;NULL','a')</literal></entry> <returnvalue>boolean</returnvalue>
<entry><literal>f</literal></entry> </para>
<para>
Does <type>hstore</type> contain a non-<literal>NULL</literal> value
for key?
</para>
<para>
<literal>defined('a=&gt;NULL','a')</literal>
<returnvalue>f</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>delete(hstore,text)</function><indexterm><primary>delete</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>hstore</type></entry> <indexterm><primary>delete</primary></indexterm>
<entry>delete pair with matching key</entry> <function>delete</function> ( <type>hstore</type>, <type>text</type> )
<entry><literal>delete('a=&gt;1,b=&gt;2','b')</literal></entry> <returnvalue>hstore</returnvalue>
<entry><literal>"a"=&gt;"1"</literal></entry> </para>
<para>
Deletes pair with matching key.
</para>
<para>
<literal>delete('a=&gt;1,b=&gt;2','b')</literal>
<returnvalue>"a"=&gt;"1"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>delete(hstore,text[])</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>hstore</type></entry> <function>delete</function> ( <type>hstore</type>, <type>text[]</type> )
<entry>delete pairs with matching keys</entry> <returnvalue>hstore</returnvalue>
<entry><literal>delete('a=&gt;1,b=&gt;2,c=&gt;3',ARRAY['a','b'])</literal></entry> </para>
<entry><literal>"c"=&gt;"3"</literal></entry> <para>
Deletes pairs with matching keys.
</para>
<para>
<literal>delete('a=&gt;1,b=&gt;2,c=&gt;3',ARRAY['a','b'])</literal>
<returnvalue>"c"=&gt;"3"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>delete(hstore,hstore)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>hstore</type></entry> <function>delete</function> ( <type>hstore</type>, <type>hstore</type> )
<entry>delete pairs matching those in the second argument</entry> <returnvalue>hstore</returnvalue>
<entry><literal>delete('a=&gt;1,b=&gt;2','a=&gt;4,b=&gt;2'::hstore)</literal></entry> </para>
<entry><literal>"a"=&gt;"1"</literal></entry> <para>
Deletes pairs matching those in the second argument.
</para>
<para>
<literal>delete('a=&gt;1,b=&gt;2','a=&gt;4,b=&gt;2'::hstore)</literal>
<returnvalue>"a"=&gt;"1"</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>populate_record(record,hstore)</function><indexterm><primary>populate_record</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>record</type></entry> <indexterm><primary>populate_record</primary></indexterm>
<entry>replace fields in <type>record</type> with matching values from <type>hstore</type></entry> <function>populate_record</function> ( <type>anyelement</type>, <type>hstore</type> )
<entry>see Examples section</entry> <returnvalue>anyelement</returnvalue>
<entry></entry> </para>
<para>
Replaces fields in the left operand (which must be a composite type)
with matching values from <type>hstore</type>.
</para>
<para>
<literal>populate_record(ROW(1,2), 'f1=>42'::hstore)</literal>
<returnvalue>(42,2)</returnvalue>
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
<note>
<para>
The function <function>hstore_to_json</function> is used when
an <type>hstore</type> value is cast to <type>json</type>.
Likewise, <function>hstore_to_jsonb</function> is used when
an <type>hstore</type> value is cast to <type>jsonb</type>.
</para>
</note>
<note>
<para>
The function <function>populate_record</function> is actually declared
with <type>anyelement</type>, not <type>record</type>, as its first argument,
but it will reject non-record types with a run-time error.
</para>
</note>
</sect2> </sect2>
<sect2> <sect2>
......
...@@ -41,185 +41,324 @@ ...@@ -41,185 +41,324 @@
<table id="intarray-func-table"> <table id="intarray-func-table">
<title><filename>intarray</filename> Functions</title> <title><filename>intarray</filename> Functions</title>
<tgroup cols="1">
<tgroup cols="5">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Return Type</entry> Function
<entry>Description</entry> </para>
<entry>Example</entry> <para>
<entry>Result</entry> Description
</para>
<para>
Example(s)
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>icount(int[])</function><indexterm><primary>icount</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int</type></entry> <indexterm><primary>icount</primary></indexterm>
<entry>number of elements in array</entry> <function>icount</function> ( <type>integer[]</type> )
<entry><literal>icount('{1,2,3}'::int[])</literal></entry> <returnvalue>integer</returnvalue>
<entry><literal>3</literal></entry> </para>
</row> <para>
Returns the number of elements in the array.
<row> </para>
<entry><function>sort(int[], text dir)</function><indexterm><primary>sort</primary></indexterm></entry> <para>
<entry><type>int[]</type></entry> <literal>icount('{1,2,3}'::integer[])</literal>
<entry>sort array &mdash; <parameter>dir</parameter> must be <literal>asc</literal> or <literal>desc</literal></entry> <returnvalue>3</returnvalue>
<entry><literal>sort('{1,2,3}'::int[], 'desc')</literal></entry> </para></entry>
<entry><literal>{3,2,1}</literal></entry>
</row> </row>
<row> <row>
<entry><function>sort(int[])</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <indexterm><primary>sort</primary></indexterm>
<entry>sort in ascending order</entry> <function>sort</function> ( <type>integer[]</type>, <parameter>dir</parameter> <type>text</type> )
<entry><literal>sort(array[11,77,44])</literal></entry> <returnvalue>integer[]</returnvalue>
<entry><literal>{11,44,77}</literal></entry> </para>
<para>
Sorts the array in either ascending or descending order.
<parameter>dir</parameter> must be <literal>asc</literal>
or <literal>desc</literal>.
</para>
<para>
<literal>sort('{1,3,2}'::integer[], 'desc')</literal>
<returnvalue>{3,2,1}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>sort_asc(int[])</function><indexterm><primary>sort_asc</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <function>sort</function> ( <type>integer[]</type> )
<entry>sort in ascending order</entry> <returnvalue>integer[]</returnvalue>
<entry><literal></literal></entry> </para>
<entry><literal></literal></entry> <para role="func_signature">
<indexterm><primary>sort_asc</primary></indexterm>
<function>sort_asc</function> ( <type>integer[]</type> )
<returnvalue>integer[]</returnvalue>
</para>
<para>
Sorts in ascending order.
</para>
<para>
<literal>sort(array[11,77,44])</literal>
<returnvalue>{11,44,77}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>sort_desc(int[])</function><indexterm><primary>sort_desc</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <indexterm><primary>sort_desc</primary></indexterm>
<entry>sort in descending order</entry> <function>sort_desc</function> ( <type>integer[]</type> )
<entry><literal></literal></entry> <returnvalue>integer[]</returnvalue>
<entry><literal></literal></entry> </para>
<para>
Sorts in descending order.
</para>
<para>
<literal>sort_desc(array[11,77,44])</literal>
<returnvalue>{77,44,11}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>uniq(int[])</function><indexterm><primary>uniq</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <indexterm><primary>uniq</primary></indexterm>
<entry>remove adjacent duplicates</entry> <function>uniq</function> ( <type>integer[]</type> )
<entry><literal>uniq(sort('{1,2,3,2,1}'::int[]))</literal></entry> <returnvalue>integer[]</returnvalue>
<entry><literal>{1,2,3}</literal></entry> </para>
<para>
Removes adjacent duplicates.
</para>
<para>
<literal>uniq(sort('{1,2,3,2,1}'::integer[]))</literal>
<returnvalue>{1,2,3}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>idx(int[], int item)</function><indexterm><primary>idx</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int</type></entry> <indexterm><primary>idx</primary></indexterm>
<entry>index of first element matching <parameter>item</parameter> (0 if none)</entry> <function>idx</function> ( <type>integer[]</type>, <parameter>item</parameter> <type>integer</type> )
<entry><literal>idx(array[11,22,33,22,11], 22)</literal></entry> <returnvalue>integer</returnvalue>
<entry><literal>2</literal></entry> </para>
<para>
Returns index of the first array element
matching <parameter>item</parameter>, or 0 if no match.
</para>
<para>
<literal>idx(array[11,22,33,22,11], 22)</literal>
<returnvalue>2</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>subarray(int[], int start, int len)</function><indexterm><primary>subarray</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <indexterm><primary>subarray</primary></indexterm>
<entry>portion of array starting at position <parameter>start</parameter>, <parameter>len</parameter> elements</entry> <function>subarray</function> ( <type>integer[]</type>, <parameter>start</parameter> <type>integer</type>, <parameter>len</parameter> <type>integer</type> )
<entry><literal>subarray('{1,2,3,2,1}'::int[], 2, 3)</literal></entry> <returnvalue>integer[]</returnvalue>
<entry><literal>{2,3,2}</literal></entry> </para>
<para>
Extracts the portion of the array starting at
position <parameter>start</parameter>, with <parameter>len</parameter>
elements.
</para>
<para>
<literal>subarray('{1,2,3,2,1}'::integer[], 2, 3)</literal>
<returnvalue>{2,3,2}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>subarray(int[], int start)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <function>subarray</function> ( <type>integer[]</type>, <parameter>start</parameter> <type>integer</type> )
<entry>portion of array starting at position <parameter>start</parameter></entry> <returnvalue>integer[]</returnvalue>
<entry><literal>subarray('{1,2,3,2,1}'::int[], 2)</literal></entry> </para>
<entry><literal>{2,3,2,1}</literal></entry> <para>
Extracts the portion of the array starting at
position <parameter>start</parameter>.
</para>
<para>
<literal>subarray('{1,2,3,2,1}'::integer[], 2)</literal>
<returnvalue>{2,3,2,1}</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>intset(int)</function><indexterm><primary>intset</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <indexterm><primary>intset</primary></indexterm>
<entry>make single-element array</entry> <function>intset</function> ( <type>integer</type> )
<entry><literal>intset(42)</literal></entry> <returnvalue>integer[]</returnvalue>
<entry><literal>{42}</literal></entry> </para>
<para>
Makes a single-element array.
</para>
<para>
<literal>intset(42)</literal>
<returnvalue>{42}</returnvalue>
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
<table id="intarray-op-table"> <table id="intarray-op-table">
<title><filename>intarray</filename> Operators</title> <title><filename>intarray</filename> Operators</title>
<tgroup cols="1">
<tgroup cols="3">
<thead> <thead>
<row> <row>
<entry>Operator</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Operator
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><literal>int[] &amp;&amp; int[]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>integer[]</type> <literal>&amp;&amp;</literal> <type>integer[]</type>
<entry>overlap &mdash; <literal>true</literal> if arrays have at least one common element</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Do arrays overlap (have at least one element in common)?
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] @&gt; int[]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>integer[]</type> <literal>@&gt;</literal> <type>integer[]</type>
<entry>contains &mdash; <literal>true</literal> if left array contains right array</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Does left array contain right array?
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] &lt;@ int[]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>integer[]</type> <literal>&lt;@</literal> <type>integer[]</type>
<entry>contained &mdash; <literal>true</literal> if left array is contained in right array</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Is left array contained in right array?
</para></entry>
</row> </row>
<row> <row>
<entry><literal># int[]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int</type></entry> <type></type> <literal>#</literal> <type>integer[]</type>
<entry>number of elements in array</entry> <returnvalue>integer</returnvalue>
</para>
<para>
Returns the number of elements in the array.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] # int</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int</type></entry> <type>integer[]</type> <literal>#</literal> <type>integer</type>
<entry>index (same as <function>idx</function> function)</entry> <returnvalue>integer</returnvalue>
</para>
<para>
Returns index of the first array element
matching the right argument, or 0 if no match.
(Same as <function>idx</function> function.)
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] + int</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <type>integer[]</type> <literal>+</literal> <type>integer</type>
<entry>push element onto array (add it to end of array)</entry> <returnvalue>integer[]</returnvalue>
</para>
<para>
Adds element to end of array.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] + int[] </literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <type>integer[]</type> <literal>+</literal> <type>integer[]</type>
<entry>array concatenation (right array added to the end of left one)</entry> <returnvalue>integer[]</returnvalue>
</para>
<para>
Concatenates the arrays.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] - int</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <type>integer[]</type> <literal>-</literal> <type>integer</type>
<entry>remove entries matching right argument from array</entry> <returnvalue>integer[]</returnvalue>
</para>
<para>
Removes entries matching the right argument from the array.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] - int[]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <type>integer[]</type> <literal>-</literal> <type>integer[]</type>
<entry>remove elements of right array from left</entry> <returnvalue>integer[]</returnvalue>
</para>
<para>
Removes elements of the right array from the left array.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] | int</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <type>integer[]</type> <literal>|</literal> <type>integer</type>
<entry>union of arguments</entry> <returnvalue>integer[]</returnvalue>
</para>
<para>
Computes the union of the arguments.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] | int[]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <type>integer[]</type> <literal>|</literal> <type>integer[]</type>
<entry>union of arrays</entry> <returnvalue>integer[]</returnvalue>
</para>
<para>
Computes the union of the arguments.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] &amp; int[]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>int[]</type></entry> <type>integer[]</type> <literal>&amp;</literal> <type>integer[]</type>
<entry>intersection of arrays</entry> <returnvalue>integer[]</returnvalue>
</para>
<para>
Computes the intersection of the arguments.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>int[] @@ query_int</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>integer[]</type> <literal>@@</literal> <type>query_int</type>
<entry><literal>true</literal> if array satisfies query (see below)</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Does array satisfy query? (see below)
</para></entry>
</row> </row>
<row> <row>
<entry><literal>query_int ~~ int[]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>query_int</type> <literal>~~</literal> <type>integer[]</type>
<entry><literal>true</literal> if array satisfies query (commutator of <literal>@@</literal>)</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Does array satisfy query? (commutator of <literal>@@</literal>)
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
<table id="isn-datatypes"> <table id="isn-datatypes">
<title><filename>isn</filename> Data Types</title> <title><filename>isn</filename> Data Types</title>
<tgroup cols="2"> <tgroup cols="2">
<colspec colname="col1" colwidth="1*"/>
<colspec colname="col2" colwidth="2*"/>
<thead> <thead>
<row> <row>
<entry>Data Type</entry> <entry>Data Type</entry>
...@@ -235,35 +237,60 @@ ...@@ -235,35 +237,60 @@
<table id="isn-functions"> <table id="isn-functions">
<title><filename>isn</filename> Functions</title> <title><filename>isn</filename> Functions</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Function
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>isn_weak(boolean)</function><indexterm><primary>isn_weak</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <indexterm><primary>isn_weak</primary></indexterm>
<entry>Sets the weak input mode (returns new setting)</entry> <function>isn_weak</function> ( <type>boolean</type> )
<returnvalue>boolean</returnvalue>
</para>
<para>
Sets the weak input mode, and returns new setting.
</para></entry>
</row> </row>
<row> <row>
<entry><function>isn_weak()</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <function>isn_weak</function> ()
<entry>Gets the current status of the weak mode</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Returns the current status of the weak mode.
</para></entry>
</row> </row>
<row> <row>
<entry><function>make_valid(isn)</function><indexterm><primary>make_valid</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>isn</type></entry> <indexterm><primary>make_valid</primary></indexterm>
<entry>Validates an invalid number (clears the invalid flag)</entry> <function>make_valid</function> ( <type>isn</type> )
<returnvalue>isn</returnvalue>
</para>
<para>
Validates an invalid number (clears the invalid flag).
</para></entry>
</row> </row>
<row> <row>
<entry><function>is_valid(isn)</function><indexterm><primary>is_valid</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <indexterm><primary>is_valid</primary></indexterm>
<entry>Checks for the presence of the invalid flag</entry> <function>is_valid</function> ( <type>isn</type> )
<returnvalue>boolean</returnvalue>
</para>
<para>
Checks for the presence of the invalid flag.
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -544,64 +544,77 @@ int lo_unlink(PGconn *conn, Oid lobjId); ...@@ -544,64 +544,77 @@ int lo_unlink(PGconn *conn, Oid lobjId);
<table id="lo-funcs-table"> <table id="lo-funcs-table">
<title>SQL-Oriented Large Object Functions</title> <title>SQL-Oriented Large Object Functions</title>
<tgroup cols="5"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Return Type</entry> Function
<entry>Description</entry> </para>
<entry>Example</entry> <para>
<entry>Result</entry> Description
</para>
<para>
Example(s)
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<indexterm> <indexterm>
<primary>lo_from_bytea</primary> <primary>lo_from_bytea</primary>
</indexterm> </indexterm>
<literal><function>lo_from_bytea(<parameter>loid</parameter> <type>oid</type>, <parameter>string</parameter> <type>bytea</type>)</function></literal> <function>lo_from_bytea</function> ( <parameter>loid</parameter> <type>oid</type>, <parameter>data</parameter> <type>bytea</type> )
</entry> <returnvalue>oid</returnvalue>
<entry><type>oid</type></entry> </para>
<entry> <para>
Create a large object and store data there, returning its OID. Creates a large object and stores <parameter>data</parameter> in it.
Pass <literal>0</literal> to have the system choose an OID. If <parameter>loid</parameter> is zero then the system will choose a
</entry> free OID, otherwise that OID is used (with an error if some large
<entry><literal>lo_from_bytea(0, '\xffffff00')</literal></entry> object already has that OID). On success, the large object's OID is
<entry><literal>24528</literal></entry> returned.
</para>
<para>
<literal>lo_from_bytea(0, '\xffffff00')</literal>
<returnvalue>24528</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<indexterm> <indexterm>
<primary>lo_put</primary> <primary>lo_put</primary>
</indexterm> </indexterm>
<literal><function>lo_put(<parameter>loid</parameter> <type>oid</type>, <parameter>offset</parameter> <type>bigint</type>, <parameter>str</parameter> <type>bytea</type>)</function></literal> <function>lo_put</function> ( <parameter>loid</parameter> <type>oid</type>, <parameter>offset</parameter> <type>bigint</type>, <parameter>data</parameter> <type>bytea</type> )
</entry> <returnvalue>void</returnvalue>
<entry><type>void</type></entry> </para>
<entry> <para>
Write data at the given offset. Writes <parameter>data</parameter> starting at the given offset within
</entry> the large object; the large object is enlarged if necessary.
<entry><literal>lo_put(24528, 1, '\xaa')</literal></entry> </para>
<entry></entry> <para>
<literal>lo_put(24528, 1, '\xaa')</literal>
<returnvalue></returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<indexterm> <indexterm>
<primary>lo_get</primary> <primary>lo_get</primary>
</indexterm> </indexterm>
<literal><function>lo_get(<parameter>loid</parameter> <type>oid</type> <optional>, <parameter>from</parameter> <type>bigint</type>, <parameter>for</parameter> <type>int</type></optional>)</function></literal> <function>lo_get</function> ( <parameter>loid</parameter> <type>oid</type> <optional>, <parameter>offset</parameter> <type>bigint</type>, <parameter>length</parameter> <type>integer</type> </optional> )
</entry> <returnvalue>bytea</returnvalue>
<entry><type>bytea</type></entry> </para>
<entry> <para>
Extract contents or a substring thereof. Extracts the large object's contents, or a substring thereof.
</entry> </para>
<entry><literal>lo_get(24528, 0, 3)</literal></entry> <para>
<entry><literal>\xffaaff</literal></entry> <literal>lo_get(24528, 0, 3)</literal>
<returnvalue>\xffaaff</returnvalue>
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
......
...@@ -201,167 +201,219 @@ Europe &amp; Russia*@ &amp; !Transportation ...@@ -201,167 +201,219 @@ Europe &amp; Russia*@ &amp; !Transportation
<table id="ltree-op-table"> <table id="ltree-op-table">
<title><type>ltree</type> Operators</title> <title><type>ltree</type> Operators</title>
<tgroup cols="1">
<tgroup cols="3">
<thead> <thead>
<row> <row>
<entry>Operator</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Operator
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><type>ltree</type> <literal>@&gt;</literal> <type>ltree</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree</type> <literal>@&gt;</literal> <type>ltree</type>
<entry>is left argument an ancestor of right (or equal)?</entry> <returnvalue>boolean</returnvalue>
</row> </para>
<para>
<row> Is left argument an ancestor of right (or equal)?
<entry><type>ltree</type> <literal>&lt;@</literal> <type>ltree</type></entry> </para></entry>
<entry><type>boolean</type></entry>
<entry>is left argument a descendant of right (or equal)?</entry>
</row>
<row>
<entry><type>ltree</type> <literal>~</literal> <type>lquery</type></entry>
<entry><type>boolean</type></entry>
<entry>does <type>ltree</type> match <type>lquery</type>?</entry>
</row>
<row>
<entry><type>lquery</type> <literal>~</literal> <type>ltree</type></entry>
<entry><type>boolean</type></entry>
<entry>does <type>ltree</type> match <type>lquery</type>?</entry>
</row>
<row>
<entry><type>ltree</type> <literal>?</literal> <type>lquery[]</type></entry>
<entry><type>boolean</type></entry>
<entry>does <type>ltree</type> match any <type>lquery</type> in array?</entry>
</row>
<row>
<entry><type>lquery[]</type> <literal>?</literal> <type>ltree</type></entry>
<entry><type>boolean</type></entry>
<entry>does <type>ltree</type> match any <type>lquery</type> in array?</entry>
</row>
<row>
<entry><type>ltree</type> <literal>@</literal> <type>ltxtquery</type></entry>
<entry><type>boolean</type></entry>
<entry>does <type>ltree</type> match <type>ltxtquery</type>?</entry>
</row>
<row>
<entry><type>ltxtquery</type> <literal>@</literal> <type>ltree</type></entry>
<entry><type>boolean</type></entry>
<entry>does <type>ltree</type> match <type>ltxtquery</type>?</entry>
</row>
<row>
<entry><type>ltree</type> <literal>||</literal> <type>ltree</type></entry>
<entry><type>ltree</type></entry>
<entry>concatenate <type>ltree</type> paths</entry>
</row>
<row>
<entry><type>ltree</type> <literal>||</literal> <type>text</type></entry>
<entry><type>ltree</type></entry>
<entry>convert text to <type>ltree</type> and concatenate</entry>
</row> </row>
<row> <row>
<entry><type>text</type> <literal>||</literal> <type>ltree</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <type>ltree</type> <literal>&lt;@</literal> <type>ltree</type>
<entry>convert text to <type>ltree</type> and concatenate</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Is left argument a descendant of right (or equal)?
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>@&gt;</literal> <type>ltree</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree</type> <literal>~</literal> <type>lquery</type>
<entry>does array contain an ancestor of <type>ltree</type>?</entry> <returnvalue>boolean</returnvalue>
</para>
<para role="func_signature">
<type>lquery</type> <literal>~</literal> <type>ltree</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Does <type>ltree</type> match <type>lquery</type>?
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree</type> <literal>&lt;@</literal> <type>ltree[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree</type> <literal>?</literal> <type>lquery[]</type>
<entry>does array contain an ancestor of <type>ltree</type>?</entry> <returnvalue>boolean</returnvalue>
</para>
<para role="func_signature">
<type>lquery[]</type> <literal>?</literal> <type>ltree</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Does <type>ltree</type> match any <type>lquery</type> in array?
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>&lt;@</literal> <type>ltree</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree</type> <literal>@</literal> <type>ltxtquery</type>
<entry>does array contain a descendant of <type>ltree</type>?</entry> <returnvalue>boolean</returnvalue>
</para>
<para role="func_signature">
<type>ltxtquery</type> <literal>@</literal> <type>ltree</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Does <type>ltree</type> match <type>ltxtquery</type>?
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree</type> <literal>@&gt;</literal> <type>ltree[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree</type> <literal>||</literal> <type>ltree</type>
<entry>does array contain a descendant of <type>ltree</type>?</entry> <returnvalue>ltree</returnvalue>
</para>
<para>
Concatenates <type>ltree</type> paths.
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>~</literal> <type>lquery</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree</type> <literal>||</literal> <type>text</type>
<entry>does array contain any path matching <type>lquery</type>?</entry> <returnvalue>ltree</returnvalue>
</para>
<para role="func_signature">
<type>text</type> <literal>||</literal> <type>ltree</type>
<returnvalue>ltree</returnvalue>
</para>
<para>
Converts text to <type>ltree</type> and concatenates.
</para></entry>
</row> </row>
<row> <row>
<entry><type>lquery</type> <literal>~</literal> <type>ltree[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree[]</type> <literal>@&gt;</literal> <type>ltree</type>
<entry>does array contain any path matching <type>lquery</type>?</entry> <returnvalue>boolean</returnvalue>
</para>
<para role="func_signature">
<type>ltree</type> <literal>&lt;@</literal> <type>ltree[]</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Does array contain an ancestor of <type>ltree</type>?
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>?</literal> <type>lquery[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree[]</type> <literal>&lt;@</literal> <type>ltree</type>
<entry>does <type>ltree</type> array contain any path matching any <type>lquery</type>?</entry> <returnvalue>boolean</returnvalue>
</para>
<para role="func_signature">
<type>ltree</type> <literal>@&gt;</literal> <type>ltree[]</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Does array contain a descendant of <type>ltree</type>?
</para></entry>
</row> </row>
<row> <row>
<entry><type>lquery[]</type> <literal>?</literal> <type>ltree[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree[]</type> <literal>~</literal> <type>lquery</type>
<entry>does <type>ltree</type> array contain any path matching any <type>lquery</type>?</entry> <returnvalue>boolean</returnvalue>
</para>
<para role="func_signature">
<type>lquery</type> <literal>~</literal> <type>ltree[]</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Does array contain any path matching <type>lquery</type>?
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>@</literal> <type>ltxtquery</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree[]</type> <literal>?</literal> <type>lquery[]</type>
<entry>does array contain any path matching <type>ltxtquery</type>?</entry> <returnvalue>boolean</returnvalue>
</para>
<para role="func_signature">
<type>lquery[]</type> <literal>?</literal> <type>ltree[]</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Does <type>ltree</type> array contain any path matching
any <type>lquery</type>?
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltxtquery</type> <literal>@</literal> <type>ltree[]</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>ltree[]</type> <literal>@</literal> <type>ltxtquery</type>
<entry>does array contain any path matching <type>ltxtquery</type>?</entry> <returnvalue>boolean</returnvalue>
</para>
<para role="func_signature">
<type>ltxtquery</type> <literal>@</literal> <type>ltree[]</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Does array contain any path matching <type>ltxtquery</type>?
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>?@&gt;</literal> <type>ltree</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <type>ltree[]</type> <literal>?@&gt;</literal> <type>ltree</type>
<entry>first array entry that is an ancestor of <type>ltree</type>; NULL if none</entry> <returnvalue>ltree</returnvalue>
</para>
<para>
Returns first array entry that is an ancestor of <type>ltree</type>,
or <literal>NULL</literal> if none.
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>?&lt;@</literal> <type>ltree</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <type>ltree[]</type> <literal>?&lt;@</literal> <type>ltree</type>
<entry>first array entry that is a descendant of <type>ltree</type>; NULL if none</entry> <returnvalue>ltree</returnvalue>
</para>
<para>
Returns first array entry that is a descendant of <type>ltree</type>,
or <literal>NULL</literal> if none.
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>?~</literal> <type>lquery</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <type>ltree[]</type> <literal>?~</literal> <type>lquery</type>
<entry>first array entry that matches <type>lquery</type>; NULL if none</entry> <returnvalue>ltree</returnvalue>
</para>
<para>
Returns first array entry that matches <type>lquery</type>,
or <literal>NULL</literal> if none.
</para></entry>
</row> </row>
<row> <row>
<entry><type>ltree[]</type> <literal>?@</literal> <type>ltxtquery</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <type>ltree[]</type> <literal>?@</literal> <type>ltxtquery</type>
<entry>first array entry that matches <type>ltxtquery</type>; NULL if none</entry> <returnvalue>ltree</returnvalue>
</para>
<para>
Returns first array entry that matches <type>ltxtquery</type>,
or <literal>NULL</literal> if none.
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
...@@ -380,112 +432,176 @@ Europe &amp; Russia*@ &amp; !Transportation ...@@ -380,112 +432,176 @@ Europe &amp; Russia*@ &amp; !Transportation
<table id="ltree-func-table"> <table id="ltree-func-table">
<title><type>ltree</type> Functions</title> <title><type>ltree</type> Functions</title>
<tgroup cols="1">
<tgroup cols="5">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Return Type</entry> Function
<entry>Description</entry> </para>
<entry>Example</entry> <para>
<entry>Result</entry> Description
</para>
<para>
Example(s)
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>subltree(ltree, int start, int end)</function><indexterm><primary>subltree</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <indexterm><primary>subltree</primary></indexterm>
<entry>subpath of <type>ltree</type> from position <parameter>start</parameter> to <function>subltree</function> ( <type>ltree</type>, <parameter>start</parameter> <type>integer</type>, <parameter>end</parameter> <type>integer</type> )
position <parameter>end</parameter>-1 (counting from 0)</entry> <returnvalue>ltree</returnvalue>
<entry><literal>subltree('Top.Child1.Child2',1,2)</literal></entry> </para>
<entry><literal>Child1</literal></entry> <para>
Returns subpath of <type>ltree</type> from
position <parameter>start</parameter> to
position <parameter>end</parameter>-1 (counting from 0).
</para>
<para>
<literal>subltree('Top.Child1.Child2',1,2)</literal>
<returnvalue>Child1</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>subpath(ltree, int offset, int len)</function><indexterm><primary>subpath</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <indexterm><primary>subpath</primary></indexterm>
<entry>subpath of <type>ltree</type> starting at position <function>subpath</function> ( <type>ltree</type>, <parameter>offset</parameter> <type>integer</type>, <parameter>len</parameter> <type>integer</type> )
<parameter>offset</parameter>, length <parameter>len</parameter>. <returnvalue>ltree</returnvalue>
If <parameter>offset</parameter> is negative, subpath starts that far from the </para>
end of the path. If <parameter>len</parameter> is negative, leaves that many <para>
labels off the end of the path.</entry> Returns subpath of <type>ltree</type> starting at
<entry><literal>subpath('Top.Child1.Child2',0,2)</literal></entry> position <parameter>offset</parameter>, with
<entry><literal>Top.Child1</literal></entry> length <parameter>len</parameter>. If <parameter>offset</parameter>
is negative, subpath starts that far from the end of the path.
If <parameter>len</parameter> is negative, leaves that many labels off
the end of the path.
</para>
<para>
<literal>subpath('Top.Child1.Child2',0,2)</literal>
<returnvalue>Top.Child1</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>subpath(ltree, int offset)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <function>subpath</function> ( <type>ltree</type>, <parameter>offset</parameter> <type>integer</type> )
<entry>subpath of <type>ltree</type> starting at position <returnvalue>ltree</returnvalue>
<parameter>offset</parameter>, extending to end of path. </para>
If <parameter>offset</parameter> is negative, subpath starts that far from the <para>
end of the path.</entry> Returns subpath of <type>ltree</type> starting at
<entry><literal>subpath('Top.Child1.Child2',1)</literal></entry> position <parameter>offset</parameter>, extending to end of path.
<entry><literal>Child1.Child2</literal></entry> If <parameter>offset</parameter> is negative, subpath starts that far
from the end of the path.
</para>
<para>
<literal>subpath('Top.Child1.Child2',1)</literal>
<returnvalue>Child1.Child2</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>nlevel(ltree)</function><indexterm><primary>nlevel</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>integer</type></entry> <indexterm><primary>nlevel</primary></indexterm>
<entry>number of labels in path</entry> <function>nlevel</function> ( <type>ltree</type> )
<entry><literal>nlevel('Top.Child1.Child2')</literal></entry> <returnvalue>integer</returnvalue>
<entry><literal>3</literal></entry> </para>
<para>
Returns number of labels in path.
</para>
<para>
<literal>nlevel('Top.Child1.Child2')</literal>
<returnvalue>3</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>index(ltree a, ltree b)</function><indexterm><primary>index</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>integer</type></entry> <indexterm><primary>index</primary></indexterm>
<entry>position of first occurrence of <parameter>b</parameter> in <function>index</function> ( <parameter>a</parameter> <type>ltree</type>, <parameter>b</parameter> <type>ltree</type> )
<parameter>a</parameter>; -1 if not found</entry> <returnvalue>integer</returnvalue>
<entry><literal>index('0.1.2.3.5.4.5.6.8.5.6.8','5.6')</literal></entry> </para>
<entry><literal>6</literal></entry> <para>
Returns position of first occurrence of <parameter>b</parameter> in
<parameter>a</parameter>, or -1 if not found.
</para>
<para>
<literal>index('0.1.2.3.5.4.5.6.8.5.6.8','5.6')</literal>
<returnvalue>6</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>index(ltree a, ltree b, int offset)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>integer</type></entry> <function>index</function> ( <parameter>a</parameter> <type>ltree</type>, <parameter>b</parameter> <type>ltree</type>, <parameter>offset</parameter> <type>integer</type> )
<entry>position of first occurrence of <parameter>b</parameter> in <returnvalue>integer</returnvalue>
<parameter>a</parameter>, searching starting at <parameter>offset</parameter>; </para>
negative <parameter>offset</parameter> means start <parameter>-offset</parameter> <para>
labels from the end of the path</entry> Returns position of first occurrence of <parameter>b</parameter>
<entry><literal>index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-4)</literal></entry> in <parameter>a</parameter>, or -1 if not found. The search starts at
<entry><literal>9</literal></entry> position <parameter>offset</parameter>;
negative <parameter>offset</parameter> means
start <parameter>-offset</parameter> labels from the end of the path.
</para>
<para>
<literal>index('0.1.2.3.5.4.5.6.8.5.6.8','5.6',-4)</literal>
<returnvalue>9</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>text2ltree(text)</function><indexterm><primary>text2ltree</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <indexterm><primary>text2ltree</primary></indexterm>
<entry>cast <type>text</type> to <type>ltree</type></entry> <function>text2ltree</function> ( <type>text</type> )
<entry><literal></literal></entry> <returnvalue>ltree</returnvalue>
<entry><literal></literal></entry> </para>
<para>
Casts <type>text</type> to <type>ltree</type>.
</para></entry>
</row> </row>
<row> <row>
<entry><function>ltree2text(ltree)</function><indexterm><primary>ltree2text</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text</type></entry> <indexterm><primary>ltree2text</primary></indexterm>
<entry>cast <type>ltree</type> to <type>text</type></entry> <function>ltree2text</function> ( <type>ltree</type> )
<entry><literal></literal></entry> <returnvalue>text</returnvalue>
<entry><literal></literal></entry> </para>
<para>
Casts <type>ltree</type> to <type>text</type>.
</para></entry>
</row> </row>
<row> <row>
<entry><function>lca(ltree, ltree, ...)</function><indexterm><primary>lca</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <indexterm><primary>lca</primary></indexterm>
<entry>longest common ancestor of paths <function>lca</function> ( <type>ltree</type> <optional>, <type>ltree</type> <optional>, ... </optional></optional> )
(up to 8 arguments supported)</entry> <returnvalue>ltree</returnvalue>
<entry><literal>lca('1.2.3','1.2.3.4.5.6')</literal></entry> </para>
<entry><literal>1.2</literal></entry> <para>
Computes longest common ancestor of paths
(up to 8 arguments are supported).
</para>
<para>
<literal>lca('1.2.3','1.2.3.4.5.6')</literal>
<returnvalue>1.2</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><function>lca(ltree[])</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>ltree</type></entry> <function>lca</function> ( <type>ltree[]</type> )
<entry>longest common ancestor of paths in array</entry> <returnvalue>ltree</returnvalue>
<entry><literal>lca(array['1.2.3'::ltree,'1.2.3.4'])</literal></entry> </para>
<entry><literal>1.2</literal></entry> <para>
Computes longest common ancestor of paths in array.
</para>
<para>
<literal>lca(array['1.2.3'::ltree,'1.2.3.4'])</literal>
<returnvalue>1.2</returnvalue>
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
......
...@@ -3377,116 +3377,173 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i ...@@ -3377,116 +3377,173 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
<table id="monitoring-stats-funcs-table"> <table id="monitoring-stats-funcs-table">
<title>Additional Statistics Functions</title> <title>Additional Statistics Functions</title>
<tgroup cols="1">
<tgroup cols="3">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Return Type</entry> Function
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<!-- See also the entry for this in func.sgml --> <!-- See also the entry for this in func.sgml -->
<entry><literal><function>pg_backend_pid()</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>integer</type></entry> <function>pg_backend_pid</function> ()
<entry> <returnvalue>integer</returnvalue>
Process ID of the server process handling the current session </para>
</entry> <para>
Returns the process ID of the server process attached to the current
session.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_activity</function>(<type>integer</type>)</literal><indexterm><primary>pg_stat_get_activity</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof record</type></entry> <indexterm>
<entry> <primary>pg_stat_get_activity</primary>
Returns a record of information about the backend with the specified PID, or </indexterm>
one record for each active backend in the system if <symbol>NULL</symbol> is <function>pg_stat_get_activity</function> ( <type>integer</type> )
specified. The fields returned are a subset of those in the <returnvalue>setof record</returnvalue>
<structname>pg_stat_activity</structname> view. </para>
</entry> <para>
Returns a record of information about the backend with the specified
process ID, or one record for each active backend in the system
if <literal>NULL</literal> is specified. The fields returned are a
subset of those in the <structname>pg_stat_activity</structname> view.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_snapshot_timestamp()</function></literal><indexterm><primary>pg_stat_get_snapshot_timestamp</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>timestamp with time zone</type></entry> <indexterm>
<entry> <primary>pg_stat_get_snapshot_timestamp</primary>
Returns the timestamp of the current statistics snapshot </indexterm>
</entry> <function>pg_stat_get_snapshot_timestamp</function> ()
<returnvalue>timestamp with time zone</returnvalue>
</para>
<para>
Returns the timestamp of the current statistics snapshot.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_clear_snapshot()</function></literal><indexterm><primary>pg_stat_clear_snapshot</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>void</type></entry> <indexterm>
<entry> <primary>pg_stat_clear_snapshot</primary>
Discard the current statistics snapshot </indexterm>
</entry> <function>pg_stat_clear_snapshot</function> ()
<returnvalue>void</returnvalue>
</para>
<para>
Discards the current statistics snapshot.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_reset()</function></literal><indexterm><primary>pg_stat_reset</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>void</type></entry> <indexterm>
<entry> <primary>pg_stat_reset</primary>
Reset all statistics counters for the current database to zero </indexterm>
(requires superuser privileges by default, but EXECUTE for this <function>pg_stat_reset</function> ()
function can be granted to others.) <returnvalue>void</returnvalue>
</entry> </para>
<para>
Resets all statistics counters for the current database to zero.
</para>
<para>
This function is restricted to superusers by default, but other users
can be granted EXECUTE to run the function.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_reset_shared</function>(text)</literal><indexterm><primary>pg_stat_reset_shared</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>void</type></entry> <indexterm>
<entry> <primary>pg_stat_reset_shared</primary>
Reset some cluster-wide statistics counters to zero, depending on the </indexterm>
argument (requires superuser privileges by default, but EXECUTE for <function>pg_stat_reset_shared</function> ( <type>text</type> )
this function can be granted to others). <returnvalue>void</returnvalue>
Calling <literal>pg_stat_reset_shared('bgwriter')</literal> will zero all the </para>
counters shown in the <structname>pg_stat_bgwriter</structname> view. <para>
Calling <literal>pg_stat_reset_shared('archiver')</literal> will zero all the Resets some cluster-wide statistics counters to zero, depending on the
counters shown in the <structname>pg_stat_archiver</structname> view. argument. The argument can be <literal>bgwriter</literal> to reset
</entry> all the counters shown in
the <structname>pg_stat_bgwriter</structname>
view,or <literal>archiver</literal> to reset all the counters shown in
the <structname>pg_stat_archiver</structname> view.
</para>
<para>
This function is restricted to superusers by default, but other users
can be granted EXECUTE to run the function.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_reset_single_table_counters</function>(oid)</literal><indexterm><primary>pg_stat_reset_single_table_counters</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>void</type></entry> <indexterm>
<entry> <primary>pg_stat_reset_single_table_counters</primary>
Reset statistics for a single table or index in the current database to </indexterm>
zero (requires superuser privileges by default, but EXECUTE for this <function>pg_stat_reset_single_table_counters</function> ( <type>oid</type> )
function can be granted to others) <returnvalue>void</returnvalue>
</entry> </para>
<para>
Resets statistics for a single table or index in the current database
to zero.
</para>
<para>
This function is restricted to superusers by default, but other users
can be granted EXECUTE to run the function.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_reset_single_function_counters</function>(oid)</literal><indexterm><primary>pg_stat_reset_single_function_counters</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>void</type></entry> <indexterm>
<entry> <primary>pg_stat_reset_single_function_counters</primary>
Reset statistics for a single function in the current database to </indexterm>
zero (requires superuser privileges by default, but EXECUTE for this <function>pg_stat_reset_single_function_counters</function> ( <type>oid</type> )
function can be granted to others) <returnvalue>void</returnvalue>
</entry> </para>
<para>
Resets statistics for a single function in the current database to
zero.
</para>
<para>
This function is restricted to superusers by default, but other users
can be granted EXECUTE to run the function.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_reset_slru</function>(text)</literal><indexterm><primary>pg_stat_reset_slru</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>void</type></entry> <indexterm>
<entry> <primary>pg_stat_reset_slru</primary>
Reset statistics either for a single SLRU or all SLRUs in the cluster </indexterm>
to zero (requires superuser privileges by default, but EXECUTE for this <function>pg_stat_reset_slru</function> ( <type>text</type> )
function can be granted to others). <returnvalue>void</returnvalue>
Calling <literal>pg_stat_reset_slru(NULL)</literal> will zero all the </para>
counters shown in the <structname>pg_stat_slru</structname> view for <para>
all SLRU caches. Resets statistics to zero for a single SLRU cache, or for all SLRUs in
Calling <literal>pg_stat_reset_slru(name)</literal> with names from a the cluster. If the argument is NULL, all counters shown in
predefined list (<literal>async</literal>, <literal>clog</literal>, the <structname>pg_stat_slru</structname> view for all SLRU caches are
<literal>commit_timestamp</literal>, <literal>multixact_offset</literal>, reset. The argument can be one of <literal>async</literal>,
<literal>multixact_member</literal>, <literal>oldserxid</literal>, <literal>clog</literal>, <literal>commit_timestamp</literal>,
<literal>subtrans</literal> and <literal>other</literal>) resets counters <literal>multixact_offset</literal>,
for only that entry. Names not included in this list are treated as <literal>multixact_member</literal>, <literal>oldserxid</literal>, or
<literal>other</literal>. <literal>subtrans</literal> to reset the counters for only that entry.
</entry> If the argument is <literal>other</literal> (or indeed, any
unrecognized name), then the counters for all other SLRU caches, such
as extension-defined caches, are reset.
</para>
<para>
This function is restricted to superusers by default, but other users
can be granted EXECUTE to run the function.
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -3516,95 +3573,177 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid, ...@@ -3516,95 +3573,177 @@ SELECT pg_stat_get_backend_pid(s.backendid) AS pid,
<table id="monitoring-stats-backend-funcs-table"> <table id="monitoring-stats-backend-funcs-table">
<title>Per-Backend Statistics Functions</title> <title>Per-Backend Statistics Functions</title>
<tgroup cols="1">
<tgroup cols="3">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Return Type</entry> Function
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><literal><function>pg_stat_get_backend_idset()</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof integer</type></entry> <indexterm>
<entry>Set of currently active backend ID numbers (from 1 to the <primary>pg_stat_get_backend_idset</primary>
number of active backends)</entry> </indexterm>
<function>pg_stat_get_backend_idset</function> ()
<returnvalue>setof integer</returnvalue>
</para>
<para>
Returns the set of currently active backend ID numbers (from 1 to the
number of active backends).
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_activity(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text</type></entry> <indexterm>
<entry>Text of this backend's most recent query</entry> <primary>pg_stat_get_backend_activity</primary>
</indexterm>
<function>pg_stat_get_backend_activity</function> ( <type>integer</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Returns the text of this backend's most recent query.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_activity_start(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>timestamp with time zone</type></entry> <indexterm>
<entry>Time when the most recent query was started</entry> <primary>pg_stat_get_backend_activity_start</primary>
</indexterm>
<function>pg_stat_get_backend_activity_start</function> ( <type>integer</type> )
<returnvalue>timestamp with time zone</returnvalue>
</para>
<para>
Returns the time when the backend's most recent query was started.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_client_addr(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>inet</type></entry> <indexterm>
<entry>IP address of the client connected to this backend</entry> <primary>pg_stat_get_backend_client_addr</primary>
</indexterm>
<function>pg_stat_get_backend_client_addr</function> ( <type>integer</type> )
<returnvalue>inet</returnvalue>
</para>
<para>
Returns the IP address of the client connected to this backend.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_client_port(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>integer</type></entry> <indexterm>
<entry>TCP port number that the client is using for communication</entry> <primary>pg_stat_get_backend_client_port</primary>
</indexterm>
<function>pg_stat_get_backend_client_port</function> ( <type>integer</type> )
<returnvalue>integer</returnvalue>
</para>
<para>
Returns the TCP port number that the client is using for communication.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_dbid(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>oid</type></entry> <indexterm>
<entry>OID of the database this backend is connected to</entry> <primary>pg_stat_get_backend_dbid</primary>
</indexterm>
<function>pg_stat_get_backend_dbid</function> ( <type>integer</type> )
<returnvalue>oid</returnvalue>
</para>
<para>
Returns the OID of the database this backend is connected to.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_pid(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>integer</type></entry> <indexterm>
<entry>Process ID of this backend</entry> <primary>pg_stat_get_backend_pid</primary>
</indexterm>
<function>pg_stat_get_backend_pid</function> ( <type>integer</type> )
<returnvalue>integer</returnvalue>
</para>
<para>
Returns the process ID of this backend.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_start(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>timestamp with time zone</type></entry> <indexterm>
<entry>Time when this process was started</entry> <primary>pg_stat_get_backend_start</primary>
</indexterm>
<function>pg_stat_get_backend_start</function> ( <type>integer</type> )
<returnvalue>timestamp with time zone</returnvalue>
</para>
<para>
Returns the time when this process was started.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_userid(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>oid</type></entry> <indexterm>
<entry>OID of the user logged into this backend</entry> <primary>pg_stat_get_backend_userid</primary>
</indexterm>
<function>pg_stat_get_backend_userid</function> ( <type>integer</type> )
<returnvalue>oid</returnvalue>
</para>
<para>
Returns the OID of the user logged into this backend.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_wait_event_type(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text</type></entry> <indexterm>
<entry>Wait event type name if backend is currently waiting, otherwise NULL. <primary>pg_stat_get_backend_wait_event_type</primary>
See <xref linkend="wait-event-table"/> for details. </indexterm>
</entry> <function>pg_stat_get_backend_wait_event_type</function> ( <type>integer</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Returns the wait event type name if this backend is currently waiting,
otherwise NULL. See <xref linkend="wait-event-table"/> for details.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_wait_event(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text</type></entry> <indexterm>
<entry>Wait event name if backend is currently waiting, otherwise NULL. <primary>pg_stat_get_backend_wait_event</primary>
See <xref linkend="wait-event-table"/> for details. </indexterm>
</entry> <function>pg_stat_get_backend_wait_event</function> ( <type>integer</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Returns the wait event name if this backend is currently waiting,
otherwise NULL. See <xref linkend="wait-event-table"/> for details.
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pg_stat_get_backend_xact_start(integer)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>timestamp with time zone</type></entry> <indexterm>
<entry>Time when the current transaction was started</entry> <primary>pg_stat_get_backend_xact_start</primary>
</indexterm>
<function>pg_stat_get_backend_xact_start</function> ( <type>integer</type> )
<returnvalue>timestamp with time zone</returnvalue>
</para>
<para>
Returns the time when the backend's current transaction was started.
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
</table> </table>
......
...@@ -70,80 +70,103 @@ ...@@ -70,80 +70,103 @@
<table id="pgtrgm-func-table"> <table id="pgtrgm-func-table">
<title><filename>pg_trgm</filename> Functions</title> <title><filename>pg_trgm</filename> Functions</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Function
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>similarity(text, text)</function><indexterm><primary>similarity</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>real</type></entry> <indexterm><primary>similarity</primary></indexterm>
<entry> <function>similarity</function> ( <type>text</type>, <type>text</type> )
<returnvalue>real</returnvalue>
</para>
<para>
Returns a number that indicates how similar the two arguments are. Returns a number that indicates how similar the two arguments are.
The range of the result is zero (indicating that the two strings are The range of the result is zero (indicating that the two strings are
completely dissimilar) to one (indicating that the two strings are completely dissimilar) to one (indicating that the two strings are
identical). identical).
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>show_trgm(text)</function><indexterm><primary>show_trgm</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>text[]</type></entry> <indexterm><primary>show_trgm</primary></indexterm>
<entry> <function>show_trgm</function> ( <type>text</type> )
<returnvalue>text[]</returnvalue>
</para>
<para>
Returns an array of all the trigrams in the given string. Returns an array of all the trigrams in the given string.
(In practice this is seldom useful except for debugging.) (In practice this is seldom useful except for debugging.)
</entry> </para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function>word_similarity(text, text)</function>
<indexterm><primary>word_similarity</primary></indexterm> <indexterm><primary>word_similarity</primary></indexterm>
</entry> <function>word_similarity</function> ( <type>text</type>, <type>text</type> )
<entry><type>real</type></entry> <returnvalue>real</returnvalue>
<entry> </para>
<para>
Returns a number that indicates the greatest similarity between Returns a number that indicates the greatest similarity between
the set of trigrams in the first string and any continuous extent the set of trigrams in the first string and any continuous extent
of an ordered set of trigrams in the second string. For details, see of an ordered set of trigrams in the second string. For details, see
the explanation below. the explanation below.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function>strict_word_similarity(text, text)</function>
<indexterm><primary>strict_word_similarity</primary></indexterm> <indexterm><primary>strict_word_similarity</primary></indexterm>
</entry> <function>strict_word_similarity</function> ( <type>text</type>, <type>text</type> )
<entry><type>real</type></entry> <returnvalue>real</returnvalue>
<entry> </para>
Same as <function>word_similarity(text, text)</function>, but forces <para>
Same as <function>word_similarity</function>, but forces
extent boundaries to match word boundaries. Since we don't have extent boundaries to match word boundaries. Since we don't have
cross-word trigrams, this function actually returns greatest similarity cross-word trigrams, this function actually returns greatest similarity
between first string and any continuous extent of words of the second between first string and any continuous extent of words of the second
string. string.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>show_limit()</function><indexterm><primary>show_limit</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>real</type></entry> <indexterm><primary>show_limit</primary></indexterm>
<entry> <function>show_limit</function> ()
<returnvalue>real</returnvalue>
</para>
<para>
Returns the current similarity threshold used by the <literal>%</literal> Returns the current similarity threshold used by the <literal>%</literal>
operator. This sets the minimum similarity between operator. This sets the minimum similarity between
two words for them to be considered similar enough to two words for them to be considered similar enough to
be misspellings of each other, for example be misspellings of each other, for example.
(<emphasis>deprecated</emphasis>). (<emphasis>Deprecated</emphasis>; instead use <command>SHOW</command>
</entry> <varname>pg_trgm.similarity_threshold</varname>.)
</para></entry>
</row> </row>
<row> <row>
<entry><function>set_limit(real)</function><indexterm><primary>set_limit</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>real</type></entry> <indexterm><primary>set_limit</primary></indexterm>
<entry> <function>set_limit</function> ( <type>real</type> )
<returnvalue>real</returnvalue>
</para>
<para>
Sets the current similarity threshold that is used by the <literal>%</literal> Sets the current similarity threshold that is used by the <literal>%</literal>
operator. The threshold must be between 0 and 1 (default is 0.3). operator. The threshold must be between 0 and 1 (default is 0.3).
Returns the same value passed in (<emphasis>deprecated</emphasis>). Returns the same value passed in.
</entry> (<emphasis>Deprecated</emphasis>; instead use <command>SET</command>
<varname>pg_trgm.similarity_threshold</varname>.)
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -178,9 +201,9 @@ ...@@ -178,9 +201,9 @@
</para> </para>
<para> <para>
At the same time, <function>strict_word_similarity(text, text)</function> At the same time, <function>strict_word_similarity</function>
selects an extent of words in the second string. In the example above, selects an extent of words in the second string. In the example above,
<function>strict_word_similarity(text, text)</function> would select the <function>strict_word_similarity</function> would select the
extent of a single word <literal>'words'</literal>, whose set of trigrams is extent of a single word <literal>'words'</literal>, whose set of trigrams is
<literal>{" w"," wo","wor","ord","rds","ds "}</literal>. <literal>{" w"," wo","wor","ord","rds","ds "}</literal>.
...@@ -194,114 +217,138 @@ ...@@ -194,114 +217,138 @@
</para> </para>
<para> <para>
Thus, the <function>strict_word_similarity(text, text)</function> function Thus, the <function>strict_word_similarity</function> function
is useful for finding the similarity to whole words, while is useful for finding the similarity to whole words, while
<function>word_similarity(text, text)</function> is more suitable for <function>word_similarity</function> is more suitable for
finding the similarity for parts of words. finding the similarity for parts of words.
</para> </para>
<table id="pgtrgm-op-table"> <table id="pgtrgm-op-table">
<title><filename>pg_trgm</filename> Operators</title> <title><filename>pg_trgm</filename> Operators</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Operator</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Operator
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><type>text</type> <literal>%</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>text</type> <literal>%</literal> <type>text</type>
<entry> <returnvalue>boolean</returnvalue>
Returns <literal>true</literal> if its arguments have a similarity that is </para>
greater than the current similarity threshold set by <para>
Returns <literal>true</literal> if its arguments have a similarity
that is greater than the current similarity threshold set by
<varname>pg_trgm.similarity_threshold</varname>. <varname>pg_trgm.similarity_threshold</varname>.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><type>text</type> <literal>&lt;%</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>text</type> <literal>&lt;%</literal> <type>text</type>
<entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Returns <literal>true</literal> if the similarity between the trigram Returns <literal>true</literal> if the similarity between the trigram
set in the first argument and a continuous extent of an ordered trigram set in the first argument and a continuous extent of an ordered trigram
set in the second argument is greater than the current word similarity set in the second argument is greater than the current word similarity
threshold set by <varname>pg_trgm.word_similarity_threshold</varname> threshold set by <varname>pg_trgm.word_similarity_threshold</varname>
parameter. parameter.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><type>text</type> <literal>%&gt;</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>text</type> <literal>%&gt;</literal> <type>text</type>
<entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Commutator of the <literal>&lt;%</literal> operator. Commutator of the <literal>&lt;%</literal> operator.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><type>text</type> <literal>&lt;&lt;%</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>text</type> <literal>&lt;&lt;%</literal> <type>text</type>
<entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Returns <literal>true</literal> if its second argument has a continuous Returns <literal>true</literal> if its second argument has a continuous
extent of an ordered trigram set that matches word boundaries, extent of an ordered trigram set that matches word boundaries,
and its similarity to the trigram set of the first argument is greater and its similarity to the trigram set of the first argument is greater
than the current strict word similarity threshold set by the than the current strict word similarity threshold set by the
<varname>pg_trgm.strict_word_similarity_threshold</varname> parameter. <varname>pg_trgm.strict_word_similarity_threshold</varname> parameter.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><type>text</type> <literal>%&gt;&gt;</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>boolean</type></entry> <type>text</type> <literal>%&gt;&gt;</literal> <type>text</type>
<entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Commutator of the <literal>&lt;&lt;%</literal> operator. Commutator of the <literal>&lt;&lt;%</literal> operator.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><type>text</type> <literal>&lt;-&gt;</literal> <type>text</type></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>real</type></entry> <type>text</type> <literal>&lt;-&gt;</literal> <type>text</type>
<entry> <returnvalue>real</returnvalue>
</para>
<para>
Returns the <quote>distance</quote> between the arguments, that is Returns the <quote>distance</quote> between the arguments, that is
one minus the <function>similarity()</function> value. one minus the <function>similarity()</function> value.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>&lt;&lt;-&gt;</literal> <type>text</type> <type>text</type> <literal>&lt;&lt;-&gt;</literal> <type>text</type>
</entry> <returnvalue>real</returnvalue>
<entry><type>real</type></entry> </para>
<entry> <para>
Returns the <quote>distance</quote> between the arguments, that is Returns the <quote>distance</quote> between the arguments, that is
one minus the <function>word_similarity()</function> value. one minus the <function>word_similarity()</function> value.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>&lt;-&gt;&gt;</literal> <type>text</type> <type>text</type> <literal>&lt;-&gt;&gt;</literal> <type>text</type>
</entry> <returnvalue>real</returnvalue>
<entry><type>real</type></entry> </para>
<entry> <para>
Commutator of the <literal>&lt;&lt;-&gt;</literal> operator. Commutator of the <literal>&lt;&lt;-&gt;</literal> operator.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>&lt;&lt;&lt;-&gt;</literal> <type>text</type> <type>text</type> <literal>&lt;&lt;&lt;-&gt;</literal> <type>text</type>
</entry> <returnvalue>real</returnvalue>
<entry><type>real</type></entry> </para>
<entry> <para>
Returns the <quote>distance</quote> between the arguments, that is Returns the <quote>distance</quote> between the arguments, that is
one minus the <function>strict_word_similarity()</function> value. one minus the <function>strict_word_similarity()</function> value.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<type>text</type> <literal>&lt;-&gt;&gt;&gt;</literal> <type>text</type> <type>text</type> <literal>&lt;-&gt;&gt;&gt;</literal> <type>text</type>
</entry> <returnvalue>real</returnvalue>
<entry><type>real</type></entry> </para>
<entry> <para>
Commutator of the <literal>&lt;&lt;&lt;-&gt;</literal> operator. Commutator of the <literal>&lt;&lt;&lt;-&gt;</literal> operator.
</entry> </para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -198,8 +198,6 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d ...@@ -198,8 +198,6 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
<para> <para>
Generate data and load it into the standard tables, Generate data and load it into the standard tables,
replacing any data already present. replacing any data already present.
The default is to generate data client-side (<literal>g</literal>)
and transmit it over the connection.
</para> </para>
<para> <para>
With <literal>g</literal> (client-side data generation), With <literal>g</literal> (client-side data generation),
...@@ -207,18 +205,21 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d ...@@ -207,18 +205,21 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
sent to the server. This uses the client/server bandwidth sent to the server. This uses the client/server bandwidth
extensively through a <command>COPY</command>. extensively through a <command>COPY</command>.
Using <literal>g</literal> causes logging to print one message Using <literal>g</literal> causes logging to print one message
every 100,000 rows when generating data into every 100,000 rows while generating data for the
<structname>pgbench_accounts</structname> table. <structname>pgbench_accounts</structname> table.
</para> </para>
<para> <para>
With <literal>G</literal> (server-side data generation), With <literal>G</literal> (server-side data generation),
only limited queries are sent from <command>pgbench</command> only small queries are sent from the <command>pgbench</command>
client and then data is actually generated in the server. client and then data is actually generated in the server.
No significant bandwidth is required for this variant, but No significant bandwidth is required for this variant, but
the server will do more work. the server will do more work.
Using <literal>G</literal> causes logging not to print any progress Using <literal>G</literal> causes logging not to print any progress
message when generating data into message while generating data.
<structname>pgbench_accounts</structname> table. </para>
<para>
The default initialization behavior uses client-side data
generation (equivalent to <literal>g</literal>).
</para> </para>
</listitem> </listitem>
</varlistentry> </varlistentry>
...@@ -1011,8 +1012,10 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d ...@@ -1011,8 +1012,10 @@ pgbench <optional> <replaceable>options</replaceable> </optional> <replaceable>d
</para> </para>
<table id="pgbench-automatic-variables"> <table id="pgbench-automatic-variables">
<title>Automatic Variables</title> <title>pgbench Automatic Variables</title>
<tgroup cols="2"> <tgroup cols="2">
<colspec colname="col1" colwidth="1*"/>
<colspec colname="col2" colwidth="2*"/>
<thead> <thead>
<row> <row>
<entry>Variable</entry> <entry>Variable</entry>
...@@ -1253,163 +1256,364 @@ SELECT 4 AS four \; SELECT 5 AS five \aset ...@@ -1253,163 +1256,364 @@ SELECT 4 AS four \; SELECT 5 AS five \aset
<xref linkend="pgbench-operators"/> are built into <application>pgbench</application> <xref linkend="pgbench-operators"/> are built into <application>pgbench</application>
and may be used in expressions appearing in and may be used in expressions appearing in
<link linkend="pgbench-metacommand-set"><literal>\set</literal></link>. <link linkend="pgbench-metacommand-set"><literal>\set</literal></link>.
The operators are listed in increasing precedence order.
Except as noted, operators taking two numeric inputs will produce
a double value if either input is double, otherwise they produce
an integer result.
</para> </para>
<table id="pgbench-operators"> <table id="pgbench-operators">
<title>pgbench Operators by Increasing Precedence</title> <title>pgbench Operators</title>
<tgroup cols="4"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Operator</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Description</entry> Operator
<entry>Example</entry> </para>
<entry>Result</entry> <para>
Description
</para>
<para>
Example(s)
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><literal>OR</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>logical or</entry> <replaceable>boolean</replaceable> <literal>OR</literal> <replaceable>boolean</replaceable>
<entry><literal>5 or 0</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>TRUE</literal></entry> </para>
<para>
Logical OR
</para>
<para>
<literal>5 or 0</literal>
<returnvalue>TRUE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>AND</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>logical and</entry> <replaceable>boolean</replaceable> <literal>AND</literal> <replaceable>boolean</replaceable>
<entry><literal>3 and 0</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>FALSE</literal></entry> </para>
<para>
Logical AND
</para>
<para>
<literal>3 and 0</literal>
<returnvalue>FALSE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>NOT</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>logical not</entry> <literal>NOT</literal> <replaceable>boolean</replaceable>
<entry><literal>not false</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>TRUE</literal></entry> </para>
<para>
Logical NOT
</para>
<para>
<literal>not false</literal>
<returnvalue>TRUE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>IS [NOT] (NULL|TRUE|FALSE)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>value tests</entry> <replaceable>boolean</replaceable> <literal>IS [NOT] (NULL|TRUE|FALSE)</literal>
<entry><literal>1 is null</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>FALSE</literal></entry> </para>
<para>
Boolean value tests
</para>
<para>
<literal>1 is null</literal>
<returnvalue>FALSE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>ISNULL|NOTNULL</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>null tests</entry> <replaceable>value</replaceable> <literal>ISNULL|NOTNULL</literal>
<entry><literal>1 notnull</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>TRUE</literal></entry> </para>
<para>
Nullness tests
</para>
<para>
<literal>1 notnull</literal>
<returnvalue>TRUE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>=</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>is equal</entry> <replaceable>number</replaceable> <literal>=</literal> <replaceable>number</replaceable>
<entry><literal>5 = 4</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>FALSE</literal></entry> </para>
<para>
Equal
</para>
<para>
<literal>5 = 4</literal>
<returnvalue>FALSE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>&lt;&gt;</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>is not equal</entry> <replaceable>number</replaceable> <literal>&lt;&gt;</literal> <replaceable>number</replaceable>
<entry><literal>5 &lt;&gt; 4</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>TRUE</literal></entry> </para>
<para>
Not equal
</para>
<para>
<literal>5 &lt;&gt; 4</literal>
<returnvalue>TRUE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>!=</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>is not equal</entry> <replaceable>number</replaceable> <literal>!=</literal> <replaceable>number</replaceable>
<entry><literal>5 != 5</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>FALSE</literal></entry> </para>
<para>
Not equal
</para>
<para>
<literal>5 != 5</literal>
<returnvalue>FALSE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>&lt;</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>lower than</entry> <replaceable>number</replaceable> <literal>&lt;</literal> <replaceable>number</replaceable>
<entry><literal>5 &lt; 4</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>FALSE</literal></entry> </para>
<para>
Less than
</para>
<para>
<literal>5 &lt; 4</literal>
<returnvalue>FALSE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>&lt;=</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>lower or equal</entry> <replaceable>number</replaceable> <literal>&lt;=</literal> <replaceable>number</replaceable>
<entry><literal>5 &lt;= 4</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>FALSE</literal></entry> </para>
<para>
Less than or equal to
</para>
<para>
<literal>5 &lt;= 4</literal>
<returnvalue>FALSE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>&gt;</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>greater than</entry> <replaceable>number</replaceable> <literal>&gt;</literal> <replaceable>number</replaceable>
<entry><literal>5 &gt; 4</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>TRUE</literal></entry> </para>
<para>
Greater than
</para>
<para>
<literal>5 &gt; 4</literal>
<returnvalue>TRUE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>&gt;=</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>greater or equal</entry> <replaceable>number</replaceable> <literal>&gt;=</literal> <replaceable>number</replaceable>
<entry><literal>5 &gt;= 4</literal></entry> <returnvalue><replaceable>boolean</replaceable></returnvalue>
<entry><literal>TRUE</literal></entry> </para>
<para>
Greater than or equal to
</para>
<para>
<literal>5 &gt;= 4</literal>
<returnvalue>TRUE</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>|</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer bitwise OR</entry> <replaceable>integer</replaceable> <literal>|</literal> <replaceable>integer</replaceable>
<entry><literal>1 | 2</literal></entry> <returnvalue><replaceable>integer</replaceable></returnvalue>
<entry><literal>3</literal></entry> </para>
<para>
Bitwise OR
</para>
<para>
<literal>1 | 2</literal>
<returnvalue>3</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>#</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer bitwise XOR</entry> <replaceable>integer</replaceable> <literal>#</literal> <replaceable>integer</replaceable>
<entry><literal>1 # 3</literal></entry> <returnvalue><replaceable>integer</replaceable></returnvalue>
<entry><literal>2</literal></entry> </para>
<para>
Bitwise XOR
</para>
<para>
<literal>1 # 3</literal>
<returnvalue>2</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>&amp;</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer bitwise AND</entry> <replaceable>integer</replaceable> <literal>&amp;</literal> <replaceable>integer</replaceable>
<entry><literal>1 &amp; 3</literal></entry> <returnvalue><replaceable>integer</replaceable></returnvalue>
<entry><literal>1</literal></entry> </para>
<para>
Bitwise AND
</para>
<para>
<literal>1 &amp; 3</literal>
<returnvalue>1</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>~</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer bitwise NOT</entry> <literal>~</literal> <replaceable>integer</replaceable>
<entry><literal>~ 1</literal></entry> <returnvalue><replaceable>integer</replaceable></returnvalue>
<entry><literal>-2</literal></entry> </para>
<para>
Bitwise NOT
</para>
<para>
<literal>~ 1</literal>
<returnvalue>-2</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>&lt;&lt;</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer bitwise shift left</entry> <replaceable>integer</replaceable> <literal>&lt;&lt;</literal> <replaceable>integer</replaceable>
<entry><literal>1 &lt;&lt; 2</literal></entry> <returnvalue><replaceable>integer</replaceable></returnvalue>
<entry><literal>4</literal></entry> </para>
<para>
Bitwise shift left
</para>
<para>
<literal>1 &lt;&lt; 2</literal>
<returnvalue>4</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>&gt;&gt;</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer bitwise shift right</entry> <replaceable>integer</replaceable> <literal>&gt;&gt;</literal> <replaceable>integer</replaceable>
<entry><literal>8 &gt;&gt; 2</literal></entry> <returnvalue><replaceable>integer</replaceable></returnvalue>
<entry><literal>2</literal></entry> </para>
<para>
Bitwise shift right
</para>
<para>
<literal>8 &gt;&gt; 2</literal>
<returnvalue>2</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>+</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>addition</entry> <replaceable>number</replaceable> <literal>+</literal> <replaceable>number</replaceable>
<entry><literal>5 + 4</literal></entry> <returnvalue><replaceable>number</replaceable></returnvalue>
<entry><literal>9</literal></entry> </para>
<para>
Addition
</para>
<para>
<literal>5 + 4</literal>
<returnvalue>9</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>-</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>subtraction</entry> <replaceable>number</replaceable> <literal>-</literal> <replaceable>number</replaceable>
<entry><literal>3 - 2.0</literal></entry> <returnvalue><replaceable>number</replaceable></returnvalue>
<entry><literal>1.0</literal></entry> </para>
<para>
Subtraction
</para>
<para>
<literal>3 - 2.0</literal>
<returnvalue>1.0</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>*</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>multiplication</entry> <replaceable>number</replaceable> <literal>*</literal> <replaceable>number</replaceable>
<entry><literal>5 * 4</literal></entry> <returnvalue><replaceable>number</replaceable></returnvalue>
<entry><literal>20</literal></entry> </para>
<para>
Multiplication
</para>
<para>
<literal>5 * 4</literal>
<returnvalue>20</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>/</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>division (integer truncates the results)</entry> <replaceable>number</replaceable> <literal>/</literal> <replaceable>number</replaceable>
<entry><literal>5 / 3</literal></entry> <returnvalue><replaceable>number</replaceable></returnvalue>
<entry><literal>1</literal></entry> </para>
<para>
Division (truncates the result towards zero if both inputs are integers)
</para>
<para>
<literal>5 / 3</literal>
<returnvalue>1</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>%</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>modulo</entry> <replaceable>integer</replaceable> <literal>%</literal> <replaceable>integer</replaceable>
<entry><literal>3 % 2</literal></entry> <returnvalue><replaceable>integer</replaceable></returnvalue>
<entry><literal>1</literal></entry> </para>
<para>
Modulo (remainder)
</para>
<para>
<literal>3 % 2</literal>
<returnvalue>1</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal>-</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>opposite</entry> <literal>-</literal> <replaceable>number</replaceable>
<entry><literal>- 2.0</literal></entry> <returnvalue><replaceable>number</replaceable></returnvalue>
<entry><literal>-2.0</literal></entry> </para>
<para>
Negation
</para>
<para>
<literal>- 2.0</literal>
<returnvalue>-2.0</returnvalue>
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -1428,153 +1632,295 @@ SELECT 4 AS four \; SELECT 5 AS five \aset ...@@ -1428,153 +1632,295 @@ SELECT 4 AS four \; SELECT 5 AS five \aset
<!-- list pgbench functions in alphabetical order --> <!-- list pgbench functions in alphabetical order -->
<table id="pgbench-functions"> <table id="pgbench-functions">
<title>pgbench Functions</title> <title>pgbench Functions</title>
<tgroup cols="5"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Return Type</entry> Function
<entry>Description</entry> </para>
<entry>Example</entry> <para>
<entry>Result</entry> Description
</para>
<para>
Example(s)
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><literal><function>abs(<replaceable>a</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>same as <replaceable>a</replaceable></entry> <function>abs</function> ( <replaceable>number</replaceable> )
<entry>absolute value</entry> <returnvalue></returnvalue> same type as input
<entry><literal>abs(-17)</literal></entry> </para>
<entry><literal>17</literal></entry> <para>
Absolute value
</para>
<para>
<literal>abs(-17)</literal>
<returnvalue>17</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>debug(<replaceable>a</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>same as <replaceable>a</replaceable> </entry> <function>debug</function> ( <replaceable>number</replaceable> )
<entry>print <replaceable>a</replaceable> to <systemitem>stderr</systemitem>, <returnvalue></returnvalue> same type as input
and return <replaceable>a</replaceable></entry> </para>
<entry><literal>debug(5432.1)</literal></entry> <para>
<entry><literal>5432.1</literal></entry> Prints the argument to <systemitem>stderr</systemitem>,
and returns the argument.
</para>
<para>
<literal>debug(5432.1)</literal>
<returnvalue>5432.1</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>double(<replaceable>i</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>double</entry> <function>double</function> ( <replaceable>number</replaceable> )
<entry>cast to double</entry> <returnvalue>double</returnvalue>
<entry><literal>double(5432)</literal></entry> </para>
<entry><literal>5432.0</literal></entry> <para>
Casts to double.
</para>
<para>
<literal>double(5432)</literal>
<returnvalue>5432.0</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>exp(<replaceable>x</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>double</entry> <function>exp</function> ( <replaceable>number</replaceable> )
<entry>exponential</entry> <returnvalue>double</returnvalue>
<entry><literal>exp(1.0)</literal></entry> </para>
<entry><literal>2.718281828459045</literal></entry> <para>
Exponential (<literal>e</literal> raised to the given power)
</para>
<para>
<literal>exp(1.0)</literal>
<returnvalue>2.718281828459045</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>greatest(<replaceable>a</replaceable> [, <replaceable>...</replaceable> ] )</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>double if any <replaceable>a</replaceable> is double, else integer</entry> <function>greatest</function> ( <replaceable>number</replaceable> <optional>, <literal>...</literal> </optional> )
<entry>largest value among arguments</entry> <returnvalue></returnvalue> <type>double</type> if any argument is double, else <type>integer</type>
<entry><literal>greatest(5, 4, 3, 2)</literal></entry> </para>
<entry><literal>5</literal></entry> <para>
Selects the largest value among the arguments.
</para>
<para>
<literal>greatest(5, 4, 3, 2)</literal>
<returnvalue>5</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>hash(<replaceable>a</replaceable> [, <replaceable>seed</replaceable> ] )</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>hash</function> ( <parameter>value</parameter> <optional>, <parameter>seed</parameter> </optional> )
<entry>alias for <literal>hash_murmur2()</literal></entry> <returnvalue>integer</returnvalue>
<entry><literal>hash(10, 5432)</literal></entry> </para>
<entry><literal>-5817877081768721676</literal></entry> <para>
This is an alias for <function>hash_murmur2</function>.
</para>
<para>
<literal>hash(10, 5432)</literal>
<returnvalue>-5817877081768721676</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>hash_fnv1a(<replaceable>a</replaceable> [, <replaceable>seed</replaceable> ] )</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>hash_fnv1a</function> ( <parameter>value</parameter> <optional>, <parameter>seed</parameter> </optional> )
<entry><ulink url="https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function">FNV-1a hash</ulink></entry> <returnvalue>integer</returnvalue>
<entry><literal>hash_fnv1a(10, 5432)</literal></entry> </para>
<entry><literal>-7793829335365542153</literal></entry> <para>
Computes <ulink url="https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function">FNV-1a hash</ulink>.
</para>
<para>
<literal>hash_fnv1a(10, 5432)</literal>
<returnvalue>-7793829335365542153</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>hash_murmur2(<replaceable>a</replaceable> [, <replaceable>seed</replaceable> ] )</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>hash_murmur2</function> ( <parameter>value</parameter> <optional>, <parameter>seed</parameter> </optional> )
<entry><ulink url="https://en.wikipedia.org/wiki/MurmurHash">MurmurHash2 hash</ulink></entry> <returnvalue>integer</returnvalue>
<entry><literal>hash_murmur2(10, 5432)</literal></entry> </para>
<entry><literal>-5817877081768721676</literal></entry> <para>
Computes <ulink url="https://en.wikipedia.org/wiki/MurmurHash">MurmurHash2 hash</ulink>.
</para>
<para>
<literal>hash_murmur2(10, 5432)</literal>
<returnvalue>-5817877081768721676</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>int(<replaceable>x</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>int</function> ( <replaceable>number</replaceable> )
<entry>cast to int</entry> <returnvalue>integer</returnvalue>
<entry><literal>int(5.4 + 3.8)</literal></entry> </para>
<entry><literal>9</literal></entry> <para>
Casts to integer.
</para>
<para>
<literal>int(5.4 + 3.8)</literal>
<returnvalue>9</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>least(<replaceable>a</replaceable> [, <replaceable>...</replaceable> ] )</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>double if any <replaceable>a</replaceable> is double, else integer</entry> <function>least</function> ( <replaceable>number</replaceable> <optional>, <literal>...</literal> </optional> )
<entry>smallest value among arguments</entry> <returnvalue></returnvalue> <type>double</type> if any argument is double, else <type>integer</type>
<entry><literal>least(5, 4, 3, 2.1)</literal></entry> </para>
<entry><literal>2.1</literal></entry> <para>
Selects the smallest value among the arguments.
</para>
<para>
<literal>least(5, 4, 3, 2.1)</literal>
<returnvalue>2.1</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>ln(<replaceable>x</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>double</entry> <function>ln</function> ( <replaceable>number</replaceable> )
<entry>natural logarithm</entry> <returnvalue>double</returnvalue>
<entry><literal>ln(2.718281828459045)</literal></entry> </para>
<entry><literal>1.0</literal></entry> <para>
Natural logarithm
</para>
<para>
<literal>ln(2.718281828459045)</literal>
<returnvalue>1.0</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>mod(<replaceable>i</replaceable>, <replaceable>j</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>mod</function> ( <replaceable>integer</replaceable>, <replaceable>integer</replaceable> )
<entry>modulo</entry> <returnvalue>integer</returnvalue>
<entry><literal>mod(54, 32)</literal></entry> </para>
<entry><literal>22</literal></entry> <para>
Modulo (remainder)
</para>
<para>
<literal>mod(54, 32)</literal>
<returnvalue>22</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pi()</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>double</entry> <function>pi</function> ()
<entry>value of the constant <phrase role="symbol_font">&pi;</phrase></entry> <returnvalue>double</returnvalue>
<entry><literal>pi()</literal></entry> </para>
<entry><literal>3.14159265358979323846</literal></entry> <para>
Approximate value of <phrase role="symbol_font">&pi;</phrase>
</para>
<para>
<literal>pi()</literal>
<returnvalue>3.14159265358979323846</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>pow(<replaceable>x</replaceable>, <replaceable>y</replaceable>)</function>, <function>power(<replaceable>x</replaceable>, <replaceable>y</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>double</entry> <function>pow</function> ( <parameter>x</parameter>, <parameter>y</parameter> )
<entry>exponentiation</entry> <returnvalue>double</returnvalue>
<entry><literal>pow(2.0, 10)</literal>, <literal>power(2.0, 10)</literal></entry> </para>
<entry><literal>1024.0</literal></entry> <para role="func_signature">
<function>power</function> ( <parameter>x</parameter>, <parameter>y</parameter> )
<returnvalue>double</returnvalue>
</para>
<para>
<parameter>x</parameter> raised to the power of <parameter>y</parameter>
</para>
<para>
<literal>pow(2.0, 10)</literal>
<returnvalue>1024.0</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>random(<replaceable>lb</replaceable>, <replaceable>ub</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>random</function> ( <parameter>lb</parameter>, <parameter>ub</parameter> )
<entry>uniformly-distributed random integer in <literal>[lb, ub]</literal></entry> <returnvalue>integer</returnvalue>
<entry><literal>random(1, 10)</literal></entry> </para>
<entry>an integer between <literal>1</literal> and <literal>10</literal></entry> <para>
Computes a uniformly-distributed random integer in <literal>[lb,
ub]</literal>.
</para>
<para>
<literal>random(1, 10)</literal>
<returnvalue>an integer between 1 and 10</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>random_exponential(<replaceable>lb</replaceable>, <replaceable>ub</replaceable>, <replaceable>parameter</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>random_exponential</function> ( <parameter>lb</parameter>, <parameter>ub</parameter>, <parameter>parameter</parameter> )
<entry>exponentially-distributed random integer in <literal>[lb, ub]</literal>, <returnvalue>integer</returnvalue>
see below</entry> </para>
<entry><literal>random_exponential(1, 10, 3.0)</literal></entry> <para>
<entry>an integer between <literal>1</literal> and <literal>10</literal></entry> Computes an exponentially-distributed random integer in <literal>[lb,
ub]</literal>, see below.
</para>
<para>
<literal>random_exponential(1, 10, 3.0)</literal>
<returnvalue>an integer between 1 and 10</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>random_gaussian(<replaceable>lb</replaceable>, <replaceable>ub</replaceable>, <replaceable>parameter</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>random_gaussian</function> ( <parameter>lb</parameter>, <parameter>ub</parameter>, <parameter>parameter</parameter> )
<entry>Gaussian-distributed random integer in <literal>[lb, ub]</literal>, <returnvalue>integer</returnvalue>
see below</entry> </para>
<entry><literal>random_gaussian(1, 10, 2.5)</literal></entry> <para>
<entry>an integer between <literal>1</literal> and <literal>10</literal></entry> Computes a gaussian-distributed random integer in <literal>[lb,
ub]</literal>, see below.
</para>
<para>
<literal>random_gaussian(1, 10, 2.5)</literal>
<returnvalue>an integer between 1 and 10</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>random_zipfian(<replaceable>lb</replaceable>, <replaceable>ub</replaceable>, <replaceable>parameter</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>integer</entry> <function>random_zipfian</function> ( <parameter>lb</parameter>, <parameter>ub</parameter>, <parameter>parameter</parameter> )
<entry>Zipfian-distributed random integer in <literal>[lb, ub]</literal>, <returnvalue>integer</returnvalue>
see below</entry> </para>
<entry><literal>random_zipfian(1, 10, 1.5)</literal></entry> <para>
<entry>an integer between <literal>1</literal> and <literal>10</literal></entry> Computes a Zipfian-distributed random integer in <literal>[lb,
ub]</literal>, see below.
</para>
<para>
<literal>random_zipfian(1, 10, 1.5)</literal>
<returnvalue>an integer between 1 and 10</returnvalue>
</para></entry>
</row> </row>
<row> <row>
<entry><literal><function>sqrt(<replaceable>x</replaceable>)</function></literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>double</entry> <function>sqrt</function> ( <replaceable>number</replaceable> )
<entry>square root</entry> <returnvalue>double</returnvalue>
<entry><literal>sqrt(2.0)</literal></entry> </para>
<entry><literal>1.414213562</literal></entry> <para>
Square root
</para>
<para>
<literal>sqrt(2.0)</literal>
<returnvalue>1.414213562</returnvalue>
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -1819,7 +2165,7 @@ END; ...@@ -1819,7 +2165,7 @@ END;
format is used for the log files: format is used for the log files:
<synopsis> <synopsis>
<replaceable>interval_start</replaceable> <replaceable>num_transactions</replaceable> <replaceable>sum_latency</replaceable> <replaceable>sum_latency_2</replaceable> <replaceable>min_latency</replaceable> <replaceable>max_latency</replaceable> <optional> <replaceable>sum_lag</replaceable> <replaceable>sum_lag_2</replaceable> <replaceable>min_lag</replaceable> <replaceable>max_lag</replaceable> <optional> <replaceable>skipped</replaceable> </optional> </optional> <replaceable>interval_start</replaceable> <replaceable>num_transactions</replaceable>&zwsp; <replaceable>sum_latency</replaceable> <replaceable>sum_latency_2</replaceable> <replaceable>min_latency</replaceable> <replaceable>max_latency</replaceable>&zwsp; <optional> <replaceable>sum_lag</replaceable> <replaceable>sum_lag_2</replaceable> <replaceable>min_lag</replaceable> <replaceable>max_lag</replaceable> <optional> <replaceable>skipped</replaceable> </optional> </optional>
</synopsis> </synopsis>
where where
......
...@@ -141,6 +141,8 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH"; ...@@ -141,6 +141,8 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH";
<table id="seg-input-examples"> <table id="seg-input-examples">
<title>Examples of Valid <type>seg</type> Input</title> <title>Examples of Valid <type>seg</type> Input</title>
<tgroup cols="2"> <tgroup cols="2">
<colspec colname="col1" colwidth="1*"/>
<colspec colname="col2" colwidth="2*"/>
<tbody> <tbody>
<row> <row>
<entry><literal>5.0</literal></entry> <entry><literal>5.0</literal></entry>
...@@ -248,62 +250,103 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH"; ...@@ -248,62 +250,103 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH";
<table id="seg-gist-operators"> <table id="seg-gist-operators">
<title>Seg GiST Operators</title> <title>Seg GiST Operators</title>
<tgroup cols="2"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Operator</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Description</entry> Operator
</para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><literal>[a, b] &lt;&lt; [c, d]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>[a, b] is entirely to the left of [c, d]. That is, [a, <type>seg</type> <literal>&lt;&lt;</literal> <type>seg</type>
b] &lt;&lt; [c, d] is true if b &lt; c and false otherwise.</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Is the first <type>seg</type> entirely to the left of the second?
[a, b] &lt;&lt; [c, d] is true if b &lt; c.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>[a, b] &gt;&gt; [c, d]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>[a, b] is entirely to the right of [c, d]. That is, [a, <type>seg</type> <literal>&gt;&gt;</literal> <type>seg</type>
b] &gt;&gt; [c, d] is true if a &gt; d and false otherwise.</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Is the first <type>seg</type> entirely to the right of the second?
[a, b] &gt;&gt; [c, d] is true if a &gt; d.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>[a, b] &amp;&lt; [c, d]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Overlaps or is left of &mdash; This might be better read <type>seg</type> <literal>&amp;&lt;</literal> <type>seg</type>
as <quote>does not extend to right of</quote>. It is true when <returnvalue>boolean</returnvalue>
b &lt;= d.</entry> </para>
<para>
Does the first <type>seg</type> not extend to the right of the
second?
[a, b] &amp;&lt; [c, d] is true if b &lt;= d.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>[a, b] &amp;&gt; [c, d]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Overlaps or is right of &mdash; This might be better read <type>seg</type> <literal>&amp;&gt;</literal> <type>seg</type>
as <quote>does not extend to left of</quote>. It is true when <returnvalue>boolean</returnvalue>
a &gt;= c.</entry> </para>
<para>
Does the first <type>seg</type> not extend to the left of the
second?
[a, b] &amp;&gt; [c, d] is true if a &gt;= c.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>[a, b] = [c, d]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Same as &mdash; The segments [a, b] and [c, d] are <type>seg</type> <literal>=</literal> <type>seg</type>
identical, that is, a = c and b = d.</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Are the two <type>seg</type>s equal?
</para></entry>
</row> </row>
<row> <row>
<entry><literal>[a, b] &amp;&amp; [c, d]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>The segments [a, b] and [c, d] overlap.</entry> <type>seg</type> <literal>&amp;&amp;</literal> <type>seg</type>
<returnvalue>boolean</returnvalue>
</para>
<para>
Do the two <type>seg</type>s overlap?
</para></entry>
</row> </row>
<row> <row>
<entry><literal>[a, b] @&gt; [c, d]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>The segment [a, b] contains the segment [c, d], that is, <type>seg</type> <literal>@&gt;</literal> <type>seg</type>
a &lt;= c and b &gt;= d.</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Does the first <type>seg</type> contain the second?
</para></entry>
</row> </row>
<row> <row>
<entry><literal>[a, b] &lt;@ [c, d]</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>The segment [a, b] is contained in [c, d], that is, a <type>seg</type> <literal>&lt;@</literal> <type>seg</type>
&gt;= c and b &lt;= d.</entry> <returnvalue>boolean</returnvalue>
</para>
<para>
Is the first <type>seg</type> contained in the second?
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -318,33 +361,10 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH"; ...@@ -318,33 +361,10 @@ test=&gt; select '6.25 .. 6.50'::seg as "pH";
</para> </para>
<para> <para>
The standard B-tree operators are also provided, for example In addition to the above operators, the usual comparison
operators shown in <xref linkend="functions-comparison-op-table"/> are
<informaltable> available for type <type>seg</type>. These operators
<tgroup cols="2"> first compare (a) to (c),
<thead>
<row>
<entry>Operator</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry><literal>[a, b] &lt; [c, d]</literal></entry>
<entry>Less than</entry>
</row>
<row>
<entry><literal>[a, b] &gt; [c, d]</literal></entry>
<entry>Greater than</entry>
</row>
</tbody>
</tgroup>
</informaltable>
These operators do not make a lot of sense for any practical
purpose but sorting. These operators first compare (a) to (c),
and if these are equal, compare (b) to (d). That results in and if these are equal, compare (b) to (d). That results in
reasonably good sorting in most cases, which is useful if reasonably good sorting in most cases, which is useful if
you want to use ORDER BY with this type. you want to use ORDER BY with this type.
......
...@@ -659,42 +659,74 @@ ERROR: SELinux: security policy violation ...@@ -659,42 +659,74 @@ ERROR: SELinux: security policy violation
<table id="sepgsql-functions-table"> <table id="sepgsql-functions-table">
<title>Sepgsql Functions</title> <title>Sepgsql Functions</title>
<tgroup cols="2"> <tgroup cols="1">
<thead>
<row>
<entry role="func_table_entry"><para role="func_signature">
Function
</para>
<para>
Description
</para></entry>
</row>
</thead>
<tbody> <tbody>
<row> <row>
<entry><literal>sepgsql_getcon() returns text</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>sepgsql_getcon</function> ()
<returnvalue>text</returnvalue>
</para>
<para>
Returns the client domain, the current security label of the client. Returns the client domain, the current security label of the client.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><literal>sepgsql_setcon(text) returns bool</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>sepgsql_setcon</function> ( <type>text</type> )
<returnvalue>boolean</returnvalue>
</para>
<para>
Switches the client domain of the current session to the new domain, Switches the client domain of the current session to the new domain,
if allowed by the security policy. if allowed by the security policy.
It also accepts <literal>NULL</literal> input as a request to transition It also accepts <literal>NULL</literal> input as a request to transition
to the client's original domain. to the client's original domain.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><literal>sepgsql_mcstrans_in(text) returns text</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Translates the given qualified MLS/MCS range into raw format if <function>sepgsql_mcstrans_in</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Translates the given qualified MLS/MCS range into raw format if
the mcstrans daemon is running. the mcstrans daemon is running.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><literal>sepgsql_mcstrans_out(text) returns text</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Translates the given raw MLS/MCS range into qualified format if <function>sepgsql_mcstrans_out</function> ( <type>text</type> )
<returnvalue>text</returnvalue>
</para>
<para>
Translates the given raw MLS/MCS range into qualified format if
the mcstrans daemon is running. the mcstrans daemon is running.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><literal>sepgsql_restorecon(text) returns bool</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>sepgsql_restorecon</function> ( <type>text</type> )
<returnvalue>boolean</returnvalue>
</para>
<para>
Sets up initial security labels for all objects within the Sets up initial security labels for all objects within the
current database. The argument may be NULL, or the name of a specfile current database. The argument may be <literal>NULL</literal>, or the
to be used as alternative of the system default. name of a specfile to be used as alternative of the system default.
</entry> </para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -24,80 +24,96 @@ ...@@ -24,80 +24,96 @@
<title>Functions Provided</title> <title>Functions Provided</title>
<para> <para>
<xref linkend="tablefunc-functions"/> shows the functions provided <xref linkend="tablefunc-functions"/> summarizes the functions provided
by the <filename>tablefunc</filename> module. by the <filename>tablefunc</filename> module.
</para> </para>
<table id="tablefunc-functions"> <table id="tablefunc-functions">
<title><filename>tablefunc</filename> Functions</title> <title><filename>tablefunc</filename> Functions</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Function
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>normal_rand(int numvals, float8 mean, float8 stddev)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof float8</type></entry> <function>normal_rand</function> ( <parameter>numvals</parameter> <type>integer</type>, <parameter>mean</parameter> <type>float8</type>, <parameter>stddev</parameter> <type>float8</type> )
<entry> <returnvalue>setof float8</returnvalue>
Produces a set of normally distributed random values </para>
</entry> <para>
Produces a set of normally distributed random values.
</para></entry>
</row> </row>
<row> <row>
<entry><function>crosstab(text sql)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof record</type></entry> <function>crosstab</function> ( <parameter>sql</parameter> <type>text</type> )
<entry> <returnvalue>setof record</returnvalue>
</para>
<para>
Produces a <quote>pivot table</quote> containing Produces a <quote>pivot table</quote> containing
row names plus <replaceable>N</replaceable> value columns, where row names plus <replaceable>N</replaceable> value columns, where
<replaceable>N</replaceable> is determined by the row type specified in the calling <replaceable>N</replaceable> is determined by the row type specified
query in the calling query.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>crosstab<replaceable>N</replaceable>(text sql)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof table_crosstab_<replaceable>N</replaceable></type></entry> <function>crosstab<replaceable>N</replaceable></function> ( <parameter>sql</parameter> <type>text</type> )
<entry> <returnvalue>setof table_crosstab_<replaceable>N</replaceable></returnvalue>
</para>
<para>
Produces a <quote>pivot table</quote> containing Produces a <quote>pivot table</quote> containing
row names plus <replaceable>N</replaceable> value columns. row names plus <replaceable>N</replaceable> value columns.
<function>crosstab2</function>, <function>crosstab3</function>, and <function>crosstab2</function>, <function>crosstab3</function>, and
<function>crosstab4</function> are predefined, but you can create additional <function>crosstab4</function> are predefined, but you can create additional
<function>crosstab<replaceable>N</replaceable></function> functions as described below <function>crosstab<replaceable>N</replaceable></function> functions as described below.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>crosstab(text source_sql, text category_sql)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof record</type></entry> <function>crosstab</function> ( <parameter>source_sql</parameter> <type>text</type>, <parameter>category_sql</parameter> <type>text</type> )
<entry> <returnvalue>setof record</returnvalue>
</para>
<para>
Produces a <quote>pivot table</quote> Produces a <quote>pivot table</quote>
with the value columns specified by a second query with the value columns specified by a second query.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry><function>crosstab(text sql, int N)</function></entry> <entry role="func_table_entry"><para role="func_signature">
<entry><type>setof record</type></entry> <function>crosstab</function> ( <parameter>sql</parameter> <type>text</type>, <parameter>N</parameter> <type>integer</type> )
<entry> <returnvalue>setof record</returnvalue>
<para>Obsolete version of <function>crosstab(text)</function>. </para>
The parameter <replaceable>N</replaceable> is now ignored, since the number of <para>
value columns is always determined by the calling query Obsolete version of <function>crosstab(text)</function>.
</para> The parameter <parameter>N</parameter> is now ignored, since the
</entry> number of value columns is always determined by the calling query.
</para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function>
connectby(text relname, text keyid_fld, text parent_keyid_fld
[, text orderby_fld ], text start_with, int max_depth
[, text branch_delim ])
</function>
<indexterm><primary>connectby</primary></indexterm> <indexterm><primary>connectby</primary></indexterm>
</entry> <function>connectby</function> ( <parameter>relname</parameter> <type>text</type>, <parameter>keyid_fld</parameter> <type>text</type>, <parameter>parent_keyid_fld</parameter> <type>text</type>
<entry><type>setof record</type></entry> <optional>, <parameter>orderby_fld</parameter> <type>text</type> </optional>, <parameter>start_with</parameter> <type>text</type>, <parameter>max_depth</parameter> <type>integer</type>
<entry> <optional>, <parameter>branch_delim</parameter> <type>text</type> </optional> )
Produces a representation of a hierarchical tree structure <returnvalue>setof record</returnvalue>
</entry> </para>
<para>
Produces a representation of a hierarchical tree structure.
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -37,46 +37,59 @@ ...@@ -37,46 +37,59 @@
<table id="uuid-ossp-functions"> <table id="uuid-ossp-functions">
<title>Functions for UUID Generation</title> <title>Functions for UUID Generation</title>
<tgroup cols="2"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Description</entry> Function
</para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry><function>uuid_generate_v1()</function><indexterm><primary>uuid_generate_v1</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <indexterm><primary>uuid_generate_v1</primary></indexterm>
<function>uuid_generate_v1</function> ()
<returnvalue>uuid</returnvalue>
</para>
<para> <para>
This function generates a version 1 UUID. This involves the MAC Generates a version 1 UUID. This involves the MAC
address of the computer and a time stamp. Note that UUIDs of this address of the computer and a time stamp. Note that UUIDs of this
kind reveal the identity of the computer that created the identifier kind reveal the identity of the computer that created the identifier
and the time at which it did so, which might make it unsuitable for and the time at which it did so, which might make it unsuitable for
certain security-sensitive applications. certain security-sensitive applications.
</para> </para></entry>
</entry>
</row> </row>
<row> <row>
<entry><function>uuid_generate_v1mc()</function><indexterm><primary>uuid_generate_v1mc</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <indexterm><primary>uuid_generate_v1mc</primary></indexterm>
<function>uuid_generate_v1mc</function> ()
<returnvalue>uuid</returnvalue>
</para>
<para> <para>
This function generates a version 1 UUID but uses a random multicast Generates a version 1 UUID, but uses a random multicast
MAC address instead of the real MAC address of the computer. MAC address instead of the real MAC address of the computer.
</para> </para></entry>
</entry>
</row> </row>
<row> <row>
<entry><function>uuid_generate_v3(namespace uuid, name text)</function><indexterm><primary>uuid_generate_v3</primary></indexterm></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <indexterm><primary>uuid_generate_v3</primary></indexterm>
<function>uuid_generate_v3</function> ( <parameter>namespace</parameter> <type>uuid</type>, <parameter>name</parameter> <type>text</type> )
<returnvalue>uuid</returnvalue>
</para>
<para> <para>
This function generates a version 3 UUID in the given namespace using Generates a version 3 UUID in the given namespace using
the specified input name. The namespace should be one of the special the specified input name. The namespace should be one of the special
constants produced by the <function>uuid_ns_*()</function> functions shown constants produced by the <function>uuid_ns_*()</function> functions
in <xref linkend="uuid-ossp-constants"/>. (It could be any UUID in theory.) The name is an identifier shown in <xref linkend="uuid-ossp-constants"/>. (It could be any UUID
in the selected namespace. in theory.) The name is an identifier in the selected namespace.
</para> </para>
<para> <para>
For example: For example:
...@@ -88,28 +101,31 @@ SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org'); ...@@ -88,28 +101,31 @@ SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
derived from the generated UUID. derived from the generated UUID.
The generation of UUIDs by this method has no random or The generation of UUIDs by this method has no random or
environment-dependent element and is therefore reproducible. environment-dependent element and is therefore reproducible.
</para> </para></entry>
</entry>
</row> </row>
<row> <row>
<entry><literal>uuid_generate_v4()</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>uuid_generate_v4</function> ()
<returnvalue>uuid</returnvalue>
</para>
<para> <para>
This function generates a version 4 UUID, which is derived entirely Generates a version 4 UUID, which is derived entirely
from random numbers. from random numbers.
</para> </para></entry>
</entry>
</row> </row>
<row> <row>
<entry><literal>uuid_generate_v5(namespace uuid, name text)</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>uuid_generate_v5</function> ( <parameter>namespace</parameter> <type>uuid</type>, <parameter>name</parameter> <type>text</type> )
<returnvalue>uuid</returnvalue>
</para>
<para> <para>
This function generates a version 5 UUID, which works like a version 3 Generates a version 5 UUID, which works like a version 3
UUID except that SHA-1 is used as a hashing method. Version 5 should UUID except that SHA-1 is used as a hashing method. Version 5 should
be preferred over version 3 because SHA-1 is thought to be more secure be preferred over version 3 because SHA-1 is thought to be more secure
than MD5. than MD5.
</para> </para></entry>
</entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -117,50 +133,71 @@ SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org'); ...@@ -117,50 +133,71 @@ SELECT uuid_generate_v3(uuid_ns_url(), 'http://www.postgresql.org');
<table id="uuid-ossp-constants"> <table id="uuid-ossp-constants">
<title>Functions Returning UUID Constants</title> <title>Functions Returning UUID Constants</title>
<tgroup cols="2"> <tgroup cols="1">
<tbody> <thead>
<row> <row>
<entry><literal>uuid_nil()</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> Function
<para>
A <quote>nil</quote> UUID constant, which does not occur as a real UUID.
</para> </para>
</entry> <para>
Description
</para></entry>
</row> </row>
</thead>
<tbody>
<row> <row>
<entry><literal>uuid_ns_dns()</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>uuid_nil</function> ()
<para> <returnvalue>uuid</returnvalue>
Constant designating the DNS namespace for UUIDs.
</para> </para>
</entry> <para>
Returns a <quote>nil</quote> UUID constant, which does not occur as a
real UUID.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>uuid_ns_url()</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>uuid_ns_dns</function> ()
<returnvalue>uuid</returnvalue>
</para>
<para> <para>
Constant designating the URL namespace for UUIDs. Returns a constant designating the DNS namespace for UUIDs.
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>uuid_ns_url</function> ()
<returnvalue>uuid</returnvalue>
</para> </para>
</entry> <para>
Returns a constant designating the URL namespace for UUIDs.
</para></entry>
</row> </row>
<row> <row>
<entry><literal>uuid_ns_oid()</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>uuid_ns_oid</function> ()
<returnvalue>uuid</returnvalue>
</para>
<para> <para>
Constant designating the ISO object identifier (OID) namespace for Returns a constant designating the ISO object identifier (OID) namespace for
UUIDs. (This pertains to ASN.1 OIDs, which are unrelated to the OIDs UUIDs. (This pertains to ASN.1 OIDs, which are unrelated to the OIDs
used in <productname>PostgreSQL</productname>.) used in <productname>PostgreSQL</productname>.)
</para> </para></entry>
</entry>
</row> </row>
<row> <row>
<entry><literal>uuid_ns_x500()</literal></entry> <entry role="func_table_entry"><para role="func_signature">
<entry> <function>uuid_ns_x500</function> ()
<para> <returnvalue>uuid</returnvalue>
Constant designating the X.500 distinguished name (DN) namespace for
UUIDs.
</para> </para>
</entry> <para>
Returns a constant designating the X.500 distinguished name (DN)
namespace for UUIDs.
</para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
......
...@@ -36,158 +36,132 @@ ...@@ -36,158 +36,132 @@
<para> <para>
<xref linkend="xml2-functions-table"/> shows the functions provided by this module. <xref linkend="xml2-functions-table"/> shows the functions provided by this module.
These functions provide straightforward XML parsing and XPath queries. These functions provide straightforward XML parsing and XPath queries.
All arguments are of type <type>text</type>, so for brevity that is not shown.
</para> </para>
<table id="xml2-functions-table"> <table id="xml2-functions-table">
<title>Functions</title> <title><filename>xml2</filename> Functions</title>
<tgroup cols="3"> <tgroup cols="1">
<thead> <thead>
<row> <row>
<entry>Function</entry> <entry role="func_table_entry"><para role="func_signature">
<entry>Returns</entry> Function
<entry>Description</entry> </para>
<para>
Description
</para></entry>
</row> </row>
</thead> </thead>
<tbody> <tbody>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xml_valid</function> ( <parameter>document</parameter> <type>text</type> )
xml_valid(document) <returnvalue>boolean</returnvalue>
</function> </para>
</entry>
<entry>
<type>bool</type>
</entry>
<entry>
<para> <para>
This parses the document text in its parameter and returns true if the Parses the given document and returns true if the
document is well-formed XML. (Note: this is an alias for the standard document is well-formed XML. (Note: this is an alias for the standard
PostgreSQL function <function>xml_is_well_formed()</function>. The PostgreSQL function <function>xml_is_well_formed()</function>. The
name <function>xml_valid()</function> is technically incorrect since validity name <function>xml_valid()</function> is technically incorrect since validity
and well-formedness have different meanings in XML.) and well-formedness have different meanings in XML.)
</para> </para></entry>
</entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xpath_string</function> ( <parameter>document</parameter> <type>text</type>, <parameter>query</parameter> <type>text</type> )
xpath_string(document, query) <returnvalue>text</returnvalue>
</function>
</entry>
<entry>
<type>text</type>
</entry>
<entry morerows="2">
<para>
These functions evaluate the XPath query on the supplied document, and
cast the result to the specified type.
</para> </para>
</entry> <para>
Evaluates the XPath query on the supplied document, and
casts the result to <type>text</type>.
</para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xpath_number</function> ( <parameter>document</parameter> <type>text</type>, <parameter>query</parameter> <type>text</type> )
xpath_number(document, query) <returnvalue>real</returnvalue>
</function> </para>
</entry> <para>
<entry> Evaluates the XPath query on the supplied document, and
<type>float4</type> casts the result to <type>real</type>.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xpath_bool</function> ( <parameter>document</parameter> <type>text</type>, <parameter>query</parameter> <type>text</type> )
xpath_bool(document, query) <returnvalue>boolean</returnvalue>
</function> </para>
</entry> <para>
<entry> Evaluates the XPath query on the supplied document, and
<type>bool</type> casts the result to <type>boolean</type>.
</entry> </para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xpath_nodeset</function> ( <parameter>document</parameter> <type>text</type>, <parameter>query</parameter> <type>text</type>, <parameter>toptag</parameter> <type>text</type>, <parameter>itemtag</parameter> <type>text</type> )
xpath_nodeset(document, query, toptag, itemtag) <returnvalue>text</returnvalue>
</function> </para>
</entry>
<entry>
<type>text</type>
</entry>
<entry>
<para> <para>
This evaluates query on document and wraps the result in XML tags. If Evaluates the query on the document and wraps the result in XML
the result is multivalued, the output will look like: tags. If the result is multivalued, the output will look like:
<synopsis> <synopsis>
&lt;toptag&gt; &lt;toptag&gt;
&lt;itemtag&gt;Value 1 which could be an XML fragment&lt;/itemtag&gt; &lt;itemtag&gt;Value 1 which could be an XML fragment&lt;/itemtag&gt;
&lt;itemtag&gt;Value 2....&lt;/itemtag&gt; &lt;itemtag&gt;Value 2....&lt;/itemtag&gt;
&lt;/toptag&gt; &lt;/toptag&gt;
</synopsis> </synopsis>
If either <literal>toptag</literal> or <literal>itemtag</literal> is an empty string, the relevant tag is omitted. If either <parameter>toptag</parameter>
</para> or <parameter>itemtag</parameter> is an empty string, the relevant tag
</entry> is omitted.
</para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xpath_nodeset</function> ( <parameter>document</parameter> <type>text</type>, <parameter>query</parameter> <type>text</type>, <parameter>itemtag</parameter> <type>text</type> )
xpath_nodeset(document, query) <returnvalue>text</returnvalue>
</function>
</entry>
<entry>
<type>text</type>
</entry>
<entry>
<para>
Like <function>xpath_nodeset(document, query, toptag, itemtag)</function> but result omits both tags.
</para> </para>
</entry> <para>
Like <function>xpath_nodeset(document, query, toptag, itemtag)</function> but result omits <parameter>toptag</parameter>.
</para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xpath_nodeset</function> ( <parameter>document</parameter> <type>text</type>, <parameter>query</parameter> <type>text</type> )
xpath_nodeset(document, query, itemtag) <returnvalue>text</returnvalue>
</function>
</entry>
<entry>
<type>text</type>
</entry>
<entry>
<para>
Like <function>xpath_nodeset(document, query, toptag, itemtag)</function> but result omits <literal>toptag</literal>.
</para> </para>
</entry> <para>
Like <function>xpath_nodeset(document, query, toptag, itemtag)</function> but result omits both tags.
</para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xpath_list</function> ( <parameter>document</parameter> <type>text</type>, <parameter>query</parameter> <type>text</type>, <parameter>separator</parameter> <type>text</type> )
xpath_list(document, query, separator) <returnvalue>text</returnvalue>
</function>
</entry>
<entry>
<type>text</type>
</entry>
<entry>
<para>
This function returns multiple values separated by the specified
separator, for example <literal>Value 1,Value 2,Value 3</literal> if
separator is <literal>,</literal>.
</para> </para>
</entry> <para>
Evaluates the query on the document and returns multiple values
separated by the specified separator, for example <literal>Value
1,Value 2,Value 3</literal> if <parameter>separator</parameter>
is <literal>,</literal>.
</para></entry>
</row> </row>
<row> <row>
<entry> <entry role="func_table_entry"><para role="func_signature">
<function> <function>xpath_list</function> ( <parameter>document</parameter> <type>text</type>, <parameter>query</parameter> <type>text</type> )
xpath_list(document, query) <returnvalue>text</returnvalue>
</function> </para>
</entry> <para>
<entry>
<type>text</type>
</entry>
<entry>
This is a wrapper for the above function that uses <literal>,</literal> This is a wrapper for the above function that uses <literal>,</literal>
as the separator. as the separator.
</entry> </para></entry>
</row> </row>
</tbody> </tbody>
</tgroup> </tgroup>
...@@ -217,6 +191,8 @@ xpath_table(text key, text document, text relation, text xpaths, text criteria) ...@@ -217,6 +191,8 @@ xpath_table(text key, text document, text relation, text xpaths, text criteria)
<table id="xml2-xpath-table-parameters"> <table id="xml2-xpath-table-parameters">
<title><function>xpath_table</function> Parameters</title> <title><function>xpath_table</function> Parameters</title>
<tgroup cols="2"> <tgroup cols="2">
<colspec colname="col1" colwidth="1*"/>
<colspec colname="col2" colwidth="2*"/>
<thead> <thead>
<row> <row>
<entry>Parameter</entry> <entry>Parameter</entry>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment