example, to get the first few cubes ordered by the first coordinate
(lower left corner) ascending one could use the following query:
<programlisting>
SELECT c FROM test ORDER BY c ~> 1 LIMIT 5;
</programlisting>
And to get 2-D cubes ordered by the first coordinate of the upper right
corner descending:
<programlisting>
SELECT c FROM test ORDER BY c ~> 3 DESC LIMIT 5;
</programlisting>
</para>
<para>
<xref linkend="cube-functions-table"/> shows the available functions.
</para>
<table id="cube-functions-table">
<title>Cube Functions</title>
<tgroup cols="1">
<thead>
<row>
<entry role="func_table_entry"><para role="func_signature">
Function
</para>
<para>
Description
</para>
<para>
Example(s)
</para></entry>
</row>
</thead>
<tbody>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>cube</function> ( <type>float8</type> )
<returnvalue>cube</returnvalue>
</para>
<para>
Makes a one dimensional cube with both coordinates the same.
</para>
<para>
<literal>cube(1)</literal>
<returnvalue>(1)</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>cube</function> ( <type>float8</type>, <type>float8</type> )
<returnvalue>cube</returnvalue>
</para>
<para>
Makes a one dimensional cube.
</para>
<para>
<literal>cube(1, 2)</literal>
<returnvalue>(1),(2)</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>cube</function> ( <type>float8[]</type> )
<returnvalue>cube</returnvalue>
</para>
<para>
Makes a zero-volume cube using the coordinates defined by the array.
</para>
<para>
<literal>cube(ARRAY[1,2,3])</literal>
<returnvalue>(1, 2, 3)</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>cube</function> ( <type>float8[]</type>, <type>float8[]</type> )
<returnvalue>cube</returnvalue>
</para>
<para>
Makes a cube with upper right and lower left coordinates as defined by
the two arrays, which must be of the same length.
</para>
<para>
<literal>cube(ARRAY[1,2], ARRAY[3,4])</literal>
<returnvalue>(1, 2),(3, 4)</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>cube</function> ( <type>cube</type>, <type>float8</type> )
<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
is useful for building cubes piece by piece from calculated values.
</para>
<para>
<literal>cube('(1,2),(3,4)'::cube, 5)</literal>
<returnvalue>(1, 2, 5),(3, 4, 5)</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>cube</function> ( <type>cube</type>, <type>float8</type>, <type>float8</type> )
<returnvalue>cube</returnvalue>
</para>
<para>
Makes a new cube by adding a dimension on to an existing cube. This is
useful for building cubes piece by piece from calculated values.
</para>
<para>
<literal>cube('(1,2),(3,4)'::cube, 5, 6)</literal>
<returnvalue>(1, 2, 5),(3, 4, 6)</returnvalue>
</para></entry>
</row>
<row>
<entry role="func_table_entry"><para role="func_signature">
<function>cube_dim</function> ( <type>cube</type>