summaryrefslogtreecommitdiffstats
path: root/doc/src/sgml/html/cube.html
blob: 3c1addf7381abbf4a037735b19d0e420129158e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>F.11. cube — a multi-dimensional cube data type</title><link rel="stylesheet" type="text/css" href="stylesheet.css" /><link rev="made" href="pgsql-docs@lists.postgresql.org" /><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot" /><link rel="prev" href="citext.html" title="F.10. citext — a case-insensitive character string type" /><link rel="next" href="dblink.html" title="F.12. dblink — connect to other PostgreSQL databases" /></head><body id="docContent" class="container-fluid col-10"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="5" align="center">F.11. cube — a multi-dimensional cube data type</th></tr><tr><td width="10%" align="left"><a accesskey="p" href="citext.html" title="F.10. citext — a case-insensitive character string type">Prev</a> </td><td width="10%" align="left"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><th width="60%" align="center">Appendix F. Additional Supplied Modules and Extensions</th><td width="10%" align="right"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="10%" align="right"> <a accesskey="n" href="dblink.html" title="F.12. dblink — connect to other PostgreSQL databases">Next</a></td></tr></table><hr /></div><div class="sect1" id="CUBE"><div class="titlepage"><div><div><h2 class="title" style="clear: both">F.11. cube — a multi-dimensional cube data type <a href="#CUBE" class="id_link">#</a></h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="cube.html#CUBE-SYNTAX">F.11.1. Syntax</a></span></dt><dt><span class="sect2"><a href="cube.html#CUBE-PRECISION">F.11.2. Precision</a></span></dt><dt><span class="sect2"><a href="cube.html#CUBE-USAGE">F.11.3. Usage</a></span></dt><dt><span class="sect2"><a href="cube.html#CUBE-DEFAULTS">F.11.4. Defaults</a></span></dt><dt><span class="sect2"><a href="cube.html#CUBE-NOTES">F.11.5. Notes</a></span></dt><dt><span class="sect2"><a href="cube.html#CUBE-CREDITS">F.11.6. Credits</a></span></dt></dl></div><a id="id-1.11.7.21.2" class="indexterm"></a><p>
  This module implements a data type <code class="type">cube</code> for
  representing multidimensional cubes.
 </p><p>
  This module is considered <span class="quote"><span class="quote">trusted</span></span>, that is, it can be
  installed by non-superusers who have <code class="literal">CREATE</code> privilege
  on the current database.
 </p><div class="sect2" id="CUBE-SYNTAX"><div class="titlepage"><div><div><h3 class="title">F.11.1. Syntax <a href="#CUBE-SYNTAX" class="id_link">#</a></h3></div></div></div><p>
   <a class="xref" href="cube.html#CUBE-REPR-TABLE" title="Table F.2. Cube External Representations">Table F.2</a> shows the valid external
   representations for the <code class="type">cube</code>
   type.  <em class="replaceable"><code>x</code></em>, <em class="replaceable"><code>y</code></em>, etc. denote
   floating-point numbers.
  </p><div class="table" id="CUBE-REPR-TABLE"><p class="title"><strong>Table F.2. Cube External Representations</strong></p><div class="table-contents"><table class="table" summary="Cube External Representations" border="1"><colgroup><col /><col /></colgroup><thead><tr><th>External Syntax</th><th>Meaning</th></tr></thead><tbody><tr><td><code class="literal"><em class="replaceable"><code>x</code></em></code></td><td>A one-dimensional point
       (or, zero-length one-dimensional interval)
      </td></tr><tr><td><code class="literal">(<em class="replaceable"><code>x</code></em>)</code></td><td>Same as above</td></tr><tr><td><code class="literal"><em class="replaceable"><code>x1</code></em>,<em class="replaceable"><code>x2</code></em>,...,<em class="replaceable"><code>xn</code></em></code></td><td>A point in n-dimensional space, represented internally as a
      zero-volume cube
      </td></tr><tr><td><code class="literal">(<em class="replaceable"><code>x1</code></em>,<em class="replaceable"><code>x2</code></em>,...,<em class="replaceable"><code>xn</code></em>)</code></td><td>Same as above</td></tr><tr><td><code class="literal">(<em class="replaceable"><code>x</code></em>),(<em class="replaceable"><code>y</code></em>)</code></td><td>A one-dimensional interval starting at <em class="replaceable"><code>x</code></em> and ending at <em class="replaceable"><code>y</code></em> or vice versa; the
       order does not matter
      </td></tr><tr><td><code class="literal">[(<em class="replaceable"><code>x</code></em>),(<em class="replaceable"><code>y</code></em>)]</code></td><td>Same as above</td></tr><tr><td><code class="literal">(<em class="replaceable"><code>x1</code></em>,...,<em class="replaceable"><code>xn</code></em>),(<em class="replaceable"><code>y1</code></em>,...,<em class="replaceable"><code>yn</code></em>)</code></td><td>An n-dimensional cube represented by a pair of its diagonally
       opposite corners
      </td></tr><tr><td><code class="literal">[(<em class="replaceable"><code>x1</code></em>,...,<em class="replaceable"><code>xn</code></em>),(<em class="replaceable"><code>y1</code></em>,...,<em class="replaceable"><code>yn</code></em>)]</code></td><td>Same as above</td></tr></tbody></table></div></div><br class="table-break" /><p>
   It does not matter which order the opposite corners of a cube are
   entered in.  The <code class="type">cube</code> functions
   automatically swap values if needed to create a uniform
   <span class="quote"><span class="quote">lower left — upper right</span></span> internal representation.
   When the corners coincide, <code class="type">cube</code> stores only one corner
   along with an <span class="quote"><span class="quote">is point</span></span> flag to avoid wasting space.
  </p><p>
   White space is ignored on input, so
   <code class="literal">[(<em class="replaceable"><code>x</code></em>),(<em class="replaceable"><code>y</code></em>)]</code> is the same as
   <code class="literal">[ ( <em class="replaceable"><code>x</code></em> ), ( <em class="replaceable"><code>y</code></em> ) ]</code>.
  </p></div><div class="sect2" id="CUBE-PRECISION"><div class="titlepage"><div><div><h3 class="title">F.11.2. Precision <a href="#CUBE-PRECISION" class="id_link">#</a></h3></div></div></div><p>
   Values are stored internally as 64-bit floating point numbers. This means
   that numbers with more than about 16 significant digits will be truncated.
  </p></div><div class="sect2" id="CUBE-USAGE"><div class="titlepage"><div><div><h3 class="title">F.11.3. Usage <a href="#CUBE-USAGE" class="id_link">#</a></h3></div></div></div><p>
   <a class="xref" href="cube.html#CUBE-OPERATORS-TABLE" title="Table F.3. Cube Operators">Table F.3</a> shows the specialized operators
   provided for type <code class="type">cube</code>.
  </p><div class="table" id="CUBE-OPERATORS-TABLE"><p class="title"><strong>Table F.3. Cube Operators</strong></p><div class="table-contents"><table class="table" summary="Cube Operators" border="1"><colgroup><col /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">
        Operator
       </p>
       <p>
        Description
       </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">
        <code class="type">cube</code> <code class="literal">&amp;&amp;</code> <code class="type">cube</code><code class="returnvalue">boolean</code>
       </p>
       <p>
        Do the cubes overlap?
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="type">cube</code> <code class="literal">@&gt;</code> <code class="type">cube</code><code class="returnvalue">boolean</code>
       </p>
       <p>
        Does the first cube contain the second?
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="type">cube</code> <code class="literal">&lt;@</code> <code class="type">cube</code><code class="returnvalue">boolean</code>
       </p>
       <p>
        Is the first cube contained in the second?
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="type">cube</code> <code class="literal">-&gt;</code> <code class="type">integer</code><code class="returnvalue">float8</code>
       </p>
       <p>
        Extracts the <em class="parameter"><code>n</code></em>-th coordinate of the cube
        (counting from 1).
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="type">cube</code> <code class="literal">~&gt;</code> <code class="type">integer</code><code class="returnvalue">float8</code>
       </p>
       <p>
        Extracts the <em class="parameter"><code>n</code></em>-th coordinate of the cube,
        counting in the following way: <em class="parameter"><code>n</code></em> = 2
        * <em class="parameter"><code>k</code></em> - 1 means lower bound
        of <em class="parameter"><code>k</code></em>-th dimension, <em class="parameter"><code>n</code></em> = 2
        * <em class="parameter"><code>k</code></em> means upper bound of
        <em class="parameter"><code>k</code></em>-th dimension.  Negative
        <em class="parameter"><code>n</code></em> denotes the inverse value of the corresponding
        positive coordinate.  This operator is designed for KNN-GiST support.
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="type">cube</code> <code class="literal">&lt;-&gt;</code> <code class="type">cube</code><code class="returnvalue">float8</code>
       </p>
       <p>
        Computes the Euclidean distance between the two cubes.
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="type">cube</code> <code class="literal">&lt;#&gt;</code> <code class="type">cube</code><code class="returnvalue">float8</code>
       </p>
       <p>
        Computes the taxicab (L-1 metric) distance between the two cubes.
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="type">cube</code> <code class="literal">&lt;=&gt;</code> <code class="type">cube</code><code class="returnvalue">float8</code>
       </p>
       <p>
        Computes the Chebyshev (L-inf metric) distance between the two cubes.
       </p></td></tr></tbody></table></div></div><br class="table-break" /><p>
   In addition to the above operators, the usual comparison
   operators shown in <a class="xref" href="functions-comparison.html#FUNCTIONS-COMPARISON-OP-TABLE" title="Table 9.1. Comparison Operators">Table 9.1</a> are
   available for type <code class="type">cube</code>.  These
   operators first compare the first coordinates, and if those are equal,
   compare the second coordinates, etc.  They exist mainly to support the
   b-tree index operator class for <code class="type">cube</code>, which can be useful for
   example if you would like a UNIQUE constraint on a <code class="type">cube</code> column.
   Otherwise, this ordering is not of much practical use.
  </p><p>
   The <code class="filename">cube</code> module also provides a GiST index operator class for
   <code class="type">cube</code> values.
   A <code class="type">cube</code> GiST index can be used to search for values using the
   <code class="literal">=</code>, <code class="literal">&amp;&amp;</code>, <code class="literal">@&gt;</code>, and
   <code class="literal">&lt;@</code> operators in <code class="literal">WHERE</code> clauses.
  </p><p>
   In addition, a <code class="type">cube</code> GiST index can be used to find nearest
   neighbors using the metric operators
   <code class="literal">&lt;-&gt;</code>, <code class="literal">&lt;#&gt;</code>, and
   <code class="literal">&lt;=&gt;</code> in <code class="literal">ORDER BY</code> clauses.
   For example, the nearest neighbor of the 3-D point (0.5, 0.5, 0.5)
   could be found efficiently with:
</p><pre class="programlisting">
SELECT c FROM test ORDER BY c &lt;-&gt; cube(array[0.5,0.5,0.5]) LIMIT 1;
</pre><p>
  </p><p>
   The <code class="literal">~&gt;</code> operator can also be used in this way to
   efficiently retrieve the first few values sorted by a selected coordinate.
   For example, to get the first few cubes ordered by the first coordinate
   (lower left corner) ascending one could use the following query:
</p><pre class="programlisting">
SELECT c FROM test ORDER BY c ~&gt; 1 LIMIT 5;
</pre><p>
   And to get 2-D cubes ordered by the first coordinate of the upper right
   corner descending:
</p><pre class="programlisting">
SELECT c FROM test ORDER BY c ~&gt; 3 DESC LIMIT 5;
</pre><p>
  </p><p>
   <a class="xref" href="cube.html#CUBE-FUNCTIONS-TABLE" title="Table F.4. Cube Functions">Table F.4</a> shows the available functions.
  </p><div class="table" id="CUBE-FUNCTIONS-TABLE"><p class="title"><strong>Table F.4. Cube Functions</strong></p><div class="table-contents"><table class="table" summary="Cube Functions" border="1"><colgroup><col /></colgroup><thead><tr><th class="func_table_entry"><p class="func_signature">
        Function
       </p>
       <p>
        Description
       </p>
       <p>
        Example(s)
       </p></th></tr></thead><tbody><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube</code> ( <code class="type">float8</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        Makes a one dimensional cube with both coordinates the same.
       </p>
       <p>
        <code class="literal">cube(1)</code><code class="returnvalue">(1)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube</code> ( <code class="type">float8</code>, <code class="type">float8</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        Makes a one dimensional cube.
       </p>
       <p>
        <code class="literal">cube(1, 2)</code><code class="returnvalue">(1),(2)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube</code> ( <code class="type">float8[]</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        Makes a zero-volume cube using the coordinates defined by the array.
       </p>
       <p>
        <code class="literal">cube(ARRAY[1,2,3])</code><code class="returnvalue">(1, 2, 3)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube</code> ( <code class="type">float8[]</code>, <code class="type">float8[]</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        Makes a cube with upper right and lower left coordinates as defined by
        the two arrays, which must be of the same length.
       </p>
       <p>
        <code class="literal">cube(ARRAY[1,2], ARRAY[3,4])</code><code class="returnvalue">(1, 2),(3, 4)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube</code> ( <code class="type">cube</code>, <code class="type">float8</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        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.
       </p>
       <p>
        <code class="literal">cube('(1,2),(3,4)'::cube, 5)</code><code class="returnvalue">(1, 2, 5),(3, 4, 5)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube</code> ( <code class="type">cube</code>, <code class="type">float8</code>, <code class="type">float8</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        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.
       </p>
       <p>
        <code class="literal">cube('(1,2),(3,4)'::cube, 5, 6)</code><code class="returnvalue">(1, 2, 5),(3, 4, 6)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_dim</code> ( <code class="type">cube</code> )
        → <code class="returnvalue">integer</code>
       </p>
       <p>
        Returns the number of dimensions of the cube.
       </p>
       <p>
        <code class="literal">cube_dim('(1,2),(3,4)')</code><code class="returnvalue">2</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_ll_coord</code> ( <code class="type">cube</code>, <code class="type">integer</code> )
        → <code class="returnvalue">float8</code>
       </p>
       <p>
        Returns the <em class="parameter"><code>n</code></em>-th coordinate value for the lower
        left corner of the cube.
       </p>
       <p>
        <code class="literal">cube_ll_coord('(1,2),(3,4)', 2)</code><code class="returnvalue">2</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_ur_coord</code> ( <code class="type">cube</code>, <code class="type">integer</code> )
        → <code class="returnvalue">float8</code>
       </p>
       <p>
        Returns the <em class="parameter"><code>n</code></em>-th coordinate value for the
        upper right corner of the cube.
       </p>
       <p>
        <code class="literal">cube_ur_coord('(1,2),(3,4)', 2)</code><code class="returnvalue">4</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_is_point</code> ( <code class="type">cube</code> )
        → <code class="returnvalue">boolean</code>
       </p>
       <p>
        Returns true if the cube is a point, that is,
        the two defining corners are the same.
       </p>
       <p>
        <code class="literal">cube_is_point(cube(1,1))</code><code class="returnvalue">t</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_distance</code> ( <code class="type">cube</code>, <code class="type">cube</code> )
        → <code class="returnvalue">float8</code>
       </p>
       <p>
        Returns the distance between two cubes. If both
        cubes are points, this is the normal distance function.
       </p>
       <p>
        <code class="literal">cube_distance('(1,2)', '(3,4)')</code><code class="returnvalue">2.8284271247461903</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_subset</code> ( <code class="type">cube</code>, <code class="type">integer[]</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        Makes a new cube from an existing cube, using a list of
        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
        desired.
       </p>
       <p>
        <code class="literal">cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[2])</code><code class="returnvalue">(3),(7)</code>
       </p>
       <p>
        <code class="literal">cube_subset(cube('(1,3,5),(6,7,8)'), ARRAY[3,2,1,1])</code><code class="returnvalue">(5, 3, 1, 1),(8, 7, 6, 6)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_union</code> ( <code class="type">cube</code>, <code class="type">cube</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        Produces the union of two cubes.
       </p>
       <p>
        <code class="literal">cube_union('(1,2)', '(3,4)')</code><code class="returnvalue">(1, 2),(3, 4)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_inter</code> ( <code class="type">cube</code>, <code class="type">cube</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        Produces the intersection of two cubes.
       </p>
       <p>
        <code class="literal">cube_inter('(1,2)', '(3,4)')</code><code class="returnvalue">(3, 4),(1, 2)</code>
       </p></td></tr><tr><td class="func_table_entry"><p class="func_signature">
        <code class="function">cube_enlarge</code> ( <em class="parameter"><code>c</code></em> <code class="type">cube</code>, <em class="parameter"><code>r</code></em> <code class="type">double</code>, <em class="parameter"><code>n</code></em> <code class="type">integer</code> )
        → <code class="returnvalue">cube</code>
       </p>
       <p>
        Increases the size of the cube by the specified
        radius <em class="parameter"><code>r</code></em> in at least <em class="parameter"><code>n</code></em>
        dimensions.  If the radius is negative the cube is shrunk instead.
        All defined dimensions are changed by the
        radius <em class="parameter"><code>r</code></em>.  Lower-left coordinates are decreased
        by <em class="parameter"><code>r</code></em> and upper-right coordinates are increased
        by <em class="parameter"><code>r</code></em>.  If a lower-left coordinate is increased
        to more than the corresponding upper-right coordinate (this can only
        happen when <em class="parameter"><code>r</code></em> &lt; 0) than both coordinates are
        set to their average.  If <em class="parameter"><code>n</code></em> is greater than the
        number of defined dimensions and the cube is being enlarged
        (<em class="parameter"><code>r</code></em> &gt; 0), then extra dimensions are added to
        make <em class="parameter"><code>n</code></em> altogether; 0 is used as the initial
        value for the extra coordinates.  This function is useful for creating
        bounding boxes around a point for searching for nearby points.
       </p>
       <p>
        <code class="literal">cube_enlarge('(1,2),(3,4)', 0.5, 3)</code><code class="returnvalue">(0.5, 1.5, -0.5),(3.5, 4.5, 0.5)</code>
       </p></td></tr></tbody></table></div></div><br class="table-break" /></div><div class="sect2" id="CUBE-DEFAULTS"><div class="titlepage"><div><div><h3 class="title">F.11.4. Defaults <a href="#CUBE-DEFAULTS" class="id_link">#</a></h3></div></div></div><p>
   This union:
  </p><pre class="programlisting">
select cube_union('(0,5,2),(2,3,1)', '0');
cube_union
-------------------
(0, 0, 0),(2, 5, 2)
(1 row)
</pre><p>
    does not contradict common sense, neither does the intersection:
   </p><pre class="programlisting">
select cube_inter('(0,-1),(1,1)', '(-2),(2)');
cube_inter
-------------
(0, 0),(1, 0)
(1 row)
</pre><p>
    In all binary operations on differently-dimensioned cubes,
    the lower-dimensional one is assumed to be a Cartesian projection, i. e., having zeroes
    in place of coordinates omitted in the string representation. The above
    examples are equivalent to:
   </p><pre class="programlisting">
cube_union('(0,5,2),(2,3,1)','(0,0,0),(0,0,0)');
cube_inter('(0,-1),(1,1)','(-2,0),(2,0)');
</pre><p>
    The following containment predicate uses the point syntax,
    while in fact the second argument is internally represented by a box.
    This syntax makes it unnecessary to define a separate point type
    and functions for (box,point) predicates.
   </p><pre class="programlisting">
select cube_contains('(0,0),(1,1)', '0.5,0.5');
cube_contains
--------------
t
(1 row)
</pre></div><div class="sect2" id="CUBE-NOTES"><div class="titlepage"><div><div><h3 class="title">F.11.5. Notes <a href="#CUBE-NOTES" class="id_link">#</a></h3></div></div></div><p>
   For examples of usage, see the regression test <code class="filename">sql/cube.sql</code>.
  </p><p>
   To make it harder for people to break things, there
   is a limit of 100 on the number of dimensions of cubes. This is set
   in <code class="filename">cubedata.h</code> if you need something bigger.
  </p></div><div class="sect2" id="CUBE-CREDITS"><div class="titlepage"><div><div><h3 class="title">F.11.6. Credits <a href="#CUBE-CREDITS" class="id_link">#</a></h3></div></div></div><p>
   Original author: Gene Selkov, Jr. <code class="email">&lt;<a class="email" href="mailto:selkovjr@mcs.anl.gov">selkovjr@mcs.anl.gov</a>&gt;</code>,
   Mathematics and Computer Science Division, Argonne National Laboratory.
  </p><p>
   My thanks are primarily to Prof. Joe Hellerstein
   (<a class="ulink" href="https://dsf.berkeley.edu/jmh/" target="_top">https://dsf.berkeley.edu/jmh/</a>) for elucidating the
   gist of the GiST (<a class="ulink" href="http://gist.cs.berkeley.edu/" target="_top">http://gist.cs.berkeley.edu/</a>), and
   to his former student Andy Dong for his example written for Illustra.
   I am also grateful to all Postgres developers, present and past, for
   enabling myself to create my own world and live undisturbed in it. And I
   would like to acknowledge my gratitude to Argonne Lab and to the
   U.S. Department of Energy for the years of faithful support of my database
   research.
  </p><p>
   Minor updates to this package were made by Bruno Wolff III
   <code class="email">&lt;<a class="email" href="mailto:bruno@wolff.to">bruno@wolff.to</a>&gt;</code> in August/September of 2002. These include
   changing the precision from single precision to double precision and adding
   some new functions.
  </p><p>
   Additional updates were made by Joshua Reich <code class="email">&lt;<a class="email" href="mailto:josh@root.net">josh@root.net</a>&gt;</code> in
   July 2006. These include <code class="literal">cube(float8[], float8[])</code> and
   cleaning up the code to use the V1 call protocol instead of the deprecated
   V0 protocol.
  </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="citext.html" title="F.10. citext — a case-insensitive character string type">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="contrib.html" title="Appendix F. Additional Supplied Modules and Extensions">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="dblink.html" title="F.12. dblink — connect to other PostgreSQL databases">Next</a></td></tr><tr><td width="40%" align="left" valign="top">F.10. citext — a case-insensitive character string type </td><td width="20%" align="center"><a accesskey="h" href="index.html" title="PostgreSQL 16.3 Documentation">Home</a></td><td width="40%" align="right" valign="top"> F.12. dblink — connect to other PostgreSQL databases</td></tr></table></div></body></html>