Consistently use "superuser" instead of "super user"
[pgsql.git] / src / test / regress / expected / geometry.out
blob974e2ec43a48ff01ca34749f754db0de1f285c03
1 --
2 -- GEOMETRY
3 --
4 -- Back off displayed precision a little bit to reduce platform-to-platform
5 -- variation in results.
6 SET extra_float_digits TO -3;
7 --
8 -- Points
9 --
10 SELECT center(f1) AS center
11    FROM BOX_TBL;
12  center  
13 ---------
14  (1,1)
15  (2,2)
16  (-5,-4)
17  (2.5,3)
18  (3,3)
19 (5 rows)
21 SELECT (@@ f1) AS center
22    FROM BOX_TBL;
23  center  
24 ---------
25  (1,1)
26  (2,2)
27  (-5,-4)
28  (2.5,3)
29  (3,3)
30 (5 rows)
32 SELECT point(f1) AS center
33    FROM CIRCLE_TBL;
34   center   
35 -----------
36  (5,1)
37  (1,2)
38  (1,3)
39  (1,2)
40  (100,200)
41  (100,1)
42  (3,5)
43  (3,5)
44 (8 rows)
46 SELECT (@@ f1) AS center
47    FROM CIRCLE_TBL;
48   center   
49 -----------
50  (5,1)
51  (1,2)
52  (1,3)
53  (1,2)
54  (100,200)
55  (100,1)
56  (3,5)
57  (3,5)
58 (8 rows)
60 SELECT (@@ f1) AS center
61    FROM POLYGON_TBL
62    WHERE (# f1) > 2;
63             center             
64 -------------------------------
65  (1.33333333333,1.33333333333)
66  (2.33333333333,1.33333333333)
67  (4,5)
68  (4,5)
69  (4,3)
70 (5 rows)
72 -- "is horizontal" function
73 SELECT p1.f1
74    FROM POINT_TBL p1
75    WHERE ishorizontal(p1.f1, point '(0,0)');
76         f1        
77 ------------------
78  (0,0)
79  (-10,0)
80  (1e-300,-1e-300)
81 (3 rows)
83 -- "is horizontal" operator
84 SELECT p1.f1
85    FROM POINT_TBL p1
86    WHERE p1.f1 ?- point '(0,0)';
87         f1        
88 ------------------
89  (0,0)
90  (-10,0)
91  (1e-300,-1e-300)
92 (3 rows)
94 -- "is vertical" function
95 SELECT p1.f1
96    FROM POINT_TBL p1
97    WHERE isvertical(p1.f1, point '(5.1,34.5)');
98      f1     
99 ------------
100  (5.1,34.5)
101 (1 row)
103 -- "is vertical" operator
104 SELECT p1.f1
105    FROM POINT_TBL p1
106    WHERE p1.f1 ?| point '(5.1,34.5)';
107      f1     
108 ------------
109  (5.1,34.5)
110 (1 row)
112 -- Slope
113 SELECT p1.f1, p2.f1, slope(p1.f1, p2.f1) FROM POINT_TBL p1, POINT_TBL p2;
114         f1         |        f1         |     slope      
115 -------------------+-------------------+----------------
116  (0,0)             | (0,0)             |       Infinity
117  (0,0)             | (-10,0)           |              0
118  (0,0)             | (-3,4)            | -1.33333333333
119  (0,0)             | (5.1,34.5)        |  6.76470588235
120  (0,0)             | (-5,-12)          |            2.4
121  (0,0)             | (1e-300,-1e-300)  |       Infinity
122  (0,0)             | (1e+300,Infinity) |       Infinity
123  (0,0)             | (Infinity,1e+300) |              0
124  (0,0)             | (NaN,NaN)         |            NaN
125  (0,0)             | (10,10)           |              1
126  (-10,0)           | (0,0)             |              0
127  (-10,0)           | (-10,0)           |       Infinity
128  (-10,0)           | (-3,4)            | 0.571428571429
129  (-10,0)           | (5.1,34.5)        |  2.28476821192
130  (-10,0)           | (-5,-12)          |           -2.4
131  (-10,0)           | (1e-300,-1e-300)  |              0
132  (-10,0)           | (1e+300,Infinity) |       Infinity
133  (-10,0)           | (Infinity,1e+300) |              0
134  (-10,0)           | (NaN,NaN)         |            NaN
135  (-10,0)           | (10,10)           |            0.5
136  (-3,4)            | (0,0)             | -1.33333333333
137  (-3,4)            | (-10,0)           | 0.571428571429
138  (-3,4)            | (-3,4)            |       Infinity
139  (-3,4)            | (5.1,34.5)        |  3.76543209877
140  (-3,4)            | (-5,-12)          |              8
141  (-3,4)            | (1e-300,-1e-300)  | -1.33333333333
142  (-3,4)            | (1e+300,Infinity) |       Infinity
143  (-3,4)            | (Infinity,1e+300) |              0
144  (-3,4)            | (NaN,NaN)         |            NaN
145  (-3,4)            | (10,10)           | 0.461538461538
146  (5.1,34.5)        | (0,0)             |  6.76470588235
147  (5.1,34.5)        | (-10,0)           |  2.28476821192
148  (5.1,34.5)        | (-3,4)            |  3.76543209877
149  (5.1,34.5)        | (5.1,34.5)        |       Infinity
150  (5.1,34.5)        | (-5,-12)          |  4.60396039604
151  (5.1,34.5)        | (1e-300,-1e-300)  |  6.76470588235
152  (5.1,34.5)        | (1e+300,Infinity) |       Infinity
153  (5.1,34.5)        | (Infinity,1e+300) |              0
154  (5.1,34.5)        | (NaN,NaN)         |            NaN
155  (5.1,34.5)        | (10,10)           |             -5
156  (-5,-12)          | (0,0)             |            2.4
157  (-5,-12)          | (-10,0)           |           -2.4
158  (-5,-12)          | (-3,4)            |              8
159  (-5,-12)          | (5.1,34.5)        |  4.60396039604
160  (-5,-12)          | (-5,-12)          |       Infinity
161  (-5,-12)          | (1e-300,-1e-300)  |            2.4
162  (-5,-12)          | (1e+300,Infinity) |       Infinity
163  (-5,-12)          | (Infinity,1e+300) |              0
164  (-5,-12)          | (NaN,NaN)         |            NaN
165  (-5,-12)          | (10,10)           |  1.46666666667
166  (1e-300,-1e-300)  | (0,0)             |       Infinity
167  (1e-300,-1e-300)  | (-10,0)           |              0
168  (1e-300,-1e-300)  | (-3,4)            | -1.33333333333
169  (1e-300,-1e-300)  | (5.1,34.5)        |  6.76470588235
170  (1e-300,-1e-300)  | (-5,-12)          |            2.4
171  (1e-300,-1e-300)  | (1e-300,-1e-300)  |       Infinity
172  (1e-300,-1e-300)  | (1e+300,Infinity) |       Infinity
173  (1e-300,-1e-300)  | (Infinity,1e+300) |              0
174  (1e-300,-1e-300)  | (NaN,NaN)         |            NaN
175  (1e-300,-1e-300)  | (10,10)           |              1
176  (1e+300,Infinity) | (0,0)             |       Infinity
177  (1e+300,Infinity) | (-10,0)           |       Infinity
178  (1e+300,Infinity) | (-3,4)            |       Infinity
179  (1e+300,Infinity) | (5.1,34.5)        |       Infinity
180  (1e+300,Infinity) | (-5,-12)          |       Infinity
181  (1e+300,Infinity) | (1e-300,-1e-300)  |       Infinity
182  (1e+300,Infinity) | (1e+300,Infinity) |       Infinity
183  (1e+300,Infinity) | (Infinity,1e+300) |            NaN
184  (1e+300,Infinity) | (NaN,NaN)         |            NaN
185  (1e+300,Infinity) | (10,10)           |       Infinity
186  (Infinity,1e+300) | (0,0)             |              0
187  (Infinity,1e+300) | (-10,0)           |              0
188  (Infinity,1e+300) | (-3,4)            |              0
189  (Infinity,1e+300) | (5.1,34.5)        |              0
190  (Infinity,1e+300) | (-5,-12)          |              0
191  (Infinity,1e+300) | (1e-300,-1e-300)  |              0
192  (Infinity,1e+300) | (1e+300,Infinity) |            NaN
193  (Infinity,1e+300) | (Infinity,1e+300) |       Infinity
194  (Infinity,1e+300) | (NaN,NaN)         |            NaN
195  (Infinity,1e+300) | (10,10)           |              0
196  (NaN,NaN)         | (0,0)             |            NaN
197  (NaN,NaN)         | (-10,0)           |            NaN
198  (NaN,NaN)         | (-3,4)            |            NaN
199  (NaN,NaN)         | (5.1,34.5)        |            NaN
200  (NaN,NaN)         | (-5,-12)          |            NaN
201  (NaN,NaN)         | (1e-300,-1e-300)  |            NaN
202  (NaN,NaN)         | (1e+300,Infinity) |            NaN
203  (NaN,NaN)         | (Infinity,1e+300) |            NaN
204  (NaN,NaN)         | (NaN,NaN)         |            NaN
205  (NaN,NaN)         | (10,10)           |            NaN
206  (10,10)           | (0,0)             |              1
207  (10,10)           | (-10,0)           |            0.5
208  (10,10)           | (-3,4)            | 0.461538461538
209  (10,10)           | (5.1,34.5)        |             -5
210  (10,10)           | (-5,-12)          |  1.46666666667
211  (10,10)           | (1e-300,-1e-300)  |              1
212  (10,10)           | (1e+300,Infinity) |       Infinity
213  (10,10)           | (Infinity,1e+300) |              0
214  (10,10)           | (NaN,NaN)         |            NaN
215  (10,10)           | (10,10)           |       Infinity
216 (100 rows)
218 -- Add point
219 SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM POINT_TBL p1, POINT_TBL p2;
220         f1         |        f1         |      ?column?       
221 -------------------+-------------------+---------------------
222  (0,0)             | (0,0)             | (0,0)
223  (0,0)             | (-10,0)           | (-10,0)
224  (0,0)             | (-3,4)            | (-3,4)
225  (0,0)             | (5.1,34.5)        | (5.1,34.5)
226  (0,0)             | (-5,-12)          | (-5,-12)
227  (0,0)             | (1e-300,-1e-300)  | (1e-300,-1e-300)
228  (0,0)             | (1e+300,Infinity) | (1e+300,Infinity)
229  (0,0)             | (Infinity,1e+300) | (Infinity,1e+300)
230  (0,0)             | (NaN,NaN)         | (NaN,NaN)
231  (0,0)             | (10,10)           | (10,10)
232  (-10,0)           | (0,0)             | (-10,0)
233  (-10,0)           | (-10,0)           | (-20,0)
234  (-10,0)           | (-3,4)            | (-13,4)
235  (-10,0)           | (5.1,34.5)        | (-4.9,34.5)
236  (-10,0)           | (-5,-12)          | (-15,-12)
237  (-10,0)           | (1e-300,-1e-300)  | (-10,-1e-300)
238  (-10,0)           | (1e+300,Infinity) | (1e+300,Infinity)
239  (-10,0)           | (Infinity,1e+300) | (Infinity,1e+300)
240  (-10,0)           | (NaN,NaN)         | (NaN,NaN)
241  (-10,0)           | (10,10)           | (0,10)
242  (-3,4)            | (0,0)             | (-3,4)
243  (-3,4)            | (-10,0)           | (-13,4)
244  (-3,4)            | (-3,4)            | (-6,8)
245  (-3,4)            | (5.1,34.5)        | (2.1,38.5)
246  (-3,4)            | (-5,-12)          | (-8,-8)
247  (-3,4)            | (1e-300,-1e-300)  | (-3,4)
248  (-3,4)            | (1e+300,Infinity) | (1e+300,Infinity)
249  (-3,4)            | (Infinity,1e+300) | (Infinity,1e+300)
250  (-3,4)            | (NaN,NaN)         | (NaN,NaN)
251  (-3,4)            | (10,10)           | (7,14)
252  (5.1,34.5)        | (0,0)             | (5.1,34.5)
253  (5.1,34.5)        | (-10,0)           | (-4.9,34.5)
254  (5.1,34.5)        | (-3,4)            | (2.1,38.5)
255  (5.1,34.5)        | (5.1,34.5)        | (10.2,69)
256  (5.1,34.5)        | (-5,-12)          | (0.1,22.5)
257  (5.1,34.5)        | (1e-300,-1e-300)  | (5.1,34.5)
258  (5.1,34.5)        | (1e+300,Infinity) | (1e+300,Infinity)
259  (5.1,34.5)        | (Infinity,1e+300) | (Infinity,1e+300)
260  (5.1,34.5)        | (NaN,NaN)         | (NaN,NaN)
261  (5.1,34.5)        | (10,10)           | (15.1,44.5)
262  (-5,-12)          | (0,0)             | (-5,-12)
263  (-5,-12)          | (-10,0)           | (-15,-12)
264  (-5,-12)          | (-3,4)            | (-8,-8)
265  (-5,-12)          | (5.1,34.5)        | (0.1,22.5)
266  (-5,-12)          | (-5,-12)          | (-10,-24)
267  (-5,-12)          | (1e-300,-1e-300)  | (-5,-12)
268  (-5,-12)          | (1e+300,Infinity) | (1e+300,Infinity)
269  (-5,-12)          | (Infinity,1e+300) | (Infinity,1e+300)
270  (-5,-12)          | (NaN,NaN)         | (NaN,NaN)
271  (-5,-12)          | (10,10)           | (5,-2)
272  (1e-300,-1e-300)  | (0,0)             | (1e-300,-1e-300)
273  (1e-300,-1e-300)  | (-10,0)           | (-10,-1e-300)
274  (1e-300,-1e-300)  | (-3,4)            | (-3,4)
275  (1e-300,-1e-300)  | (5.1,34.5)        | (5.1,34.5)
276  (1e-300,-1e-300)  | (-5,-12)          | (-5,-12)
277  (1e-300,-1e-300)  | (1e-300,-1e-300)  | (2e-300,-2e-300)
278  (1e-300,-1e-300)  | (1e+300,Infinity) | (1e+300,Infinity)
279  (1e-300,-1e-300)  | (Infinity,1e+300) | (Infinity,1e+300)
280  (1e-300,-1e-300)  | (NaN,NaN)         | (NaN,NaN)
281  (1e-300,-1e-300)  | (10,10)           | (10,10)
282  (1e+300,Infinity) | (0,0)             | (1e+300,Infinity)
283  (1e+300,Infinity) | (-10,0)           | (1e+300,Infinity)
284  (1e+300,Infinity) | (-3,4)            | (1e+300,Infinity)
285  (1e+300,Infinity) | (5.1,34.5)        | (1e+300,Infinity)
286  (1e+300,Infinity) | (-5,-12)          | (1e+300,Infinity)
287  (1e+300,Infinity) | (1e-300,-1e-300)  | (1e+300,Infinity)
288  (1e+300,Infinity) | (1e+300,Infinity) | (2e+300,Infinity)
289  (1e+300,Infinity) | (Infinity,1e+300) | (Infinity,Infinity)
290  (1e+300,Infinity) | (NaN,NaN)         | (NaN,NaN)
291  (1e+300,Infinity) | (10,10)           | (1e+300,Infinity)
292  (Infinity,1e+300) | (0,0)             | (Infinity,1e+300)
293  (Infinity,1e+300) | (-10,0)           | (Infinity,1e+300)
294  (Infinity,1e+300) | (-3,4)            | (Infinity,1e+300)
295  (Infinity,1e+300) | (5.1,34.5)        | (Infinity,1e+300)
296  (Infinity,1e+300) | (-5,-12)          | (Infinity,1e+300)
297  (Infinity,1e+300) | (1e-300,-1e-300)  | (Infinity,1e+300)
298  (Infinity,1e+300) | (1e+300,Infinity) | (Infinity,Infinity)
299  (Infinity,1e+300) | (Infinity,1e+300) | (Infinity,2e+300)
300  (Infinity,1e+300) | (NaN,NaN)         | (NaN,NaN)
301  (Infinity,1e+300) | (10,10)           | (Infinity,1e+300)
302  (NaN,NaN)         | (0,0)             | (NaN,NaN)
303  (NaN,NaN)         | (-10,0)           | (NaN,NaN)
304  (NaN,NaN)         | (-3,4)            | (NaN,NaN)
305  (NaN,NaN)         | (5.1,34.5)        | (NaN,NaN)
306  (NaN,NaN)         | (-5,-12)          | (NaN,NaN)
307  (NaN,NaN)         | (1e-300,-1e-300)  | (NaN,NaN)
308  (NaN,NaN)         | (1e+300,Infinity) | (NaN,NaN)
309  (NaN,NaN)         | (Infinity,1e+300) | (NaN,NaN)
310  (NaN,NaN)         | (NaN,NaN)         | (NaN,NaN)
311  (NaN,NaN)         | (10,10)           | (NaN,NaN)
312  (10,10)           | (0,0)             | (10,10)
313  (10,10)           | (-10,0)           | (0,10)
314  (10,10)           | (-3,4)            | (7,14)
315  (10,10)           | (5.1,34.5)        | (15.1,44.5)
316  (10,10)           | (-5,-12)          | (5,-2)
317  (10,10)           | (1e-300,-1e-300)  | (10,10)
318  (10,10)           | (1e+300,Infinity) | (1e+300,Infinity)
319  (10,10)           | (Infinity,1e+300) | (Infinity,1e+300)
320  (10,10)           | (NaN,NaN)         | (NaN,NaN)
321  (10,10)           | (10,10)           | (20,20)
322 (100 rows)
324 -- Subtract point
325 SELECT p1.f1, p2.f1, p1.f1 - p2.f1 FROM POINT_TBL p1, POINT_TBL p2;
326         f1         |        f1         |       ?column?       
327 -------------------+-------------------+----------------------
328  (0,0)             | (0,0)             | (0,0)
329  (0,0)             | (-10,0)           | (10,0)
330  (0,0)             | (-3,4)            | (3,-4)
331  (0,0)             | (5.1,34.5)        | (-5.1,-34.5)
332  (0,0)             | (-5,-12)          | (5,12)
333  (0,0)             | (1e-300,-1e-300)  | (-1e-300,1e-300)
334  (0,0)             | (1e+300,Infinity) | (-1e+300,-Infinity)
335  (0,0)             | (Infinity,1e+300) | (-Infinity,-1e+300)
336  (0,0)             | (NaN,NaN)         | (NaN,NaN)
337  (0,0)             | (10,10)           | (-10,-10)
338  (-10,0)           | (0,0)             | (-10,0)
339  (-10,0)           | (-10,0)           | (0,0)
340  (-10,0)           | (-3,4)            | (-7,-4)
341  (-10,0)           | (5.1,34.5)        | (-15.1,-34.5)
342  (-10,0)           | (-5,-12)          | (-5,12)
343  (-10,0)           | (1e-300,-1e-300)  | (-10,1e-300)
344  (-10,0)           | (1e+300,Infinity) | (-1e+300,-Infinity)
345  (-10,0)           | (Infinity,1e+300) | (-Infinity,-1e+300)
346  (-10,0)           | (NaN,NaN)         | (NaN,NaN)
347  (-10,0)           | (10,10)           | (-20,-10)
348  (-3,4)            | (0,0)             | (-3,4)
349  (-3,4)            | (-10,0)           | (7,4)
350  (-3,4)            | (-3,4)            | (0,0)
351  (-3,4)            | (5.1,34.5)        | (-8.1,-30.5)
352  (-3,4)            | (-5,-12)          | (2,16)
353  (-3,4)            | (1e-300,-1e-300)  | (-3,4)
354  (-3,4)            | (1e+300,Infinity) | (-1e+300,-Infinity)
355  (-3,4)            | (Infinity,1e+300) | (-Infinity,-1e+300)
356  (-3,4)            | (NaN,NaN)         | (NaN,NaN)
357  (-3,4)            | (10,10)           | (-13,-6)
358  (5.1,34.5)        | (0,0)             | (5.1,34.5)
359  (5.1,34.5)        | (-10,0)           | (15.1,34.5)
360  (5.1,34.5)        | (-3,4)            | (8.1,30.5)
361  (5.1,34.5)        | (5.1,34.5)        | (0,0)
362  (5.1,34.5)        | (-5,-12)          | (10.1,46.5)
363  (5.1,34.5)        | (1e-300,-1e-300)  | (5.1,34.5)
364  (5.1,34.5)        | (1e+300,Infinity) | (-1e+300,-Infinity)
365  (5.1,34.5)        | (Infinity,1e+300) | (-Infinity,-1e+300)
366  (5.1,34.5)        | (NaN,NaN)         | (NaN,NaN)
367  (5.1,34.5)        | (10,10)           | (-4.9,24.5)
368  (-5,-12)          | (0,0)             | (-5,-12)
369  (-5,-12)          | (-10,0)           | (5,-12)
370  (-5,-12)          | (-3,4)            | (-2,-16)
371  (-5,-12)          | (5.1,34.5)        | (-10.1,-46.5)
372  (-5,-12)          | (-5,-12)          | (0,0)
373  (-5,-12)          | (1e-300,-1e-300)  | (-5,-12)
374  (-5,-12)          | (1e+300,Infinity) | (-1e+300,-Infinity)
375  (-5,-12)          | (Infinity,1e+300) | (-Infinity,-1e+300)
376  (-5,-12)          | (NaN,NaN)         | (NaN,NaN)
377  (-5,-12)          | (10,10)           | (-15,-22)
378  (1e-300,-1e-300)  | (0,0)             | (1e-300,-1e-300)
379  (1e-300,-1e-300)  | (-10,0)           | (10,-1e-300)
380  (1e-300,-1e-300)  | (-3,4)            | (3,-4)
381  (1e-300,-1e-300)  | (5.1,34.5)        | (-5.1,-34.5)
382  (1e-300,-1e-300)  | (-5,-12)          | (5,12)
383  (1e-300,-1e-300)  | (1e-300,-1e-300)  | (0,0)
384  (1e-300,-1e-300)  | (1e+300,Infinity) | (-1e+300,-Infinity)
385  (1e-300,-1e-300)  | (Infinity,1e+300) | (-Infinity,-1e+300)
386  (1e-300,-1e-300)  | (NaN,NaN)         | (NaN,NaN)
387  (1e-300,-1e-300)  | (10,10)           | (-10,-10)
388  (1e+300,Infinity) | (0,0)             | (1e+300,Infinity)
389  (1e+300,Infinity) | (-10,0)           | (1e+300,Infinity)
390  (1e+300,Infinity) | (-3,4)            | (1e+300,Infinity)
391  (1e+300,Infinity) | (5.1,34.5)        | (1e+300,Infinity)
392  (1e+300,Infinity) | (-5,-12)          | (1e+300,Infinity)
393  (1e+300,Infinity) | (1e-300,-1e-300)  | (1e+300,Infinity)
394  (1e+300,Infinity) | (1e+300,Infinity) | (0,NaN)
395  (1e+300,Infinity) | (Infinity,1e+300) | (-Infinity,Infinity)
396  (1e+300,Infinity) | (NaN,NaN)         | (NaN,NaN)
397  (1e+300,Infinity) | (10,10)           | (1e+300,Infinity)
398  (Infinity,1e+300) | (0,0)             | (Infinity,1e+300)
399  (Infinity,1e+300) | (-10,0)           | (Infinity,1e+300)
400  (Infinity,1e+300) | (-3,4)            | (Infinity,1e+300)
401  (Infinity,1e+300) | (5.1,34.5)        | (Infinity,1e+300)
402  (Infinity,1e+300) | (-5,-12)          | (Infinity,1e+300)
403  (Infinity,1e+300) | (1e-300,-1e-300)  | (Infinity,1e+300)
404  (Infinity,1e+300) | (1e+300,Infinity) | (Infinity,-Infinity)
405  (Infinity,1e+300) | (Infinity,1e+300) | (NaN,0)
406  (Infinity,1e+300) | (NaN,NaN)         | (NaN,NaN)
407  (Infinity,1e+300) | (10,10)           | (Infinity,1e+300)
408  (NaN,NaN)         | (0,0)             | (NaN,NaN)
409  (NaN,NaN)         | (-10,0)           | (NaN,NaN)
410  (NaN,NaN)         | (-3,4)            | (NaN,NaN)
411  (NaN,NaN)         | (5.1,34.5)        | (NaN,NaN)
412  (NaN,NaN)         | (-5,-12)          | (NaN,NaN)
413  (NaN,NaN)         | (1e-300,-1e-300)  | (NaN,NaN)
414  (NaN,NaN)         | (1e+300,Infinity) | (NaN,NaN)
415  (NaN,NaN)         | (Infinity,1e+300) | (NaN,NaN)
416  (NaN,NaN)         | (NaN,NaN)         | (NaN,NaN)
417  (NaN,NaN)         | (10,10)           | (NaN,NaN)
418  (10,10)           | (0,0)             | (10,10)
419  (10,10)           | (-10,0)           | (20,10)
420  (10,10)           | (-3,4)            | (13,6)
421  (10,10)           | (5.1,34.5)        | (4.9,-24.5)
422  (10,10)           | (-5,-12)          | (15,22)
423  (10,10)           | (1e-300,-1e-300)  | (10,10)
424  (10,10)           | (1e+300,Infinity) | (-1e+300,-Infinity)
425  (10,10)           | (Infinity,1e+300) | (-Infinity,-1e+300)
426  (10,10)           | (NaN,NaN)         | (NaN,NaN)
427  (10,10)           | (10,10)           | (0,0)
428 (100 rows)
430 -- Multiply with point
431 SELECT p1.f1, p2.f1, p1.f1 * p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1[0] BETWEEN 1 AND 1000;
432      f1     |        f1         |       ?column?        
433 ------------+-------------------+-----------------------
434  (5.1,34.5) | (0,0)             | (0,0)
435  (10,10)    | (0,0)             | (0,0)
436  (5.1,34.5) | (-10,0)           | (-51,-345)
437  (10,10)    | (-10,0)           | (-100,-100)
438  (5.1,34.5) | (-3,4)            | (-153.3,-83.1)
439  (10,10)    | (-3,4)            | (-70,10)
440  (5.1,34.5) | (5.1,34.5)        | (-1164.24,351.9)
441  (10,10)    | (5.1,34.5)        | (-294,396)
442  (5.1,34.5) | (-5,-12)          | (388.5,-233.7)
443  (10,10)    | (-5,-12)          | (70,-170)
444  (5.1,34.5) | (1e-300,-1e-300)  | (3.96e-299,2.94e-299)
445  (10,10)    | (1e-300,-1e-300)  | (2e-299,0)
446  (5.1,34.5) | (1e+300,Infinity) | (-Infinity,Infinity)
447  (10,10)    | (1e+300,Infinity) | (-Infinity,Infinity)
448  (5.1,34.5) | (Infinity,1e+300) | (Infinity,Infinity)
449  (10,10)    | (Infinity,1e+300) | (Infinity,Infinity)
450  (5.1,34.5) | (NaN,NaN)         | (NaN,NaN)
451  (10,10)    | (NaN,NaN)         | (NaN,NaN)
452  (5.1,34.5) | (10,10)           | (-294,396)
453  (10,10)    | (10,10)           | (0,200)
454 (20 rows)
456 -- Underflow error
457 SELECT p1.f1, p2.f1, p1.f1 * p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1[0] < 1;
458 ERROR:  value out of range: underflow
459 -- Divide by point
460 SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1[0] BETWEEN 1 AND 1000;
461         f1         |     f1     |                 ?column?                  
462 -------------------+------------+-------------------------------------------
463  (0,0)             | (5.1,34.5) | (0,0)
464  (0,0)             | (10,10)    | (0,0)
465  (-10,0)           | (5.1,34.5) | (-0.0419318237877,0.283656455034)
466  (-10,0)           | (10,10)    | (-0.5,0.5)
467  (-3,4)            | (5.1,34.5) | (0.100883034877,0.101869666025)
468  (-3,4)            | (10,10)    | (0.05,0.35)
469  (5.1,34.5)        | (5.1,34.5) | (1,0)
470  (5.1,34.5)        | (10,10)    | (1.98,1.47)
471  (-5,-12)          | (5.1,34.5) | (-0.361353657935,0.0915100389719)
472  (-5,-12)          | (10,10)    | (-0.85,-0.35)
473  (1e-300,-1e-300)  | (5.1,34.5) | (-2.41724631247e-302,-3.25588278822e-302)
474  (1e-300,-1e-300)  | (10,10)    | (0,-1e-301)
475  (1e+300,Infinity) | (5.1,34.5) | (Infinity,Infinity)
476  (1e+300,Infinity) | (10,10)    | (Infinity,Infinity)
477  (Infinity,1e+300) | (5.1,34.5) | (Infinity,-Infinity)
478  (Infinity,1e+300) | (10,10)    | (Infinity,-Infinity)
479  (NaN,NaN)         | (5.1,34.5) | (NaN,NaN)
480  (NaN,NaN)         | (10,10)    | (NaN,NaN)
481  (10,10)           | (5.1,34.5) | (0.325588278822,-0.241724631247)
482  (10,10)           | (10,10)    | (1,0)
483 (20 rows)
485 -- Overflow error
486 SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1[0] > 1000;
487 ERROR:  value out of range: overflow
488 -- Division by 0 error
489 SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1 ~= '(0,0)'::point;
490 ERROR:  division by zero
491 -- Distance to line
492 SELECT p.f1, l.s, p.f1 <-> l.s AS dist_pl, l.s <-> p.f1 AS dist_lp FROM POINT_TBL p, LINE_TBL l;
493         f1         |                   s                   |      dist_pl       |      dist_lp       
494 -------------------+---------------------------------------+--------------------+--------------------
495  (0,0)             | {0,-1,5}                              |                  5 |                  5
496  (0,0)             | {1,0,5}                               |                  5 |                  5
497  (0,0)             | {0,3,0}                               |                  0 |                  0
498  (0,0)             | {1,-1,0}                              |                  0 |                  0
499  (0,0)             | {-0.4,-1,-6}                          |      5.57086014531 |      5.57086014531
500  (0,0)             | {-0.000184615384615,-1,15.3846153846} |      15.3846151224 |      15.3846151224
501  (0,0)             | {3,NaN,5}                             |                NaN |                NaN
502  (0,0)             | {NaN,NaN,NaN}                         |                NaN |                NaN
503  (0,0)             | {0,-1,3}                              |                  3 |                  3
504  (0,0)             | {-1,0,3}                              |                  3 |                  3
505  (-10,0)           | {0,-1,5}                              |                  5 |                  5
506  (-10,0)           | {1,0,5}                               |                  5 |                  5
507  (-10,0)           | {0,3,0}                               |                  0 |                  0
508  (-10,0)           | {1,-1,0}                              |      7.07106781187 |      7.07106781187
509  (-10,0)           | {-0.4,-1,-6}                          |      1.85695338177 |      1.85695338177
510  (-10,0)           | {-0.000184615384615,-1,15.3846153846} |      15.3864612763 |      15.3864612763
511  (-10,0)           | {3,NaN,5}                             |                NaN |                NaN
512  (-10,0)           | {NaN,NaN,NaN}                         |                NaN |                NaN
513  (-10,0)           | {0,-1,3}                              |                  3 |                  3
514  (-10,0)           | {-1,0,3}                              |                 13 |                 13
515  (-3,4)            | {0,-1,5}                              |                  1 |                  1
516  (-3,4)            | {1,0,5}                               |                  2 |                  2
517  (-3,4)            | {0,3,0}                               |                  4 |                  4
518  (-3,4)            | {1,-1,0}                              |      4.94974746831 |      4.94974746831
519  (-3,4)            | {-0.4,-1,-6}                          |      8.17059487979 |      8.17059487979
520  (-3,4)            | {-0.000184615384615,-1,15.3846153846} |      11.3851690368 |      11.3851690368
521  (-3,4)            | {3,NaN,5}                             |                NaN |                NaN
522  (-3,4)            | {NaN,NaN,NaN}                         |                NaN |                NaN
523  (-3,4)            | {0,-1,3}                              |                  1 |                  1
524  (-3,4)            | {-1,0,3}                              |                  6 |                  6
525  (5.1,34.5)        | {0,-1,5}                              |               29.5 |               29.5
526  (5.1,34.5)        | {1,0,5}                               |               10.1 |               10.1
527  (5.1,34.5)        | {0,3,0}                               |               34.5 |               34.5
528  (5.1,34.5)        | {1,-1,0}                              |      20.7889393669 |      20.7889393669
529  (5.1,34.5)        | {-0.4,-1,-6}                          |      39.4973984303 |      39.4973984303
530  (5.1,34.5)        | {-0.000184615384615,-1,15.3846153846} |      19.1163258281 |      19.1163258281
531  (5.1,34.5)        | {3,NaN,5}                             |                NaN |                NaN
532  (5.1,34.5)        | {NaN,NaN,NaN}                         |                NaN |                NaN
533  (5.1,34.5)        | {0,-1,3}                              |               31.5 |               31.5
534  (5.1,34.5)        | {-1,0,3}                              |                2.1 |                2.1
535  (-5,-12)          | {0,-1,5}                              |                 17 |                 17
536  (-5,-12)          | {1,0,5}                               |                  0 |                  0
537  (-5,-12)          | {0,3,0}                               |                 12 |                 12
538  (-5,-12)          | {1,-1,0}                              |      4.94974746831 |      4.94974746831
539  (-5,-12)          | {-0.4,-1,-6}                          |      7.42781352708 |      7.42781352708
540  (-5,-12)          | {-0.000184615384615,-1,15.3846153846} |      27.3855379948 |      27.3855379948
541  (-5,-12)          | {3,NaN,5}                             |                NaN |                NaN
542  (-5,-12)          | {NaN,NaN,NaN}                         |                NaN |                NaN
543  (-5,-12)          | {0,-1,3}                              |                 15 |                 15
544  (-5,-12)          | {-1,0,3}                              |                  8 |                  8
545  (1e-300,-1e-300)  | {0,-1,5}                              |                  5 |                  5
546  (1e-300,-1e-300)  | {1,0,5}                               |                  5 |                  5
547  (1e-300,-1e-300)  | {0,3,0}                               |             1e-300 |             1e-300
548  (1e-300,-1e-300)  | {1,-1,0}                              | 1.41421356237e-300 | 1.41421356237e-300
549  (1e-300,-1e-300)  | {-0.4,-1,-6}                          |      5.57086014531 |      5.57086014531
550  (1e-300,-1e-300)  | {-0.000184615384615,-1,15.3846153846} |      15.3846151224 |      15.3846151224
551  (1e-300,-1e-300)  | {3,NaN,5}                             |                NaN |                NaN
552  (1e-300,-1e-300)  | {NaN,NaN,NaN}                         |                NaN |                NaN
553  (1e-300,-1e-300)  | {0,-1,3}                              |                  3 |                  3
554  (1e-300,-1e-300)  | {-1,0,3}                              |                  3 |                  3
555  (1e+300,Infinity) | {0,-1,5}                              |           Infinity |           Infinity
556  (1e+300,Infinity) | {1,0,5}                               |                NaN |                NaN
557  (1e+300,Infinity) | {0,3,0}                               |           Infinity |           Infinity
558  (1e+300,Infinity) | {1,-1,0}                              |           Infinity |           Infinity
559  (1e+300,Infinity) | {-0.4,-1,-6}                          |           Infinity |           Infinity
560  (1e+300,Infinity) | {-0.000184615384615,-1,15.3846153846} |           Infinity |           Infinity
561  (1e+300,Infinity) | {3,NaN,5}                             |                NaN |                NaN
562  (1e+300,Infinity) | {NaN,NaN,NaN}                         |                NaN |                NaN
563  (1e+300,Infinity) | {0,-1,3}                              |           Infinity |           Infinity
564  (1e+300,Infinity) | {-1,0,3}                              |                NaN |                NaN
565  (Infinity,1e+300) | {0,-1,5}                              |                NaN |                NaN
566  (Infinity,1e+300) | {1,0,5}                               |           Infinity |           Infinity
567  (Infinity,1e+300) | {0,3,0}                               |                NaN |                NaN
568  (Infinity,1e+300) | {1,-1,0}                              |                NaN |                NaN
569  (Infinity,1e+300) | {-0.4,-1,-6}                          |                NaN |                NaN
570  (Infinity,1e+300) | {-0.000184615384615,-1,15.3846153846} |                NaN |                NaN
571  (Infinity,1e+300) | {3,NaN,5}                             |                NaN |                NaN
572  (Infinity,1e+300) | {NaN,NaN,NaN}                         |                NaN |                NaN
573  (Infinity,1e+300) | {0,-1,3}                              |                NaN |                NaN
574  (Infinity,1e+300) | {-1,0,3}                              |           Infinity |           Infinity
575  (NaN,NaN)         | {0,-1,5}                              |                NaN |                NaN
576  (NaN,NaN)         | {1,0,5}                               |                NaN |                NaN
577  (NaN,NaN)         | {0,3,0}                               |                NaN |                NaN
578  (NaN,NaN)         | {1,-1,0}                              |                NaN |                NaN
579  (NaN,NaN)         | {-0.4,-1,-6}                          |                NaN |                NaN
580  (NaN,NaN)         | {-0.000184615384615,-1,15.3846153846} |                NaN |                NaN
581  (NaN,NaN)         | {3,NaN,5}                             |                NaN |                NaN
582  (NaN,NaN)         | {NaN,NaN,NaN}                         |                NaN |                NaN
583  (NaN,NaN)         | {0,-1,3}                              |                NaN |                NaN
584  (NaN,NaN)         | {-1,0,3}                              |                NaN |                NaN
585  (10,10)           | {0,-1,5}                              |                  5 |                  5
586  (10,10)           | {1,0,5}                               |                 15 |                 15
587  (10,10)           | {0,3,0}                               |                 10 |                 10
588  (10,10)           | {1,-1,0}                              |                  0 |                  0
589  (10,10)           | {-0.4,-1,-6}                          |      18.5695338177 |      18.5695338177
590  (10,10)           | {-0.000184615384615,-1,15.3846153846} |      5.38276913903 |      5.38276913903
591  (10,10)           | {3,NaN,5}                             |                NaN |                NaN
592  (10,10)           | {NaN,NaN,NaN}                         |                NaN |                NaN
593  (10,10)           | {0,-1,3}                              |                  7 |                  7
594  (10,10)           | {-1,0,3}                              |                  7 |                  7
595 (100 rows)
597 -- Distance to line segment
598 SELECT p.f1, l.s, p.f1 <-> l.s AS dist_ps, l.s <-> p.f1 AS dist_sp FROM POINT_TBL p, LSEG_TBL l;
599         f1         |               s               |      dist_ps       |      dist_sp       
600 -------------------+-------------------------------+--------------------+--------------------
601  (0,0)             | [(1,2),(3,4)]                 |       2.2360679775 |       2.2360679775
602  (0,0)             | [(0,0),(6,6)]                 |                  0 |                  0
603  (0,0)             | [(10,-10),(-3,-4)]            |      4.88901207039 |      4.88901207039
604  (0,0)             | [(-1000000,200),(300000,-40)] |      15.3846151224 |      15.3846151224
605  (0,0)             | [(11,22),(33,44)]             |      24.5967477525 |      24.5967477525
606  (0,0)             | [(-10,2),(-10,3)]             |      10.1980390272 |      10.1980390272
607  (0,0)             | [(0,-20),(30,-20)]            |                 20 |                 20
608  (0,0)             | [(NaN,1),(NaN,90)]            |                NaN |                NaN
609  (-10,0)           | [(1,2),(3,4)]                 |      11.1803398875 |      11.1803398875
610  (-10,0)           | [(0,0),(6,6)]                 |                 10 |                 10
611  (-10,0)           | [(10,-10),(-3,-4)]            |       8.0622577483 |       8.0622577483
612  (-10,0)           | [(-1000000,200),(300000,-40)] |      15.3864612763 |      15.3864612763
613  (-10,0)           | [(11,22),(33,44)]             |      30.4138126515 |      30.4138126515
614  (-10,0)           | [(-10,2),(-10,3)]             |                  2 |                  2
615  (-10,0)           | [(0,-20),(30,-20)]            |       22.360679775 |       22.360679775
616  (-10,0)           | [(NaN,1),(NaN,90)]            |                NaN |                NaN
617  (-3,4)            | [(1,2),(3,4)]                 |        4.472135955 |        4.472135955
618  (-3,4)            | [(0,0),(6,6)]                 |      4.94974746831 |      4.94974746831
619  (-3,4)            | [(10,-10),(-3,-4)]            |                  8 |                  8
620  (-3,4)            | [(-1000000,200),(300000,-40)] |      11.3851690367 |      11.3851690367
621  (-3,4)            | [(11,22),(33,44)]             |       22.803508502 |       22.803508502
622  (-3,4)            | [(-10,2),(-10,3)]             |      7.07106781187 |      7.07106781187
623  (-3,4)            | [(0,-20),(30,-20)]            |      24.1867732449 |      24.1867732449
624  (-3,4)            | [(NaN,1),(NaN,90)]            |                NaN |                NaN
625  (5.1,34.5)        | [(1,2),(3,4)]                 |      30.5722096028 |      30.5722096028
626  (5.1,34.5)        | [(0,0),(6,6)]                 |      28.5142069853 |      28.5142069853
627  (5.1,34.5)        | [(10,-10),(-3,-4)]            |      39.3428519556 |      39.3428519556
628  (5.1,34.5)        | [(-1000000,200),(300000,-40)] |      19.1163258281 |      19.1163258281
629  (5.1,34.5)        | [(11,22),(33,44)]             |      13.0107647738 |      13.0107647738
630  (5.1,34.5)        | [(-10,2),(-10,3)]             |       34.932220084 |       34.932220084
631  (5.1,34.5)        | [(0,-20),(30,-20)]            |               54.5 |               54.5
632  (5.1,34.5)        | [(NaN,1),(NaN,90)]            |                NaN |                NaN
633  (-5,-12)          | [(1,2),(3,4)]                 |      15.2315462117 |      15.2315462117
634  (-5,-12)          | [(0,0),(6,6)]                 |                 13 |                 13
635  (-5,-12)          | [(10,-10),(-3,-4)]            |      8.10179143093 |      8.10179143093
636  (-5,-12)          | [(-1000000,200),(300000,-40)] |      27.3855379949 |      27.3855379949
637  (-5,-12)          | [(11,22),(33,44)]             |      37.5765884561 |      37.5765884561
638  (-5,-12)          | [(-10,2),(-10,3)]             |      14.8660687473 |      14.8660687473
639  (-5,-12)          | [(0,-20),(30,-20)]            |      9.43398113206 |      9.43398113206
640  (-5,-12)          | [(NaN,1),(NaN,90)]            |                NaN |                NaN
641  (1e-300,-1e-300)  | [(1,2),(3,4)]                 |       2.2360679775 |       2.2360679775
642  (1e-300,-1e-300)  | [(0,0),(6,6)]                 | 1.41421356237e-300 | 1.41421356237e-300
643  (1e-300,-1e-300)  | [(10,-10),(-3,-4)]            |      4.88901207039 |      4.88901207039
644  (1e-300,-1e-300)  | [(-1000000,200),(300000,-40)] |      15.3846151224 |      15.3846151224
645  (1e-300,-1e-300)  | [(11,22),(33,44)]             |      24.5967477525 |      24.5967477525
646  (1e-300,-1e-300)  | [(-10,2),(-10,3)]             |      10.1980390272 |      10.1980390272
647  (1e-300,-1e-300)  | [(0,-20),(30,-20)]            |                 20 |                 20
648  (1e-300,-1e-300)  | [(NaN,1),(NaN,90)]            |                NaN |                NaN
649  (1e+300,Infinity) | [(1,2),(3,4)]                 |           Infinity |           Infinity
650  (1e+300,Infinity) | [(0,0),(6,6)]                 |           Infinity |           Infinity
651  (1e+300,Infinity) | [(10,-10),(-3,-4)]            |           Infinity |           Infinity
652  (1e+300,Infinity) | [(-1000000,200),(300000,-40)] |           Infinity |           Infinity
653  (1e+300,Infinity) | [(11,22),(33,44)]             |           Infinity |           Infinity
654  (1e+300,Infinity) | [(-10,2),(-10,3)]             |           Infinity |           Infinity
655  (1e+300,Infinity) | [(0,-20),(30,-20)]            |           Infinity |           Infinity
656  (1e+300,Infinity) | [(NaN,1),(NaN,90)]            |           Infinity |           Infinity
657  (Infinity,1e+300) | [(1,2),(3,4)]                 |           Infinity |           Infinity
658  (Infinity,1e+300) | [(0,0),(6,6)]                 |           Infinity |           Infinity
659  (Infinity,1e+300) | [(10,-10),(-3,-4)]            |           Infinity |           Infinity
660  (Infinity,1e+300) | [(-1000000,200),(300000,-40)] |           Infinity |           Infinity
661  (Infinity,1e+300) | [(11,22),(33,44)]             |           Infinity |           Infinity
662  (Infinity,1e+300) | [(-10,2),(-10,3)]             |           Infinity |           Infinity
663  (Infinity,1e+300) | [(0,-20),(30,-20)]            |           Infinity |           Infinity
664  (Infinity,1e+300) | [(NaN,1),(NaN,90)]            |                NaN |                NaN
665  (NaN,NaN)         | [(1,2),(3,4)]                 |                NaN |                NaN
666  (NaN,NaN)         | [(0,0),(6,6)]                 |                NaN |                NaN
667  (NaN,NaN)         | [(10,-10),(-3,-4)]            |                NaN |                NaN
668  (NaN,NaN)         | [(-1000000,200),(300000,-40)] |                NaN |                NaN
669  (NaN,NaN)         | [(11,22),(33,44)]             |                NaN |                NaN
670  (NaN,NaN)         | [(-10,2),(-10,3)]             |                NaN |                NaN
671  (NaN,NaN)         | [(0,-20),(30,-20)]            |                NaN |                NaN
672  (NaN,NaN)         | [(NaN,1),(NaN,90)]            |                NaN |                NaN
673  (10,10)           | [(1,2),(3,4)]                 |      9.21954445729 |      9.21954445729
674  (10,10)           | [(0,0),(6,6)]                 |      5.65685424949 |      5.65685424949
675  (10,10)           | [(10,-10),(-3,-4)]            |        18.15918769 |        18.15918769
676  (10,10)           | [(-1000000,200),(300000,-40)] |      5.38276913904 |      5.38276913904
677  (10,10)           | [(11,22),(33,44)]             |      12.0415945788 |      12.0415945788
678  (10,10)           | [(-10,2),(-10,3)]             |      21.1896201004 |      21.1896201004
679  (10,10)           | [(0,-20),(30,-20)]            |                 30 |                 30
680  (10,10)           | [(NaN,1),(NaN,90)]            |                NaN |                NaN
681 (80 rows)
683 -- Distance to box
684 SELECT p.f1, b.f1, p.f1 <-> b.f1 AS dist_pb, b.f1 <-> p.f1 AS dist_bp FROM POINT_TBL p, BOX_TBL b;
685         f1         |         f1          |      dist_pb       |      dist_bp       
686 -------------------+---------------------+--------------------+--------------------
687  (0,0)             | (2,2),(0,0)         |                  0 |                  0
688  (0,0)             | (3,3),(1,1)         |      1.41421356237 |      1.41421356237
689  (0,0)             | (-2,2),(-8,-10)     |                  2 |                  2
690  (0,0)             | (2.5,3.5),(2.5,2.5) |      3.53553390593 |      3.53553390593
691  (0,0)             | (3,3),(3,3)         |      4.24264068712 |      4.24264068712
692  (-10,0)           | (2,2),(0,0)         |                 10 |                 10
693  (-10,0)           | (3,3),(1,1)         |      11.0453610172 |      11.0453610172
694  (-10,0)           | (-2,2),(-8,-10)     |                  2 |                  2
695  (-10,0)           | (2.5,3.5),(2.5,2.5) |       12.747548784 |       12.747548784
696  (-10,0)           | (3,3),(3,3)         |      13.3416640641 |      13.3416640641
697  (-3,4)            | (2,2),(0,0)         |      3.60555127546 |      3.60555127546
698  (-3,4)            | (3,3),(1,1)         |      4.12310562562 |      4.12310562562
699  (-3,4)            | (-2,2),(-8,-10)     |                  2 |                  2
700  (-3,4)            | (2.5,3.5),(2.5,2.5) |      5.52268050859 |      5.52268050859
701  (-3,4)            | (3,3),(3,3)         |       6.0827625303 |       6.0827625303
702  (5.1,34.5)        | (2,2),(0,0)         |      32.6475113906 |      32.6475113906
703  (5.1,34.5)        | (3,3),(1,1)         |      31.5699223946 |      31.5699223946
704  (5.1,34.5)        | (-2,2),(-8,-10)     |      33.2664996656 |      33.2664996656
705  (5.1,34.5)        | (2.5,3.5),(2.5,2.5) |       31.108841187 |       31.108841187
706  (5.1,34.5)        | (3,3),(3,3)         |      31.5699223946 |      31.5699223946
707  (-5,-12)          | (2,2),(0,0)         |                 13 |                 13
708  (-5,-12)          | (3,3),(1,1)         |      14.3178210633 |      14.3178210633
709  (-5,-12)          | (-2,2),(-8,-10)     |                  2 |                  2
710  (-5,-12)          | (2.5,3.5),(2.5,2.5) |      16.3248277173 |      16.3248277173
711  (-5,-12)          | (3,3),(3,3)         |                 17 |                 17
712  (1e-300,-1e-300)  | (2,2),(0,0)         | 1.41421356237e-300 | 1.41421356237e-300
713  (1e-300,-1e-300)  | (3,3),(1,1)         |      1.41421356237 |      1.41421356237
714  (1e-300,-1e-300)  | (-2,2),(-8,-10)     |                  2 |                  2
715  (1e-300,-1e-300)  | (2.5,3.5),(2.5,2.5) |      3.53553390593 |      3.53553390593
716  (1e-300,-1e-300)  | (3,3),(3,3)         |      4.24264068712 |      4.24264068712
717  (1e+300,Infinity) | (2,2),(0,0)         |           Infinity |           Infinity
718  (1e+300,Infinity) | (3,3),(1,1)         |           Infinity |           Infinity
719  (1e+300,Infinity) | (-2,2),(-8,-10)     |           Infinity |           Infinity
720  (1e+300,Infinity) | (2.5,3.5),(2.5,2.5) |           Infinity |           Infinity
721  (1e+300,Infinity) | (3,3),(3,3)         |           Infinity |           Infinity
722  (Infinity,1e+300) | (2,2),(0,0)         |           Infinity |           Infinity
723  (Infinity,1e+300) | (3,3),(1,1)         |           Infinity |           Infinity
724  (Infinity,1e+300) | (-2,2),(-8,-10)     |           Infinity |           Infinity
725  (Infinity,1e+300) | (2.5,3.5),(2.5,2.5) |           Infinity |           Infinity
726  (Infinity,1e+300) | (3,3),(3,3)         |           Infinity |           Infinity
727  (NaN,NaN)         | (2,2),(0,0)         |                NaN |                NaN
728  (NaN,NaN)         | (3,3),(1,1)         |                NaN |                NaN
729  (NaN,NaN)         | (-2,2),(-8,-10)     |                NaN |                NaN
730  (NaN,NaN)         | (2.5,3.5),(2.5,2.5) |                NaN |                NaN
731  (NaN,NaN)         | (3,3),(3,3)         |                NaN |                NaN
732  (10,10)           | (2,2),(0,0)         |       11.313708499 |       11.313708499
733  (10,10)           | (3,3),(1,1)         |      9.89949493661 |      9.89949493661
734  (10,10)           | (-2,2),(-8,-10)     |      14.4222051019 |      14.4222051019
735  (10,10)           | (2.5,3.5),(2.5,2.5) |      9.92471662064 |      9.92471662064
736  (10,10)           | (3,3),(3,3)         |      9.89949493661 |      9.89949493661
737 (50 rows)
739 -- Distance to path
740 SELECT p.f1, p1.f1, p.f1 <-> p1.f1 AS dist_ppath, p1.f1 <-> p.f1 AS dist_pathp FROM POINT_TBL p, PATH_TBL p1;
741         f1         |            f1             |     dist_ppath     |     dist_pathp     
742 -------------------+---------------------------+--------------------+--------------------
743  (0,0)             | [(1,2),(3,4)]             |       2.2360679775 |       2.2360679775
744  (0,0)             | ((1,2),(3,4))             |       2.2360679775 |       2.2360679775
745  (0,0)             | [(0,0),(3,0),(4,5),(1,6)] |                  0 |                  0
746  (0,0)             | ((1,2),(3,4))             |       2.2360679775 |       2.2360679775
747  (0,0)             | ((1,2),(3,4))             |       2.2360679775 |       2.2360679775
748  (0,0)             | [(1,2),(3,4)]             |       2.2360679775 |       2.2360679775
749  (0,0)             | ((10,20))                 |       22.360679775 |       22.360679775
750  (0,0)             | [(11,12),(13,14)]         |      16.2788205961 |      16.2788205961
751  (0,0)             | ((11,12),(13,14))         |      16.2788205961 |      16.2788205961
752  (-10,0)           | [(1,2),(3,4)]             |      11.1803398875 |      11.1803398875
753  (-10,0)           | ((1,2),(3,4))             |      11.1803398875 |      11.1803398875
754  (-10,0)           | [(0,0),(3,0),(4,5),(1,6)] |                 10 |                 10
755  (-10,0)           | ((1,2),(3,4))             |      11.1803398875 |      11.1803398875
756  (-10,0)           | ((1,2),(3,4))             |      11.1803398875 |      11.1803398875
757  (-10,0)           | [(1,2),(3,4)]             |      11.1803398875 |      11.1803398875
758  (-10,0)           | ((10,20))                 |      28.2842712475 |      28.2842712475
759  (-10,0)           | [(11,12),(13,14)]         |      24.1867732449 |      24.1867732449
760  (-10,0)           | ((11,12),(13,14))         |      24.1867732449 |      24.1867732449
761  (-3,4)            | [(1,2),(3,4)]             |        4.472135955 |        4.472135955
762  (-3,4)            | ((1,2),(3,4))             |        4.472135955 |        4.472135955
763  (-3,4)            | [(0,0),(3,0),(4,5),(1,6)] |        4.472135955 |        4.472135955
764  (-3,4)            | ((1,2),(3,4))             |        4.472135955 |        4.472135955
765  (-3,4)            | ((1,2),(3,4))             |        4.472135955 |        4.472135955
766  (-3,4)            | [(1,2),(3,4)]             |        4.472135955 |        4.472135955
767  (-3,4)            | ((10,20))                 |      20.6155281281 |      20.6155281281
768  (-3,4)            | [(11,12),(13,14)]         |      16.1245154966 |      16.1245154966
769  (-3,4)            | ((11,12),(13,14))         |      16.1245154966 |      16.1245154966
770  (5.1,34.5)        | [(1,2),(3,4)]             |      30.5722096028 |      30.5722096028
771  (5.1,34.5)        | ((1,2),(3,4))             |      30.5722096028 |      30.5722096028
772  (5.1,34.5)        | [(0,0),(3,0),(4,5),(1,6)] |       28.793402022 |       28.793402022
773  (5.1,34.5)        | ((1,2),(3,4))             |      30.5722096028 |      30.5722096028
774  (5.1,34.5)        | ((1,2),(3,4))             |      30.5722096028 |      30.5722096028
775  (5.1,34.5)        | [(1,2),(3,4)]             |      30.5722096028 |      30.5722096028
776  (5.1,34.5)        | ((10,20))                 |      15.3055545473 |      15.3055545473
777  (5.1,34.5)        | [(11,12),(13,14)]         |      21.9695243462 |      21.9695243462
778  (5.1,34.5)        | ((11,12),(13,14))         |      21.9695243462 |      21.9695243462
779  (-5,-12)          | [(1,2),(3,4)]             |      15.2315462117 |      15.2315462117
780  (-5,-12)          | ((1,2),(3,4))             |      15.2315462117 |      15.2315462117
781  (-5,-12)          | [(0,0),(3,0),(4,5),(1,6)] |                 13 |                 13
782  (-5,-12)          | ((1,2),(3,4))             |      15.2315462117 |      15.2315462117
783  (-5,-12)          | ((1,2),(3,4))             |      15.2315462117 |      15.2315462117
784  (-5,-12)          | [(1,2),(3,4)]             |      15.2315462117 |      15.2315462117
785  (-5,-12)          | ((10,20))                 |      35.3411940941 |      35.3411940941
786  (-5,-12)          | [(11,12),(13,14)]         |      28.8444102037 |      28.8444102037
787  (-5,-12)          | ((11,12),(13,14))         |      28.8444102037 |      28.8444102037
788  (1e-300,-1e-300)  | [(1,2),(3,4)]             |       2.2360679775 |       2.2360679775
789  (1e-300,-1e-300)  | ((1,2),(3,4))             |       2.2360679775 |       2.2360679775
790  (1e-300,-1e-300)  | [(0,0),(3,0),(4,5),(1,6)] | 1.41421356237e-300 | 1.41421356237e-300
791  (1e-300,-1e-300)  | ((1,2),(3,4))             |       2.2360679775 |       2.2360679775
792  (1e-300,-1e-300)  | ((1,2),(3,4))             |       2.2360679775 |       2.2360679775
793  (1e-300,-1e-300)  | [(1,2),(3,4)]             |       2.2360679775 |       2.2360679775
794  (1e-300,-1e-300)  | ((10,20))                 |       22.360679775 |       22.360679775
795  (1e-300,-1e-300)  | [(11,12),(13,14)]         |      16.2788205961 |      16.2788205961
796  (1e-300,-1e-300)  | ((11,12),(13,14))         |      16.2788205961 |      16.2788205961
797  (1e+300,Infinity) | [(1,2),(3,4)]             |           Infinity |           Infinity
798  (1e+300,Infinity) | ((1,2),(3,4))             |           Infinity |           Infinity
799  (1e+300,Infinity) | [(0,0),(3,0),(4,5),(1,6)] |           Infinity |           Infinity
800  (1e+300,Infinity) | ((1,2),(3,4))             |           Infinity |           Infinity
801  (1e+300,Infinity) | ((1,2),(3,4))             |           Infinity |           Infinity
802  (1e+300,Infinity) | [(1,2),(3,4)]             |           Infinity |           Infinity
803  (1e+300,Infinity) | ((10,20))                 |           Infinity |           Infinity
804  (1e+300,Infinity) | [(11,12),(13,14)]         |           Infinity |           Infinity
805  (1e+300,Infinity) | ((11,12),(13,14))         |           Infinity |           Infinity
806  (Infinity,1e+300) | [(1,2),(3,4)]             |           Infinity |           Infinity
807  (Infinity,1e+300) | ((1,2),(3,4))             |           Infinity |           Infinity
808  (Infinity,1e+300) | [(0,0),(3,0),(4,5),(1,6)] |           Infinity |           Infinity
809  (Infinity,1e+300) | ((1,2),(3,4))             |           Infinity |           Infinity
810  (Infinity,1e+300) | ((1,2),(3,4))             |           Infinity |           Infinity
811  (Infinity,1e+300) | [(1,2),(3,4)]             |           Infinity |           Infinity
812  (Infinity,1e+300) | ((10,20))                 |           Infinity |           Infinity
813  (Infinity,1e+300) | [(11,12),(13,14)]         |           Infinity |           Infinity
814  (Infinity,1e+300) | ((11,12),(13,14))         |           Infinity |           Infinity
815  (NaN,NaN)         | [(1,2),(3,4)]             |                NaN |                NaN
816  (NaN,NaN)         | ((1,2),(3,4))             |                NaN |                NaN
817  (NaN,NaN)         | [(0,0),(3,0),(4,5),(1,6)] |                NaN |                NaN
818  (NaN,NaN)         | ((1,2),(3,4))             |                NaN |                NaN
819  (NaN,NaN)         | ((1,2),(3,4))             |                NaN |                NaN
820  (NaN,NaN)         | [(1,2),(3,4)]             |                NaN |                NaN
821  (NaN,NaN)         | ((10,20))                 |                NaN |                NaN
822  (NaN,NaN)         | [(11,12),(13,14)]         |                NaN |                NaN
823  (NaN,NaN)         | ((11,12),(13,14))         |                NaN |                NaN
824  (10,10)           | [(1,2),(3,4)]             |      9.21954445729 |      9.21954445729
825  (10,10)           | ((1,2),(3,4))             |      9.21954445729 |      9.21954445729
826  (10,10)           | [(0,0),(3,0),(4,5),(1,6)] |      7.81024967591 |      7.81024967591
827  (10,10)           | ((1,2),(3,4))             |      9.21954445729 |      9.21954445729
828  (10,10)           | ((1,2),(3,4))             |      9.21954445729 |      9.21954445729
829  (10,10)           | [(1,2),(3,4)]             |      9.21954445729 |      9.21954445729
830  (10,10)           | ((10,20))                 |                 10 |                 10
831  (10,10)           | [(11,12),(13,14)]         |       2.2360679775 |       2.2360679775
832  (10,10)           | ((11,12),(13,14))         |       2.2360679775 |       2.2360679775
833 (90 rows)
835 -- Distance to polygon
836 SELECT p.f1, p1.f1, p.f1 <-> p1.f1 AS dist_ppoly, p1.f1 <-> p.f1 AS dist_polyp FROM POINT_TBL p, POLYGON_TBL p1;
837         f1         |             f1             |  dist_ppoly   |  dist_polyp   
838 -------------------+----------------------------+---------------+---------------
839  (0,0)             | ((2,0),(2,4),(0,0))        |             0 |             0
840  (0,0)             | ((3,1),(3,3),(1,0))        |             1 |             1
841  (0,0)             | ((1,2),(3,4),(5,6),(7,8))  |  2.2360679775 |  2.2360679775
842  (0,0)             | ((7,8),(5,6),(3,4),(1,2))  |  2.2360679775 |  2.2360679775
843  (0,0)             | ((1,2),(7,8),(5,6),(3,-4)) | 1.58113883008 | 1.58113883008
844  (0,0)             | ((0,0))                    |             0 |             0
845  (0,0)             | ((0,1),(0,1))              |             1 |             1
846  (-10,0)           | ((2,0),(2,4),(0,0))        |            10 |            10
847  (-10,0)           | ((3,1),(3,3),(1,0))        |            11 |            11
848  (-10,0)           | ((1,2),(3,4),(5,6),(7,8))  | 11.1803398875 | 11.1803398875
849  (-10,0)           | ((7,8),(5,6),(3,4),(1,2))  | 11.1803398875 | 11.1803398875
850  (-10,0)           | ((1,2),(7,8),(5,6),(3,-4)) | 11.1803398875 | 11.1803398875
851  (-10,0)           | ((0,0))                    |            10 |            10
852  (-10,0)           | ((0,1),(0,1))              | 10.0498756211 | 10.0498756211
853  (-3,4)            | ((2,0),(2,4),(0,0))        |   4.472135955 |   4.472135955
854  (-3,4)            | ((3,1),(3,3),(1,0))        | 5.54700196225 | 5.54700196225
855  (-3,4)            | ((1,2),(3,4),(5,6),(7,8))  |   4.472135955 |   4.472135955
856  (-3,4)            | ((7,8),(5,6),(3,4),(1,2))  |   4.472135955 |   4.472135955
857  (-3,4)            | ((1,2),(7,8),(5,6),(3,-4)) |   4.472135955 |   4.472135955
858  (-3,4)            | ((0,0))                    |             5 |             5
859  (-3,4)            | ((0,1),(0,1))              | 4.24264068712 | 4.24264068712
860  (5.1,34.5)        | ((2,0),(2,4),(0,0))        | 30.6571362002 | 30.6571362002
861  (5.1,34.5)        | ((3,1),(3,3),(1,0))        | 31.5699223946 | 31.5699223946
862  (5.1,34.5)        | ((1,2),(3,4),(5,6),(7,8))  | 26.5680258958 | 26.5680258958
863  (5.1,34.5)        | ((7,8),(5,6),(3,4),(1,2))  | 26.5680258958 | 26.5680258958
864  (5.1,34.5)        | ((1,2),(7,8),(5,6),(3,-4)) | 26.5680258958 | 26.5680258958
865  (5.1,34.5)        | ((0,0))                    | 34.8749193547 | 34.8749193547
866  (5.1,34.5)        | ((0,1),(0,1))              | 33.8859853037 | 33.8859853037
867  (-5,-12)          | ((2,0),(2,4),(0,0))        |            13 |            13
868  (-5,-12)          | ((3,1),(3,3),(1,0))        |  13.416407865 |  13.416407865
869  (-5,-12)          | ((1,2),(3,4),(5,6),(7,8))  | 15.2315462117 | 15.2315462117
870  (-5,-12)          | ((7,8),(5,6),(3,4),(1,2))  | 15.2315462117 | 15.2315462117
871  (-5,-12)          | ((1,2),(7,8),(5,6),(3,-4)) |  11.313708499 |  11.313708499
872  (-5,-12)          | ((0,0))                    |            13 |            13
873  (-5,-12)          | ((0,1),(0,1))              | 13.9283882772 | 13.9283882772
874  (1e-300,-1e-300)  | ((2,0),(2,4),(0,0))        |             0 |             0
875  (1e-300,-1e-300)  | ((3,1),(3,3),(1,0))        |             1 |             1
876  (1e-300,-1e-300)  | ((1,2),(3,4),(5,6),(7,8))  |  2.2360679775 |  2.2360679775
877  (1e-300,-1e-300)  | ((7,8),(5,6),(3,4),(1,2))  |  2.2360679775 |  2.2360679775
878  (1e-300,-1e-300)  | ((1,2),(7,8),(5,6),(3,-4)) | 1.58113883008 | 1.58113883008
879  (1e-300,-1e-300)  | ((0,0))                    |             0 |             0
880  (1e-300,-1e-300)  | ((0,1),(0,1))              |             1 |             1
881  (1e+300,Infinity) | ((2,0),(2,4),(0,0))        |      Infinity |      Infinity
882  (1e+300,Infinity) | ((3,1),(3,3),(1,0))        |      Infinity |      Infinity
883  (1e+300,Infinity) | ((1,2),(3,4),(5,6),(7,8))  |      Infinity |      Infinity
884  (1e+300,Infinity) | ((7,8),(5,6),(3,4),(1,2))  |      Infinity |      Infinity
885  (1e+300,Infinity) | ((1,2),(7,8),(5,6),(3,-4)) |      Infinity |      Infinity
886  (1e+300,Infinity) | ((0,0))                    |      Infinity |      Infinity
887  (1e+300,Infinity) | ((0,1),(0,1))              |      Infinity |      Infinity
888  (Infinity,1e+300) | ((2,0),(2,4),(0,0))        |      Infinity |      Infinity
889  (Infinity,1e+300) | ((3,1),(3,3),(1,0))        |      Infinity |      Infinity
890  (Infinity,1e+300) | ((1,2),(3,4),(5,6),(7,8))  |      Infinity |      Infinity
891  (Infinity,1e+300) | ((7,8),(5,6),(3,4),(1,2))  |      Infinity |      Infinity
892  (Infinity,1e+300) | ((1,2),(7,8),(5,6),(3,-4)) |      Infinity |      Infinity
893  (Infinity,1e+300) | ((0,0))                    |      Infinity |      Infinity
894  (Infinity,1e+300) | ((0,1),(0,1))              |      Infinity |      Infinity
895  (NaN,NaN)         | ((2,0),(2,4),(0,0))        |             0 |             0
896  (NaN,NaN)         | ((3,1),(3,3),(1,0))        |             0 |             0
897  (NaN,NaN)         | ((1,2),(3,4),(5,6),(7,8))  |             0 |             0
898  (NaN,NaN)         | ((7,8),(5,6),(3,4),(1,2))  |             0 |             0
899  (NaN,NaN)         | ((1,2),(7,8),(5,6),(3,-4)) |             0 |             0
900  (NaN,NaN)         | ((0,0))                    |             0 |             0
901  (NaN,NaN)         | ((0,1),(0,1))              |             0 |             0
902  (10,10)           | ((2,0),(2,4),(0,0))        |            10 |            10
903  (10,10)           | ((3,1),(3,3),(1,0))        | 9.89949493661 | 9.89949493661
904  (10,10)           | ((1,2),(3,4),(5,6),(7,8))  | 3.60555127546 | 3.60555127546
905  (10,10)           | ((7,8),(5,6),(3,4),(1,2))  | 3.60555127546 | 3.60555127546
906  (10,10)           | ((1,2),(7,8),(5,6),(3,-4)) | 3.60555127546 | 3.60555127546
907  (10,10)           | ((0,0))                    | 14.1421356237 | 14.1421356237
908  (10,10)           | ((0,1),(0,1))              | 13.4536240471 | 13.4536240471
909 (70 rows)
911 -- Construct line through two points
912 SELECT p1.f1, p2.f1, line(p1.f1, p2.f1)
913   FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1 <> p2.f1;
914         f1         |        f1         |                  line                  
915 -------------------+-------------------+----------------------------------------
916  (0,0)             | (-10,0)           | {0,-1,0}
917  (0,0)             | (-3,4)            | {-1.33333333333,-1,0}
918  (0,0)             | (5.1,34.5)        | {6.76470588235,-1,0}
919  (0,0)             | (-5,-12)          | {2.4,-1,0}
920  (0,0)             | (1e+300,Infinity) | {-1,0,0}
921  (0,0)             | (Infinity,1e+300) | {0,-1,0}
922  (0,0)             | (NaN,NaN)         | {NaN,-1,NaN}
923  (0,0)             | (10,10)           | {1,-1,0}
924  (-10,0)           | (0,0)             | {0,-1,0}
925  (-10,0)           | (-3,4)            | {0.571428571429,-1,5.71428571429}
926  (-10,0)           | (5.1,34.5)        | {2.28476821192,-1,22.8476821192}
927  (-10,0)           | (-5,-12)          | {-2.4,-1,-24}
928  (-10,0)           | (1e-300,-1e-300)  | {0,-1,0}
929  (-10,0)           | (1e+300,Infinity) | {-1,0,-10}
930  (-10,0)           | (Infinity,1e+300) | {0,-1,0}
931  (-10,0)           | (NaN,NaN)         | {NaN,-1,NaN}
932  (-10,0)           | (10,10)           | {0.5,-1,5}
933  (-3,4)            | (0,0)             | {-1.33333333333,-1,0}
934  (-3,4)            | (-10,0)           | {0.571428571429,-1,5.71428571429}
935  (-3,4)            | (5.1,34.5)        | {3.76543209877,-1,15.2962962963}
936  (-3,4)            | (-5,-12)          | {8,-1,28}
937  (-3,4)            | (1e-300,-1e-300)  | {-1.33333333333,-1,0}
938  (-3,4)            | (1e+300,Infinity) | {-1,0,-3}
939  (-3,4)            | (Infinity,1e+300) | {0,-1,4}
940  (-3,4)            | (NaN,NaN)         | {NaN,-1,NaN}
941  (-3,4)            | (10,10)           | {0.461538461538,-1,5.38461538462}
942  (5.1,34.5)        | (0,0)             | {6.76470588235,-1,0}
943  (5.1,34.5)        | (-10,0)           | {2.28476821192,-1,22.8476821192}
944  (5.1,34.5)        | (-3,4)            | {3.76543209877,-1,15.2962962963}
945  (5.1,34.5)        | (-5,-12)          | {4.60396039604,-1,11.0198019802}
946  (5.1,34.5)        | (1e-300,-1e-300)  | {6.76470588235,-1,0}
947  (5.1,34.5)        | (1e+300,Infinity) | {-1,0,5.1}
948  (5.1,34.5)        | (Infinity,1e+300) | {0,-1,34.5}
949  (5.1,34.5)        | (NaN,NaN)         | {NaN,-1,NaN}
950  (5.1,34.5)        | (10,10)           | {-5,-1,60}
951  (-5,-12)          | (0,0)             | {2.4,-1,0}
952  (-5,-12)          | (-10,0)           | {-2.4,-1,-24}
953  (-5,-12)          | (-3,4)            | {8,-1,28}
954  (-5,-12)          | (5.1,34.5)        | {4.60396039604,-1,11.0198019802}
955  (-5,-12)          | (1e-300,-1e-300)  | {2.4,-1,0}
956  (-5,-12)          | (1e+300,Infinity) | {-1,0,-5}
957  (-5,-12)          | (Infinity,1e+300) | {0,-1,-12}
958  (-5,-12)          | (NaN,NaN)         | {NaN,-1,NaN}
959  (-5,-12)          | (10,10)           | {1.46666666667,-1,-4.66666666667}
960  (1e-300,-1e-300)  | (-10,0)           | {0,-1,-1e-300}
961  (1e-300,-1e-300)  | (-3,4)            | {-1.33333333333,-1,3.33333333333e-301}
962  (1e-300,-1e-300)  | (5.1,34.5)        | {6.76470588235,-1,-7.76470588235e-300}
963  (1e-300,-1e-300)  | (-5,-12)          | {2.4,-1,-3.4e-300}
964  (1e-300,-1e-300)  | (1e+300,Infinity) | {-1,0,1e-300}
965  (1e-300,-1e-300)  | (Infinity,1e+300) | {0,-1,-1e-300}
966  (1e-300,-1e-300)  | (NaN,NaN)         | {NaN,-1,NaN}
967  (1e-300,-1e-300)  | (10,10)           | {1,-1,-2e-300}
968  (1e+300,Infinity) | (0,0)             | {-1,0,1e+300}
969  (1e+300,Infinity) | (-10,0)           | {-1,0,1e+300}
970  (1e+300,Infinity) | (-3,4)            | {-1,0,1e+300}
971  (1e+300,Infinity) | (5.1,34.5)        | {-1,0,1e+300}
972  (1e+300,Infinity) | (-5,-12)          | {-1,0,1e+300}
973  (1e+300,Infinity) | (1e-300,-1e-300)  | {-1,0,1e+300}
974  (1e+300,Infinity) | (Infinity,1e+300) | {NaN,-1,NaN}
975  (1e+300,Infinity) | (NaN,NaN)         | {NaN,-1,NaN}
976  (1e+300,Infinity) | (10,10)           | {-1,0,1e+300}
977  (Infinity,1e+300) | (0,0)             | {0,-1,1e+300}
978  (Infinity,1e+300) | (-10,0)           | {0,-1,1e+300}
979  (Infinity,1e+300) | (-3,4)            | {0,-1,1e+300}
980  (Infinity,1e+300) | (5.1,34.5)        | {0,-1,1e+300}
981  (Infinity,1e+300) | (-5,-12)          | {0,-1,1e+300}
982  (Infinity,1e+300) | (1e-300,-1e-300)  | {0,-1,1e+300}
983  (Infinity,1e+300) | (1e+300,Infinity) | {NaN,-1,NaN}
984  (Infinity,1e+300) | (NaN,NaN)         | {NaN,-1,NaN}
985  (Infinity,1e+300) | (10,10)           | {0,-1,1e+300}
986  (NaN,NaN)         | (0,0)             | {NaN,-1,NaN}
987  (NaN,NaN)         | (-10,0)           | {NaN,-1,NaN}
988  (NaN,NaN)         | (-3,4)            | {NaN,-1,NaN}
989  (NaN,NaN)         | (5.1,34.5)        | {NaN,-1,NaN}
990  (NaN,NaN)         | (-5,-12)          | {NaN,-1,NaN}
991  (NaN,NaN)         | (1e-300,-1e-300)  | {NaN,-1,NaN}
992  (NaN,NaN)         | (1e+300,Infinity) | {NaN,-1,NaN}
993  (NaN,NaN)         | (Infinity,1e+300) | {NaN,-1,NaN}
994  (NaN,NaN)         | (10,10)           | {NaN,-1,NaN}
995  (10,10)           | (0,0)             | {1,-1,0}
996  (10,10)           | (-10,0)           | {0.5,-1,5}
997  (10,10)           | (-3,4)            | {0.461538461538,-1,5.38461538462}
998  (10,10)           | (5.1,34.5)        | {-5,-1,60}
999  (10,10)           | (-5,-12)          | {1.46666666667,-1,-4.66666666667}
1000  (10,10)           | (1e-300,-1e-300)  | {1,-1,0}
1001  (10,10)           | (1e+300,Infinity) | {-1,0,10}
1002  (10,10)           | (Infinity,1e+300) | {0,-1,10}
1003  (10,10)           | (NaN,NaN)         | {NaN,-1,NaN}
1004 (88 rows)
1006 -- Closest point to line
1007 SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LINE_TBL l;
1008         f1         |                   s                   |             ?column?             
1009 -------------------+---------------------------------------+----------------------------------
1010  (0,0)             | {0,-1,5}                              | (0,5)
1011  (0,0)             | {1,0,5}                               | (-5,0)
1012  (0,0)             | {0,3,0}                               | (0,0)
1013  (0,0)             | {1,-1,0}                              | (0,0)
1014  (0,0)             | {-0.4,-1,-6}                          | (-2.06896551724,-5.1724137931)
1015  (0,0)             | {-0.000184615384615,-1,15.3846153846} | (0.00284023658959,15.3846148603)
1016  (0,0)             | {3,NaN,5}                             | 
1017  (0,0)             | {NaN,NaN,NaN}                         | 
1018  (0,0)             | {0,-1,3}                              | (0,3)
1019  (0,0)             | {-1,0,3}                              | (3,0)
1020  (-10,0)           | {0,-1,5}                              | (-10,5)
1021  (-10,0)           | {1,0,5}                               | (-5,0)
1022  (-10,0)           | {0,3,0}                               | (-10,0)
1023  (-10,0)           | {1,-1,0}                              | (-5,-5)
1024  (-10,0)           | {-0.4,-1,-6}                          | (-10.6896551724,-1.72413793103)
1025  (-10,0)           | {-0.000184615384615,-1,15.3846153846} | (-9.99715942258,15.386461014)
1026  (-10,0)           | {3,NaN,5}                             | 
1027  (-10,0)           | {NaN,NaN,NaN}                         | 
1028  (-10,0)           | {0,-1,3}                              | (-10,3)
1029  (-10,0)           | {-1,0,3}                              | (3,0)
1030  (-3,4)            | {0,-1,5}                              | (-3,5)
1031  (-3,4)            | {1,0,5}                               | (-5,4)
1032  (-3,4)            | {0,3,0}                               | (-3,0)
1033  (-3,4)            | {1,-1,0}                              | (0.5,0.5)
1034  (-3,4)            | {-0.4,-1,-6}                          | (-6.03448275862,-3.58620689655)
1035  (-3,4)            | {-0.000184615384615,-1,15.3846153846} | (-2.99789812268,15.3851688427)
1036  (-3,4)            | {3,NaN,5}                             | 
1037  (-3,4)            | {NaN,NaN,NaN}                         | 
1038  (-3,4)            | {0,-1,3}                              | (-3,3)
1039  (-3,4)            | {-1,0,3}                              | (3,4)
1040  (5.1,34.5)        | {0,-1,5}                              | (5.1,5)
1041  (5.1,34.5)        | {1,0,5}                               | (-5,34.5)
1042  (5.1,34.5)        | {0,3,0}                               | (5.1,0)
1043  (5.1,34.5)        | {1,-1,0}                              | (19.8,19.8)
1044  (5.1,34.5)        | {-0.4,-1,-6}                          | (-9.56896551724,-2.1724137931)
1045  (5.1,34.5)        | {-0.000184615384615,-1,15.3846153846} | (5.09647083221,15.3836744977)
1046  (5.1,34.5)        | {3,NaN,5}                             | 
1047  (5.1,34.5)        | {NaN,NaN,NaN}                         | 
1048  (5.1,34.5)        | {0,-1,3}                              | (5.1,3)
1049  (5.1,34.5)        | {-1,0,3}                              | (3,34.5)
1050  (-5,-12)          | {0,-1,5}                              | (-5,5)
1051  (-5,-12)          | {1,0,5}                               | (-5,-12)
1052  (-5,-12)          | {0,3,0}                               | (-5,0)
1053  (-5,-12)          | {1,-1,0}                              | (-8.5,-8.5)
1054  (-5,-12)          | {-0.4,-1,-6}                          | (-2.24137931034,-5.10344827586)
1055  (-5,-12)          | {-0.000184615384615,-1,15.3846153846} | (-4.99494420846,15.3855375282)
1056  (-5,-12)          | {3,NaN,5}                             | 
1057  (-5,-12)          | {NaN,NaN,NaN}                         | 
1058  (-5,-12)          | {0,-1,3}                              | (-5,3)
1059  (-5,-12)          | {-1,0,3}                              | (3,-12)
1060  (1e-300,-1e-300)  | {0,-1,5}                              | (1e-300,5)
1061  (1e-300,-1e-300)  | {1,0,5}                               | (-5,-1e-300)
1062  (1e-300,-1e-300)  | {0,3,0}                               | (1e-300,0)
1063  (1e-300,-1e-300)  | {1,-1,0}                              | (0,0)
1064  (1e-300,-1e-300)  | {-0.4,-1,-6}                          | (-2.06896551724,-5.1724137931)
1065  (1e-300,-1e-300)  | {-0.000184615384615,-1,15.3846153846} | (0.00284023658959,15.3846148603)
1066  (1e-300,-1e-300)  | {3,NaN,5}                             | 
1067  (1e-300,-1e-300)  | {NaN,NaN,NaN}                         | 
1068  (1e-300,-1e-300)  | {0,-1,3}                              | (1e-300,3)
1069  (1e-300,-1e-300)  | {-1,0,3}                              | (3,-1e-300)
1070  (1e+300,Infinity) | {0,-1,5}                              | (1e+300,5)
1071  (1e+300,Infinity) | {1,0,5}                               | 
1072  (1e+300,Infinity) | {0,3,0}                               | (1e+300,0)
1073  (1e+300,Infinity) | {1,-1,0}                              | (Infinity,NaN)
1074  (1e+300,Infinity) | {-0.4,-1,-6}                          | (-Infinity,NaN)
1075  (1e+300,Infinity) | {-0.000184615384615,-1,15.3846153846} | (-Infinity,NaN)
1076  (1e+300,Infinity) | {3,NaN,5}                             | 
1077  (1e+300,Infinity) | {NaN,NaN,NaN}                         | 
1078  (1e+300,Infinity) | {0,-1,3}                              | (1e+300,3)
1079  (1e+300,Infinity) | {-1,0,3}                              | 
1080  (Infinity,1e+300) | {0,-1,5}                              | 
1081  (Infinity,1e+300) | {1,0,5}                               | (-5,1e+300)
1082  (Infinity,1e+300) | {0,3,0}                               | 
1083  (Infinity,1e+300) | {1,-1,0}                              | 
1084  (Infinity,1e+300) | {-0.4,-1,-6}                          | 
1085  (Infinity,1e+300) | {-0.000184615384615,-1,15.3846153846} | 
1086  (Infinity,1e+300) | {3,NaN,5}                             | 
1087  (Infinity,1e+300) | {NaN,NaN,NaN}                         | 
1088  (Infinity,1e+300) | {0,-1,3}                              | 
1089  (Infinity,1e+300) | {-1,0,3}                              | (3,1e+300)
1090  (NaN,NaN)         | {0,-1,5}                              | 
1091  (NaN,NaN)         | {1,0,5}                               | 
1092  (NaN,NaN)         | {0,3,0}                               | 
1093  (NaN,NaN)         | {1,-1,0}                              | 
1094  (NaN,NaN)         | {-0.4,-1,-6}                          | 
1095  (NaN,NaN)         | {-0.000184615384615,-1,15.3846153846} | 
1096  (NaN,NaN)         | {3,NaN,5}                             | 
1097  (NaN,NaN)         | {NaN,NaN,NaN}                         | 
1098  (NaN,NaN)         | {0,-1,3}                              | 
1099  (NaN,NaN)         | {-1,0,3}                              | 
1100  (10,10)           | {0,-1,5}                              | (10,5)
1101  (10,10)           | {1,0,5}                               | (-5,10)
1102  (10,10)           | {0,3,0}                               | (10,0)
1103  (10,10)           | {1,-1,0}                              | (10,10)
1104  (10,10)           | {-0.4,-1,-6}                          | (3.10344827586,-7.24137931034)
1105  (10,10)           | {-0.000184615384615,-1,15.3846153846} | (10.000993742,15.3827690473)
1106  (10,10)           | {3,NaN,5}                             | 
1107  (10,10)           | {NaN,NaN,NaN}                         | 
1108  (10,10)           | {0,-1,3}                              | (10,3)
1109  (10,10)           | {-1,0,3}                              | (3,10)
1110 (100 rows)
1112 -- Closest point to line segment
1113 SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LSEG_TBL l;
1114         f1         |               s               |             ?column?             
1115 -------------------+-------------------------------+----------------------------------
1116  (0,0)             | [(1,2),(3,4)]                 | (1,2)
1117  (0,0)             | [(0,0),(6,6)]                 | (0,0)
1118  (0,0)             | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
1119  (0,0)             | [(-1000000,200),(300000,-40)] | (0.00284023658959,15.3846148603)
1120  (0,0)             | [(11,22),(33,44)]             | (11,22)
1121  (0,0)             | [(-10,2),(-10,3)]             | (-10,2)
1122  (0,0)             | [(0,-20),(30,-20)]            | (0,-20)
1123  (0,0)             | [(NaN,1),(NaN,90)]            | 
1124  (-10,0)           | [(1,2),(3,4)]                 | (1,2)
1125  (-10,0)           | [(0,0),(6,6)]                 | (0,0)
1126  (-10,0)           | [(10,-10),(-3,-4)]            | (-3,-4)
1127  (-10,0)           | [(-1000000,200),(300000,-40)] | (-9.99715942258,15.386461014)
1128  (-10,0)           | [(11,22),(33,44)]             | (11,22)
1129  (-10,0)           | [(-10,2),(-10,3)]             | (-10,2)
1130  (-10,0)           | [(0,-20),(30,-20)]            | (0,-20)
1131  (-10,0)           | [(NaN,1),(NaN,90)]            | 
1132  (-3,4)            | [(1,2),(3,4)]                 | (1,2)
1133  (-3,4)            | [(0,0),(6,6)]                 | (0.5,0.5)
1134  (-3,4)            | [(10,-10),(-3,-4)]            | (-3,-4)
1135  (-3,4)            | [(-1000000,200),(300000,-40)] | (-2.99789812268,15.3851688427)
1136  (-3,4)            | [(11,22),(33,44)]             | (11,22)
1137  (-3,4)            | [(-10,2),(-10,3)]             | (-10,3)
1138  (-3,4)            | [(0,-20),(30,-20)]            | (0,-20)
1139  (-3,4)            | [(NaN,1),(NaN,90)]            | 
1140  (5.1,34.5)        | [(1,2),(3,4)]                 | (3,4)
1141  (5.1,34.5)        | [(0,0),(6,6)]                 | (6,6)
1142  (5.1,34.5)        | [(10,-10),(-3,-4)]            | (-3,-4)
1143  (5.1,34.5)        | [(-1000000,200),(300000,-40)] | (5.09647083221,15.3836744977)
1144  (5.1,34.5)        | [(11,22),(33,44)]             | (14.3,25.3)
1145  (5.1,34.5)        | [(-10,2),(-10,3)]             | (-10,3)
1146  (5.1,34.5)        | [(0,-20),(30,-20)]            | (5.1,-20)
1147  (5.1,34.5)        | [(NaN,1),(NaN,90)]            | 
1148  (-5,-12)          | [(1,2),(3,4)]                 | (1,2)
1149  (-5,-12)          | [(0,0),(6,6)]                 | (0,0)
1150  (-5,-12)          | [(10,-10),(-3,-4)]            | (-1.60487804878,-4.64390243902)
1151  (-5,-12)          | [(-1000000,200),(300000,-40)] | (-4.99494420846,15.3855375282)
1152  (-5,-12)          | [(11,22),(33,44)]             | (11,22)
1153  (-5,-12)          | [(-10,2),(-10,3)]             | (-10,2)
1154  (-5,-12)          | [(0,-20),(30,-20)]            | (0,-20)
1155  (-5,-12)          | [(NaN,1),(NaN,90)]            | 
1156  (1e-300,-1e-300)  | [(1,2),(3,4)]                 | (1,2)
1157  (1e-300,-1e-300)  | [(0,0),(6,6)]                 | (0,0)
1158  (1e-300,-1e-300)  | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
1159  (1e-300,-1e-300)  | [(-1000000,200),(300000,-40)] | (0.00284023658959,15.3846148603)
1160  (1e-300,-1e-300)  | [(11,22),(33,44)]             | (11,22)
1161  (1e-300,-1e-300)  | [(-10,2),(-10,3)]             | (-10,2)
1162  (1e-300,-1e-300)  | [(0,-20),(30,-20)]            | (0,-20)
1163  (1e-300,-1e-300)  | [(NaN,1),(NaN,90)]            | 
1164  (1e+300,Infinity) | [(1,2),(3,4)]                 | (3,4)
1165  (1e+300,Infinity) | [(0,0),(6,6)]                 | (6,6)
1166  (1e+300,Infinity) | [(10,-10),(-3,-4)]            | (-3,-4)
1167  (1e+300,Infinity) | [(-1000000,200),(300000,-40)] | (300000,-40)
1168  (1e+300,Infinity) | [(11,22),(33,44)]             | (33,44)
1169  (1e+300,Infinity) | [(-10,2),(-10,3)]             | (-10,3)
1170  (1e+300,Infinity) | [(0,-20),(30,-20)]            | (30,-20)
1171  (1e+300,Infinity) | [(NaN,1),(NaN,90)]            | (NaN,90)
1172  (Infinity,1e+300) | [(1,2),(3,4)]                 | (3,4)
1173  (Infinity,1e+300) | [(0,0),(6,6)]                 | (6,6)
1174  (Infinity,1e+300) | [(10,-10),(-3,-4)]            | (-3,-4)
1175  (Infinity,1e+300) | [(-1000000,200),(300000,-40)] | (300000,-40)
1176  (Infinity,1e+300) | [(11,22),(33,44)]             | (33,44)
1177  (Infinity,1e+300) | [(-10,2),(-10,3)]             | (-10,3)
1178  (Infinity,1e+300) | [(0,-20),(30,-20)]            | (30,-20)
1179  (Infinity,1e+300) | [(NaN,1),(NaN,90)]            | 
1180  (NaN,NaN)         | [(1,2),(3,4)]                 | 
1181  (NaN,NaN)         | [(0,0),(6,6)]                 | 
1182  (NaN,NaN)         | [(10,-10),(-3,-4)]            | 
1183  (NaN,NaN)         | [(-1000000,200),(300000,-40)] | 
1184  (NaN,NaN)         | [(11,22),(33,44)]             | 
1185  (NaN,NaN)         | [(-10,2),(-10,3)]             | 
1186  (NaN,NaN)         | [(0,-20),(30,-20)]            | 
1187  (NaN,NaN)         | [(NaN,1),(NaN,90)]            | 
1188  (10,10)           | [(1,2),(3,4)]                 | (3,4)
1189  (10,10)           | [(0,0),(6,6)]                 | (6,6)
1190  (10,10)           | [(10,-10),(-3,-4)]            | (2.39024390244,-6.48780487805)
1191  (10,10)           | [(-1000000,200),(300000,-40)] | (10.000993742,15.3827690473)
1192  (10,10)           | [(11,22),(33,44)]             | (11,22)
1193  (10,10)           | [(-10,2),(-10,3)]             | (-10,3)
1194  (10,10)           | [(0,-20),(30,-20)]            | (10,-20)
1195  (10,10)           | [(NaN,1),(NaN,90)]            | 
1196 (80 rows)
1198 -- Closest point to box
1199 SELECT p.f1, b.f1, p.f1 ## b.f1 FROM POINT_TBL p, BOX_TBL b;
1200         f1         |         f1          |   ?column?   
1201 -------------------+---------------------+--------------
1202  (0,0)             | (2,2),(0,0)         | (0,0)
1203  (0,0)             | (3,3),(1,1)         | (1,1)
1204  (0,0)             | (-2,2),(-8,-10)     | (-2,0)
1205  (0,0)             | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
1206  (0,0)             | (3,3),(3,3)         | (3,3)
1207  (-10,0)           | (2,2),(0,0)         | (0,0)
1208  (-10,0)           | (3,3),(1,1)         | (1,1)
1209  (-10,0)           | (-2,2),(-8,-10)     | (-8,0)
1210  (-10,0)           | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
1211  (-10,0)           | (3,3),(3,3)         | (3,3)
1212  (-3,4)            | (2,2),(0,0)         | (0,2)
1213  (-3,4)            | (3,3),(1,1)         | (1,3)
1214  (-3,4)            | (-2,2),(-8,-10)     | (-3,2)
1215  (-3,4)            | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
1216  (-3,4)            | (3,3),(3,3)         | (3,3)
1217  (5.1,34.5)        | (2,2),(0,0)         | (2,2)
1218  (5.1,34.5)        | (3,3),(1,1)         | (3,3)
1219  (5.1,34.5)        | (-2,2),(-8,-10)     | (-2,2)
1220  (5.1,34.5)        | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
1221  (5.1,34.5)        | (3,3),(3,3)         | (3,3)
1222  (-5,-12)          | (2,2),(0,0)         | (0,0)
1223  (-5,-12)          | (3,3),(1,1)         | (1,1)
1224  (-5,-12)          | (-2,2),(-8,-10)     | (-5,-10)
1225  (-5,-12)          | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
1226  (-5,-12)          | (3,3),(3,3)         | (3,3)
1227  (1e-300,-1e-300)  | (2,2),(0,0)         | (0,0)
1228  (1e-300,-1e-300)  | (3,3),(1,1)         | (1,1)
1229  (1e-300,-1e-300)  | (-2,2),(-8,-10)     | (-2,-1e-300)
1230  (1e-300,-1e-300)  | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
1231  (1e-300,-1e-300)  | (3,3),(3,3)         | (3,3)
1232  (1e+300,Infinity) | (2,2),(0,0)         | (0,2)
1233  (1e+300,Infinity) | (3,3),(1,1)         | (1,3)
1234  (1e+300,Infinity) | (-2,2),(-8,-10)     | (-8,2)
1235  (1e+300,Infinity) | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
1236  (1e+300,Infinity) | (3,3),(3,3)         | (3,3)
1237  (Infinity,1e+300) | (2,2),(0,0)         | (0,2)
1238  (Infinity,1e+300) | (3,3),(1,1)         | (1,3)
1239  (Infinity,1e+300) | (-2,2),(-8,-10)     | (-8,2)
1240  (Infinity,1e+300) | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
1241  (Infinity,1e+300) | (3,3),(3,3)         | (3,3)
1242  (NaN,NaN)         | (2,2),(0,0)         | 
1243  (NaN,NaN)         | (3,3),(1,1)         | 
1244  (NaN,NaN)         | (-2,2),(-8,-10)     | 
1245  (NaN,NaN)         | (2.5,3.5),(2.5,2.5) | 
1246  (NaN,NaN)         | (3,3),(3,3)         | 
1247  (10,10)           | (2,2),(0,0)         | (2,2)
1248  (10,10)           | (3,3),(1,1)         | (3,3)
1249  (10,10)           | (-2,2),(-8,-10)     | (-2,2)
1250  (10,10)           | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
1251  (10,10)           | (3,3),(3,3)         | (3,3)
1252 (50 rows)
1254 -- On line
1255 SELECT p.f1, l.s FROM POINT_TBL p, LINE_TBL l WHERE p.f1 <@ l.s;
1256         f1        |    s     
1257 ------------------+----------
1258  (0,0)            | {0,3,0}
1259  (0,0)            | {1,-1,0}
1260  (-10,0)          | {0,3,0}
1261  (-5,-12)         | {1,0,5}
1262  (1e-300,-1e-300) | {0,3,0}
1263  (1e-300,-1e-300) | {1,-1,0}
1264  (10,10)          | {1,-1,0}
1265 (7 rows)
1267 -- On line segment
1268 SELECT p.f1, l.s FROM POINT_TBL p, LSEG_TBL l WHERE p.f1 <@ l.s;
1269         f1        |       s       
1270 ------------------+---------------
1271  (0,0)            | [(0,0),(6,6)]
1272  (1e-300,-1e-300) | [(0,0),(6,6)]
1273 (2 rows)
1275 -- On path
1276 SELECT p.f1, p1.f1 FROM POINT_TBL p, PATH_TBL p1 WHERE p.f1 <@ p1.f1;
1277         f1        |            f1             
1278 ------------------+---------------------------
1279  (0,0)            | [(0,0),(3,0),(4,5),(1,6)]
1280  (1e-300,-1e-300) | [(0,0),(3,0),(4,5),(1,6)]
1281  (NaN,NaN)        | ((1,2),(3,4))
1282  (NaN,NaN)        | ((1,2),(3,4))
1283  (NaN,NaN)        | ((1,2),(3,4))
1284  (NaN,NaN)        | ((10,20))
1285  (NaN,NaN)        | ((11,12),(13,14))
1286 (7 rows)
1289 -- Lines
1291 -- Vertical
1292 SELECT s FROM LINE_TBL WHERE ?| s;
1293     s     
1294 ----------
1295  {1,0,5}
1296  {-1,0,3}
1297 (2 rows)
1299 -- Horizontal
1300 SELECT s FROM LINE_TBL WHERE ?- s;
1301     s     
1302 ----------
1303  {0,-1,5}
1304  {0,3,0}
1305  {0,-1,3}
1306 (3 rows)
1308 -- Same as line
1309 SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s = l2.s;
1310                    s                   |                   s                   
1311 ---------------------------------------+---------------------------------------
1312  {0,-1,5}                              | {0,-1,5}
1313  {1,0,5}                               | {1,0,5}
1314  {0,3,0}                               | {0,3,0}
1315  {1,-1,0}                              | {1,-1,0}
1316  {-0.4,-1,-6}                          | {-0.4,-1,-6}
1317  {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846}
1318  {3,NaN,5}                             | {3,NaN,5}
1319  {NaN,NaN,NaN}                         | {NaN,NaN,NaN}
1320  {0,-1,3}                              | {0,-1,3}
1321  {-1,0,3}                              | {-1,0,3}
1322 (10 rows)
1324 -- Parallel to line
1325 SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?|| l2.s;
1326                    s                   |                   s                   
1327 ---------------------------------------+---------------------------------------
1328  {0,-1,5}                              | {0,-1,5}
1329  {0,-1,5}                              | {0,3,0}
1330  {0,-1,5}                              | {0,-1,3}
1331  {1,0,5}                               | {1,0,5}
1332  {1,0,5}                               | {-1,0,3}
1333  {0,3,0}                               | {0,-1,5}
1334  {0,3,0}                               | {0,3,0}
1335  {0,3,0}                               | {0,-1,3}
1336  {1,-1,0}                              | {1,-1,0}
1337  {-0.4,-1,-6}                          | {-0.4,-1,-6}
1338  {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846}
1339  {0,-1,3}                              | {0,-1,5}
1340  {0,-1,3}                              | {0,3,0}
1341  {0,-1,3}                              | {0,-1,3}
1342  {-1,0,3}                              | {1,0,5}
1343  {-1,0,3}                              | {-1,0,3}
1344 (16 rows)
1346 -- Perpendicular to line
1347 SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?-| l2.s;
1348     s     |    s     
1349 ----------+----------
1350  {0,-1,5} | {1,0,5}
1351  {0,-1,5} | {-1,0,3}
1352  {1,0,5}  | {0,-1,5}
1353  {1,0,5}  | {0,3,0}
1354  {1,0,5}  | {0,-1,3}
1355  {0,3,0}  | {1,0,5}
1356  {0,3,0}  | {-1,0,3}
1357  {0,-1,3} | {1,0,5}
1358  {0,-1,3} | {-1,0,3}
1359  {-1,0,3} | {0,-1,5}
1360  {-1,0,3} | {0,3,0}
1361  {-1,0,3} | {0,-1,3}
1362 (12 rows)
1364 -- Distance to line
1365 SELECT l1.s, l2.s, l1.s <-> l2.s FROM LINE_TBL l1, LINE_TBL l2;
1366                    s                   |                   s                   | ?column? 
1367 ---------------------------------------+---------------------------------------+----------
1368  {0,-1,5}                              | {0,-1,5}                              |        0
1369  {0,-1,5}                              | {1,0,5}                               |        0
1370  {0,-1,5}                              | {0,3,0}                               |        5
1371  {0,-1,5}                              | {1,-1,0}                              |        0
1372  {0,-1,5}                              | {-0.4,-1,-6}                          |        0
1373  {0,-1,5}                              | {-0.000184615384615,-1,15.3846153846} |        0
1374  {0,-1,5}                              | {3,NaN,5}                             |        0
1375  {0,-1,5}                              | {NaN,NaN,NaN}                         |        0
1376  {0,-1,5}                              | {0,-1,3}                              |        2
1377  {0,-1,5}                              | {-1,0,3}                              |        0
1378  {1,0,5}                               | {0,-1,5}                              |        0
1379  {1,0,5}                               | {1,0,5}                               |        0
1380  {1,0,5}                               | {0,3,0}                               |        0
1381  {1,0,5}                               | {1,-1,0}                              |        0
1382  {1,0,5}                               | {-0.4,-1,-6}                          |        0
1383  {1,0,5}                               | {-0.000184615384615,-1,15.3846153846} |        0
1384  {1,0,5}                               | {3,NaN,5}                             |        0
1385  {1,0,5}                               | {NaN,NaN,NaN}                         |        0
1386  {1,0,5}                               | {0,-1,3}                              |        0
1387  {1,0,5}                               | {-1,0,3}                              |        8
1388  {0,3,0}                               | {0,-1,5}                              |        5
1389  {0,3,0}                               | {1,0,5}                               |        0
1390  {0,3,0}                               | {0,3,0}                               |        0
1391  {0,3,0}                               | {1,-1,0}                              |        0
1392  {0,3,0}                               | {-0.4,-1,-6}                          |        0
1393  {0,3,0}                               | {-0.000184615384615,-1,15.3846153846} |        0
1394  {0,3,0}                               | {3,NaN,5}                             |        0
1395  {0,3,0}                               | {NaN,NaN,NaN}                         |        0
1396  {0,3,0}                               | {0,-1,3}                              |        3
1397  {0,3,0}                               | {-1,0,3}                              |        0
1398  {1,-1,0}                              | {0,-1,5}                              |        0
1399  {1,-1,0}                              | {1,0,5}                               |        0
1400  {1,-1,0}                              | {0,3,0}                               |        0
1401  {1,-1,0}                              | {1,-1,0}                              |        0
1402  {1,-1,0}                              | {-0.4,-1,-6}                          |        0
1403  {1,-1,0}                              | {-0.000184615384615,-1,15.3846153846} |        0
1404  {1,-1,0}                              | {3,NaN,5}                             |        0
1405  {1,-1,0}                              | {NaN,NaN,NaN}                         |        0
1406  {1,-1,0}                              | {0,-1,3}                              |        0
1407  {1,-1,0}                              | {-1,0,3}                              |        0
1408  {-0.4,-1,-6}                          | {0,-1,5}                              |        0
1409  {-0.4,-1,-6}                          | {1,0,5}                               |        0
1410  {-0.4,-1,-6}                          | {0,3,0}                               |        0
1411  {-0.4,-1,-6}                          | {1,-1,0}                              |        0
1412  {-0.4,-1,-6}                          | {-0.4,-1,-6}                          |        0
1413  {-0.4,-1,-6}                          | {-0.000184615384615,-1,15.3846153846} |        0
1414  {-0.4,-1,-6}                          | {3,NaN,5}                             |        0
1415  {-0.4,-1,-6}                          | {NaN,NaN,NaN}                         |        0
1416  {-0.4,-1,-6}                          | {0,-1,3}                              |        0
1417  {-0.4,-1,-6}                          | {-1,0,3}                              |        0
1418  {-0.000184615384615,-1,15.3846153846} | {0,-1,5}                              |        0
1419  {-0.000184615384615,-1,15.3846153846} | {1,0,5}                               |        0
1420  {-0.000184615384615,-1,15.3846153846} | {0,3,0}                               |        0
1421  {-0.000184615384615,-1,15.3846153846} | {1,-1,0}                              |        0
1422  {-0.000184615384615,-1,15.3846153846} | {-0.4,-1,-6}                          |        0
1423  {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846} |        0
1424  {-0.000184615384615,-1,15.3846153846} | {3,NaN,5}                             |        0
1425  {-0.000184615384615,-1,15.3846153846} | {NaN,NaN,NaN}                         |        0
1426  {-0.000184615384615,-1,15.3846153846} | {0,-1,3}                              |        0
1427  {-0.000184615384615,-1,15.3846153846} | {-1,0,3}                              |        0
1428  {3,NaN,5}                             | {0,-1,5}                              |        0
1429  {3,NaN,5}                             | {1,0,5}                               |        0
1430  {3,NaN,5}                             | {0,3,0}                               |        0
1431  {3,NaN,5}                             | {1,-1,0}                              |        0
1432  {3,NaN,5}                             | {-0.4,-1,-6}                          |        0
1433  {3,NaN,5}                             | {-0.000184615384615,-1,15.3846153846} |        0
1434  {3,NaN,5}                             | {3,NaN,5}                             |        0
1435  {3,NaN,5}                             | {NaN,NaN,NaN}                         |        0
1436  {3,NaN,5}                             | {0,-1,3}                              |        0
1437  {3,NaN,5}                             | {-1,0,3}                              |        0
1438  {NaN,NaN,NaN}                         | {0,-1,5}                              |        0
1439  {NaN,NaN,NaN}                         | {1,0,5}                               |        0
1440  {NaN,NaN,NaN}                         | {0,3,0}                               |        0
1441  {NaN,NaN,NaN}                         | {1,-1,0}                              |        0
1442  {NaN,NaN,NaN}                         | {-0.4,-1,-6}                          |        0
1443  {NaN,NaN,NaN}                         | {-0.000184615384615,-1,15.3846153846} |        0
1444  {NaN,NaN,NaN}                         | {3,NaN,5}                             |        0
1445  {NaN,NaN,NaN}                         | {NaN,NaN,NaN}                         |        0
1446  {NaN,NaN,NaN}                         | {0,-1,3}                              |        0
1447  {NaN,NaN,NaN}                         | {-1,0,3}                              |        0
1448  {0,-1,3}                              | {0,-1,5}                              |        2
1449  {0,-1,3}                              | {1,0,5}                               |        0
1450  {0,-1,3}                              | {0,3,0}                               |        3
1451  {0,-1,3}                              | {1,-1,0}                              |        0
1452  {0,-1,3}                              | {-0.4,-1,-6}                          |        0
1453  {0,-1,3}                              | {-0.000184615384615,-1,15.3846153846} |        0
1454  {0,-1,3}                              | {3,NaN,5}                             |        0
1455  {0,-1,3}                              | {NaN,NaN,NaN}                         |        0
1456  {0,-1,3}                              | {0,-1,3}                              |        0
1457  {0,-1,3}                              | {-1,0,3}                              |        0
1458  {-1,0,3}                              | {0,-1,5}                              |        0
1459  {-1,0,3}                              | {1,0,5}                               |        8
1460  {-1,0,3}                              | {0,3,0}                               |        0
1461  {-1,0,3}                              | {1,-1,0}                              |        0
1462  {-1,0,3}                              | {-0.4,-1,-6}                          |        0
1463  {-1,0,3}                              | {-0.000184615384615,-1,15.3846153846} |        0
1464  {-1,0,3}                              | {3,NaN,5}                             |        0
1465  {-1,0,3}                              | {NaN,NaN,NaN}                         |        0
1466  {-1,0,3}                              | {0,-1,3}                              |        0
1467  {-1,0,3}                              | {-1,0,3}                              |        0
1468 (100 rows)
1470 -- Distance to box
1471 SELECT l.s, b.f1, l.s <-> b.f1 FROM LINE_TBL l, BOX_TBL b;
1472 ERROR:  function "dist_lb" not implemented
1473 SELECT l.s, b.f1, b.f1 <-> l.s FROM LINE_TBL l, BOX_TBL b;
1474 ERROR:  function "dist_bl" not implemented
1475 -- Intersect with line
1476 SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?# l2.s;
1477                    s                   |                   s                   
1478 ---------------------------------------+---------------------------------------
1479  {0,-1,5}                              | {1,0,5}
1480  {0,-1,5}                              | {1,-1,0}
1481  {0,-1,5}                              | {-0.4,-1,-6}
1482  {0,-1,5}                              | {-0.000184615384615,-1,15.3846153846}
1483  {0,-1,5}                              | {3,NaN,5}
1484  {0,-1,5}                              | {NaN,NaN,NaN}
1485  {0,-1,5}                              | {-1,0,3}
1486  {1,0,5}                               | {0,-1,5}
1487  {1,0,5}                               | {0,3,0}
1488  {1,0,5}                               | {1,-1,0}
1489  {1,0,5}                               | {-0.4,-1,-6}
1490  {1,0,5}                               | {-0.000184615384615,-1,15.3846153846}
1491  {1,0,5}                               | {3,NaN,5}
1492  {1,0,5}                               | {NaN,NaN,NaN}
1493  {1,0,5}                               | {0,-1,3}
1494  {0,3,0}                               | {1,0,5}
1495  {0,3,0}                               | {1,-1,0}
1496  {0,3,0}                               | {-0.4,-1,-6}
1497  {0,3,0}                               | {-0.000184615384615,-1,15.3846153846}
1498  {0,3,0}                               | {3,NaN,5}
1499  {0,3,0}                               | {NaN,NaN,NaN}
1500  {0,3,0}                               | {-1,0,3}
1501  {1,-1,0}                              | {0,-1,5}
1502  {1,-1,0}                              | {1,0,5}
1503  {1,-1,0}                              | {0,3,0}
1504  {1,-1,0}                              | {-0.4,-1,-6}
1505  {1,-1,0}                              | {-0.000184615384615,-1,15.3846153846}
1506  {1,-1,0}                              | {3,NaN,5}
1507  {1,-1,0}                              | {NaN,NaN,NaN}
1508  {1,-1,0}                              | {0,-1,3}
1509  {1,-1,0}                              | {-1,0,3}
1510  {-0.4,-1,-6}                          | {0,-1,5}
1511  {-0.4,-1,-6}                          | {1,0,5}
1512  {-0.4,-1,-6}                          | {0,3,0}
1513  {-0.4,-1,-6}                          | {1,-1,0}
1514  {-0.4,-1,-6}                          | {-0.000184615384615,-1,15.3846153846}
1515  {-0.4,-1,-6}                          | {3,NaN,5}
1516  {-0.4,-1,-6}                          | {NaN,NaN,NaN}
1517  {-0.4,-1,-6}                          | {0,-1,3}
1518  {-0.4,-1,-6}                          | {-1,0,3}
1519  {-0.000184615384615,-1,15.3846153846} | {0,-1,5}
1520  {-0.000184615384615,-1,15.3846153846} | {1,0,5}
1521  {-0.000184615384615,-1,15.3846153846} | {0,3,0}
1522  {-0.000184615384615,-1,15.3846153846} | {1,-1,0}
1523  {-0.000184615384615,-1,15.3846153846} | {-0.4,-1,-6}
1524  {-0.000184615384615,-1,15.3846153846} | {3,NaN,5}
1525  {-0.000184615384615,-1,15.3846153846} | {NaN,NaN,NaN}
1526  {-0.000184615384615,-1,15.3846153846} | {0,-1,3}
1527  {-0.000184615384615,-1,15.3846153846} | {-1,0,3}
1528  {3,NaN,5}                             | {0,-1,5}
1529  {3,NaN,5}                             | {1,0,5}
1530  {3,NaN,5}                             | {0,3,0}
1531  {3,NaN,5}                             | {1,-1,0}
1532  {3,NaN,5}                             | {-0.4,-1,-6}
1533  {3,NaN,5}                             | {-0.000184615384615,-1,15.3846153846}
1534  {3,NaN,5}                             | {3,NaN,5}
1535  {3,NaN,5}                             | {NaN,NaN,NaN}
1536  {3,NaN,5}                             | {0,-1,3}
1537  {3,NaN,5}                             | {-1,0,3}
1538  {NaN,NaN,NaN}                         | {0,-1,5}
1539  {NaN,NaN,NaN}                         | {1,0,5}
1540  {NaN,NaN,NaN}                         | {0,3,0}
1541  {NaN,NaN,NaN}                         | {1,-1,0}
1542  {NaN,NaN,NaN}                         | {-0.4,-1,-6}
1543  {NaN,NaN,NaN}                         | {-0.000184615384615,-1,15.3846153846}
1544  {NaN,NaN,NaN}                         | {3,NaN,5}
1545  {NaN,NaN,NaN}                         | {NaN,NaN,NaN}
1546  {NaN,NaN,NaN}                         | {0,-1,3}
1547  {NaN,NaN,NaN}                         | {-1,0,3}
1548  {0,-1,3}                              | {1,0,5}
1549  {0,-1,3}                              | {1,-1,0}
1550  {0,-1,3}                              | {-0.4,-1,-6}
1551  {0,-1,3}                              | {-0.000184615384615,-1,15.3846153846}
1552  {0,-1,3}                              | {3,NaN,5}
1553  {0,-1,3}                              | {NaN,NaN,NaN}
1554  {0,-1,3}                              | {-1,0,3}
1555  {-1,0,3}                              | {0,-1,5}
1556  {-1,0,3}                              | {0,3,0}
1557  {-1,0,3}                              | {1,-1,0}
1558  {-1,0,3}                              | {-0.4,-1,-6}
1559  {-1,0,3}                              | {-0.000184615384615,-1,15.3846153846}
1560  {-1,0,3}                              | {3,NaN,5}
1561  {-1,0,3}                              | {NaN,NaN,NaN}
1562  {-1,0,3}                              | {0,-1,3}
1563 (84 rows)
1565 -- Intersect with box
1566 SELECT l.s, b.f1 FROM LINE_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
1567       s       |         f1          
1568 --------------+---------------------
1569  {1,0,5}      | (-2,2),(-8,-10)
1570  {0,3,0}      | (2,2),(0,0)
1571  {0,3,0}      | (-2,2),(-8,-10)
1572  {1,-1,0}     | (2,2),(0,0)
1573  {1,-1,0}     | (3,3),(1,1)
1574  {1,-1,0}     | (-2,2),(-8,-10)
1575  {1,-1,0}     | (2.5,3.5),(2.5,2.5)
1576  {1,-1,0}     | (3,3),(3,3)
1577  {-0.4,-1,-6} | (-2,2),(-8,-10)
1578  {0,-1,3}     | (3,3),(1,1)
1579  {0,-1,3}     | (2.5,3.5),(2.5,2.5)
1580  {0,-1,3}     | (3,3),(3,3)
1581  {-1,0,3}     | (3,3),(1,1)
1582 (13 rows)
1584 -- Intersection point with line
1585 SELECT l1.s, l2.s, l1.s # l2.s FROM LINE_TBL l1, LINE_TBL l2;
1586                    s                   |                   s                   |             ?column?              
1587 ---------------------------------------+---------------------------------------+-----------------------------------
1588  {0,-1,5}                              | {0,-1,5}                              | 
1589  {0,-1,5}                              | {1,0,5}                               | (-5,5)
1590  {0,-1,5}                              | {0,3,0}                               | 
1591  {0,-1,5}                              | {1,-1,0}                              | (5,5)
1592  {0,-1,5}                              | {-0.4,-1,-6}                          | (-27.5,5)
1593  {0,-1,5}                              | {-0.000184615384615,-1,15.3846153846} | (56250,5)
1594  {0,-1,5}                              | {3,NaN,5}                             | (NaN,NaN)
1595  {0,-1,5}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
1596  {0,-1,5}                              | {0,-1,3}                              | 
1597  {0,-1,5}                              | {-1,0,3}                              | (3,5)
1598  {1,0,5}                               | {0,-1,5}                              | (-5,5)
1599  {1,0,5}                               | {1,0,5}                               | 
1600  {1,0,5}                               | {0,3,0}                               | (-5,0)
1601  {1,0,5}                               | {1,-1,0}                              | (-5,-5)
1602  {1,0,5}                               | {-0.4,-1,-6}                          | (-5,-4)
1603  {1,0,5}                               | {-0.000184615384615,-1,15.3846153846} | (-5,15.3855384615)
1604  {1,0,5}                               | {3,NaN,5}                             | (NaN,NaN)
1605  {1,0,5}                               | {NaN,NaN,NaN}                         | (NaN,NaN)
1606  {1,0,5}                               | {0,-1,3}                              | (-5,3)
1607  {1,0,5}                               | {-1,0,3}                              | 
1608  {0,3,0}                               | {0,-1,5}                              | 
1609  {0,3,0}                               | {1,0,5}                               | (-5,0)
1610  {0,3,0}                               | {0,3,0}                               | 
1611  {0,3,0}                               | {1,-1,0}                              | (0,0)
1612  {0,3,0}                               | {-0.4,-1,-6}                          | (-15,0)
1613  {0,3,0}                               | {-0.000184615384615,-1,15.3846153846} | (83333.3333333,0)
1614  {0,3,0}                               | {3,NaN,5}                             | (NaN,NaN)
1615  {0,3,0}                               | {NaN,NaN,NaN}                         | (NaN,NaN)
1616  {0,3,0}                               | {0,-1,3}                              | 
1617  {0,3,0}                               | {-1,0,3}                              | (3,0)
1618  {1,-1,0}                              | {0,-1,5}                              | (5,5)
1619  {1,-1,0}                              | {1,0,5}                               | (-5,-5)
1620  {1,-1,0}                              | {0,3,0}                               | (0,0)
1621  {1,-1,0}                              | {1,-1,0}                              | 
1622  {1,-1,0}                              | {-0.4,-1,-6}                          | (-4.28571428571,-4.28571428571)
1623  {1,-1,0}                              | {-0.000184615384615,-1,15.3846153846} | (15.3817756722,15.3817756722)
1624  {1,-1,0}                              | {3,NaN,5}                             | (NaN,NaN)
1625  {1,-1,0}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
1626  {1,-1,0}                              | {0,-1,3}                              | (3,3)
1627  {1,-1,0}                              | {-1,0,3}                              | (3,3)
1628  {-0.4,-1,-6}                          | {0,-1,5}                              | (-27.5,5)
1629  {-0.4,-1,-6}                          | {1,0,5}                               | (-5,-4)
1630  {-0.4,-1,-6}                          | {0,3,0}                               | (-15,0)
1631  {-0.4,-1,-6}                          | {1,-1,0}                              | (-4.28571428571,-4.28571428571)
1632  {-0.4,-1,-6}                          | {-0.4,-1,-6}                          | 
1633  {-0.4,-1,-6}                          | {-0.000184615384615,-1,15.3846153846} | (-53.4862244113,15.3944897645)
1634  {-0.4,-1,-6}                          | {3,NaN,5}                             | (NaN,NaN)
1635  {-0.4,-1,-6}                          | {NaN,NaN,NaN}                         | (NaN,NaN)
1636  {-0.4,-1,-6}                          | {0,-1,3}                              | (-22.5,3)
1637  {-0.4,-1,-6}                          | {-1,0,3}                              | (3,-7.2)
1638  {-0.000184615384615,-1,15.3846153846} | {0,-1,5}                              | (56250,5)
1639  {-0.000184615384615,-1,15.3846153846} | {1,0,5}                               | (-5,15.3855384615)
1640  {-0.000184615384615,-1,15.3846153846} | {0,3,0}                               | (83333.3333333,-1.7763568394e-15)
1641  {-0.000184615384615,-1,15.3846153846} | {1,-1,0}                              | (15.3817756722,15.3817756722)
1642  {-0.000184615384615,-1,15.3846153846} | {-0.4,-1,-6}                          | (-53.4862244113,15.3944897645)
1643  {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846} | 
1644  {-0.000184615384615,-1,15.3846153846} | {3,NaN,5}                             | (NaN,NaN)
1645  {-0.000184615384615,-1,15.3846153846} | {NaN,NaN,NaN}                         | (NaN,NaN)
1646  {-0.000184615384615,-1,15.3846153846} | {0,-1,3}                              | (67083.3333333,3)
1647  {-0.000184615384615,-1,15.3846153846} | {-1,0,3}                              | (3,15.3840615385)
1648  {3,NaN,5}                             | {0,-1,5}                              | (NaN,NaN)
1649  {3,NaN,5}                             | {1,0,5}                               | (NaN,NaN)
1650  {3,NaN,5}                             | {0,3,0}                               | (NaN,NaN)
1651  {3,NaN,5}                             | {1,-1,0}                              | (NaN,NaN)
1652  {3,NaN,5}                             | {-0.4,-1,-6}                          | (NaN,NaN)
1653  {3,NaN,5}                             | {-0.000184615384615,-1,15.3846153846} | (NaN,NaN)
1654  {3,NaN,5}                             | {3,NaN,5}                             | (NaN,NaN)
1655  {3,NaN,5}                             | {NaN,NaN,NaN}                         | (NaN,NaN)
1656  {3,NaN,5}                             | {0,-1,3}                              | (NaN,NaN)
1657  {3,NaN,5}                             | {-1,0,3}                              | (NaN,NaN)
1658  {NaN,NaN,NaN}                         | {0,-1,5}                              | (NaN,NaN)
1659  {NaN,NaN,NaN}                         | {1,0,5}                               | (NaN,NaN)
1660  {NaN,NaN,NaN}                         | {0,3,0}                               | (NaN,NaN)
1661  {NaN,NaN,NaN}                         | {1,-1,0}                              | (NaN,NaN)
1662  {NaN,NaN,NaN}                         | {-0.4,-1,-6}                          | (NaN,NaN)
1663  {NaN,NaN,NaN}                         | {-0.000184615384615,-1,15.3846153846} | (NaN,NaN)
1664  {NaN,NaN,NaN}                         | {3,NaN,5}                             | (NaN,NaN)
1665  {NaN,NaN,NaN}                         | {NaN,NaN,NaN}                         | (NaN,NaN)
1666  {NaN,NaN,NaN}                         | {0,-1,3}                              | (NaN,NaN)
1667  {NaN,NaN,NaN}                         | {-1,0,3}                              | (NaN,NaN)
1668  {0,-1,3}                              | {0,-1,5}                              | 
1669  {0,-1,3}                              | {1,0,5}                               | (-5,3)
1670  {0,-1,3}                              | {0,3,0}                               | 
1671  {0,-1,3}                              | {1,-1,0}                              | (3,3)
1672  {0,-1,3}                              | {-0.4,-1,-6}                          | (-22.5,3)
1673  {0,-1,3}                              | {-0.000184615384615,-1,15.3846153846} | (67083.3333333,3)
1674  {0,-1,3}                              | {3,NaN,5}                             | (NaN,NaN)
1675  {0,-1,3}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
1676  {0,-1,3}                              | {0,-1,3}                              | 
1677  {0,-1,3}                              | {-1,0,3}                              | (3,3)
1678  {-1,0,3}                              | {0,-1,5}                              | (3,5)
1679  {-1,0,3}                              | {1,0,5}                               | 
1680  {-1,0,3}                              | {0,3,0}                               | (3,0)
1681  {-1,0,3}                              | {1,-1,0}                              | (3,3)
1682  {-1,0,3}                              | {-0.4,-1,-6}                          | (3,-7.2)
1683  {-1,0,3}                              | {-0.000184615384615,-1,15.3846153846} | (3,15.3840615385)
1684  {-1,0,3}                              | {3,NaN,5}                             | (NaN,NaN)
1685  {-1,0,3}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
1686  {-1,0,3}                              | {0,-1,3}                              | (3,3)
1687  {-1,0,3}                              | {-1,0,3}                              | 
1688 (100 rows)
1690 -- Closest point to line segment
1691 SELECT l.s, l1.s, l.s ## l1.s FROM LINE_TBL l, LSEG_TBL l1;
1692                    s                   |               s               |             ?column?              
1693 ---------------------------------------+-------------------------------+-----------------------------------
1694  {0,-1,5}                              | [(1,2),(3,4)]                 | (3,4)
1695  {0,-1,5}                              | [(0,0),(6,6)]                 | (5,5)
1696  {0,-1,5}                              | [(10,-10),(-3,-4)]            | (-3,-4)
1697  {0,-1,5}                              | [(-1000000,200),(300000,-40)] | (56250,5)
1698  {0,-1,5}                              | [(11,22),(33,44)]             | (11,22)
1699  {0,-1,5}                              | [(-10,2),(-10,3)]             | (-10,3)
1700  {0,-1,5}                              | [(0,-20),(30,-20)]            | 
1701  {0,-1,5}                              | [(NaN,1),(NaN,90)]            | 
1702  {1,0,5}                               | [(1,2),(3,4)]                 | (1,2)
1703  {1,0,5}                               | [(0,0),(6,6)]                 | (0,0)
1704  {1,0,5}                               | [(10,-10),(-3,-4)]            | (-3,-4)
1705  {1,0,5}                               | [(-1000000,200),(300000,-40)] | (-5,15.3855384615)
1706  {1,0,5}                               | [(11,22),(33,44)]             | (11,22)
1707  {1,0,5}                               | [(-10,2),(-10,3)]             | 
1708  {1,0,5}                               | [(0,-20),(30,-20)]            | (0,-20)
1709  {1,0,5}                               | [(NaN,1),(NaN,90)]            | 
1710  {0,3,0}                               | [(1,2),(3,4)]                 | (1,2)
1711  {0,3,0}                               | [(0,0),(6,6)]                 | (0,0)
1712  {0,3,0}                               | [(10,-10),(-3,-4)]            | (-3,-4)
1713  {0,3,0}                               | [(-1000000,200),(300000,-40)] | (83333.3333333,-1.7763568394e-15)
1714  {0,3,0}                               | [(11,22),(33,44)]             | (11,22)
1715  {0,3,0}                               | [(-10,2),(-10,3)]             | (-10,2)
1716  {0,3,0}                               | [(0,-20),(30,-20)]            | 
1717  {0,3,0}                               | [(NaN,1),(NaN,90)]            | 
1718  {1,-1,0}                              | [(1,2),(3,4)]                 | 
1719  {1,-1,0}                              | [(0,0),(6,6)]                 | 
1720  {1,-1,0}                              | [(10,-10),(-3,-4)]            | (-3,-4)
1721  {1,-1,0}                              | [(-1000000,200),(300000,-40)] | (15.3817756722,15.3817756722)
1722  {1,-1,0}                              | [(11,22),(33,44)]             | 
1723  {1,-1,0}                              | [(-10,2),(-10,3)]             | (-10,2)
1724  {1,-1,0}                              | [(0,-20),(30,-20)]            | (0,-20)
1725  {1,-1,0}                              | [(NaN,1),(NaN,90)]            | 
1726  {-0.4,-1,-6}                          | [(1,2),(3,4)]                 | (1,2)
1727  {-0.4,-1,-6}                          | [(0,0),(6,6)]                 | (0,0)
1728  {-0.4,-1,-6}                          | [(10,-10),(-3,-4)]            | (10,-10)
1729  {-0.4,-1,-6}                          | [(-1000000,200),(300000,-40)] | (-53.4862244113,15.3944897645)
1730  {-0.4,-1,-6}                          | [(11,22),(33,44)]             | (11,22)
1731  {-0.4,-1,-6}                          | [(-10,2),(-10,3)]             | (-10,2)
1732  {-0.4,-1,-6}                          | [(0,-20),(30,-20)]            | (30,-20)
1733  {-0.4,-1,-6}                          | [(NaN,1),(NaN,90)]            | 
1734  {-0.000184615384615,-1,15.3846153846} | [(1,2),(3,4)]                 | (3,4)
1735  {-0.000184615384615,-1,15.3846153846} | [(0,0),(6,6)]                 | (6,6)
1736  {-0.000184615384615,-1,15.3846153846} | [(10,-10),(-3,-4)]            | (-3,-4)
1737  {-0.000184615384615,-1,15.3846153846} | [(-1000000,200),(300000,-40)] | 
1738  {-0.000184615384615,-1,15.3846153846} | [(11,22),(33,44)]             | (11,22)
1739  {-0.000184615384615,-1,15.3846153846} | [(-10,2),(-10,3)]             | (-10,3)
1740  {-0.000184615384615,-1,15.3846153846} | [(0,-20),(30,-20)]            | (30,-20)
1741  {-0.000184615384615,-1,15.3846153846} | [(NaN,1),(NaN,90)]            | 
1742  {3,NaN,5}                             | [(1,2),(3,4)]                 | 
1743  {3,NaN,5}                             | [(0,0),(6,6)]                 | 
1744  {3,NaN,5}                             | [(10,-10),(-3,-4)]            | 
1745  {3,NaN,5}                             | [(-1000000,200),(300000,-40)] | 
1746  {3,NaN,5}                             | [(11,22),(33,44)]             | 
1747  {3,NaN,5}                             | [(-10,2),(-10,3)]             | 
1748  {3,NaN,5}                             | [(0,-20),(30,-20)]            | 
1749  {3,NaN,5}                             | [(NaN,1),(NaN,90)]            | 
1750  {NaN,NaN,NaN}                         | [(1,2),(3,4)]                 | 
1751  {NaN,NaN,NaN}                         | [(0,0),(6,6)]                 | 
1752  {NaN,NaN,NaN}                         | [(10,-10),(-3,-4)]            | 
1753  {NaN,NaN,NaN}                         | [(-1000000,200),(300000,-40)] | 
1754  {NaN,NaN,NaN}                         | [(11,22),(33,44)]             | 
1755  {NaN,NaN,NaN}                         | [(-10,2),(-10,3)]             | 
1756  {NaN,NaN,NaN}                         | [(0,-20),(30,-20)]            | 
1757  {NaN,NaN,NaN}                         | [(NaN,1),(NaN,90)]            | 
1758  {0,-1,3}                              | [(1,2),(3,4)]                 | (2,3)
1759  {0,-1,3}                              | [(0,0),(6,6)]                 | (3,3)
1760  {0,-1,3}                              | [(10,-10),(-3,-4)]            | (-3,-4)
1761  {0,-1,3}                              | [(-1000000,200),(300000,-40)] | (67083.3333333,3)
1762  {0,-1,3}                              | [(11,22),(33,44)]             | (11,22)
1763  {0,-1,3}                              | [(-10,2),(-10,3)]             | (-10,3)
1764  {0,-1,3}                              | [(0,-20),(30,-20)]            | 
1765  {0,-1,3}                              | [(NaN,1),(NaN,90)]            | 
1766  {-1,0,3}                              | [(1,2),(3,4)]                 | (3,4)
1767  {-1,0,3}                              | [(0,0),(6,6)]                 | (3,3)
1768  {-1,0,3}                              | [(10,-10),(-3,-4)]            | (3,-6.76923076923)
1769  {-1,0,3}                              | [(-1000000,200),(300000,-40)] | (3,15.3840615385)
1770  {-1,0,3}                              | [(11,22),(33,44)]             | (11,22)
1771  {-1,0,3}                              | [(-10,2),(-10,3)]             | 
1772  {-1,0,3}                              | [(0,-20),(30,-20)]            | (3,-20)
1773  {-1,0,3}                              | [(NaN,1),(NaN,90)]            | 
1774 (80 rows)
1776 -- Closest point to box
1777 SELECT l.s, b.f1, l.s ## b.f1 FROM LINE_TBL l, BOX_TBL b;
1778 ERROR:  function "close_lb" not implemented
1780 -- Line segments
1782 -- intersection
1783 SELECT p.f1, l.s, l.s # p.f1 AS intersection
1784    FROM LSEG_TBL l, POINT_TBL p;
1785 ERROR:  operator does not exist: lseg # point
1786 LINE 1: SELECT p.f1, l.s, l.s # p.f1 AS intersection
1787                               ^
1788 HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
1789 -- Length
1790 SELECT s, @-@ s FROM LSEG_TBL;
1791                s               |   ?column?    
1792 -------------------------------+---------------
1793  [(1,2),(3,4)]                 | 2.82842712475
1794  [(0,0),(6,6)]                 | 8.48528137424
1795  [(10,-10),(-3,-4)]            | 14.3178210633
1796  [(-1000000,200),(300000,-40)] | 1300000.02215
1797  [(11,22),(33,44)]             | 31.1126983722
1798  [(-10,2),(-10,3)]             |             1
1799  [(0,-20),(30,-20)]            |            30
1800  [(NaN,1),(NaN,90)]            |           NaN
1801 (8 rows)
1803 -- Vertical
1804 SELECT s FROM LSEG_TBL WHERE ?| s;
1805          s         
1806 -------------------
1807  [(-10,2),(-10,3)]
1808 (1 row)
1810 -- Horizontal
1811 SELECT s FROM LSEG_TBL WHERE ?- s;
1812          s          
1813 --------------------
1814  [(0,-20),(30,-20)]
1815 (1 row)
1817 -- Center
1818 SELECT s, @@ s FROM LSEG_TBL;
1819                s               |   ?column?   
1820 -------------------------------+--------------
1821  [(1,2),(3,4)]                 | (2,3)
1822  [(0,0),(6,6)]                 | (3,3)
1823  [(10,-10),(-3,-4)]            | (3.5,-7)
1824  [(-1000000,200),(300000,-40)] | (-350000,80)
1825  [(11,22),(33,44)]             | (22,33)
1826  [(-10,2),(-10,3)]             | (-10,2.5)
1827  [(0,-20),(30,-20)]            | (15,-20)
1828  [(NaN,1),(NaN,90)]            | (NaN,45.5)
1829 (8 rows)
1831 -- To point
1832 SELECT s, s::point FROM LSEG_TBL;
1833                s               |      s       
1834 -------------------------------+--------------
1835  [(1,2),(3,4)]                 | (2,3)
1836  [(0,0),(6,6)]                 | (3,3)
1837  [(10,-10),(-3,-4)]            | (3.5,-7)
1838  [(-1000000,200),(300000,-40)] | (-350000,80)
1839  [(11,22),(33,44)]             | (22,33)
1840  [(-10,2),(-10,3)]             | (-10,2.5)
1841  [(0,-20),(30,-20)]            | (15,-20)
1842  [(NaN,1),(NaN,90)]            | (NaN,45.5)
1843 (8 rows)
1845 -- Has points less than line segment
1846 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s < l2.s;
1847          s          |               s               
1848 --------------------+-------------------------------
1849  [(1,2),(3,4)]      | [(0,0),(6,6)]
1850  [(1,2),(3,4)]      | [(10,-10),(-3,-4)]
1851  [(1,2),(3,4)]      | [(-1000000,200),(300000,-40)]
1852  [(1,2),(3,4)]      | [(11,22),(33,44)]
1853  [(1,2),(3,4)]      | [(0,-20),(30,-20)]
1854  [(0,0),(6,6)]      | [(10,-10),(-3,-4)]
1855  [(0,0),(6,6)]      | [(-1000000,200),(300000,-40)]
1856  [(0,0),(6,6)]      | [(11,22),(33,44)]
1857  [(0,0),(6,6)]      | [(0,-20),(30,-20)]
1858  [(10,-10),(-3,-4)] | [(-1000000,200),(300000,-40)]
1859  [(10,-10),(-3,-4)] | [(11,22),(33,44)]
1860  [(10,-10),(-3,-4)] | [(0,-20),(30,-20)]
1861  [(11,22),(33,44)]  | [(-1000000,200),(300000,-40)]
1862  [(-10,2),(-10,3)]  | [(1,2),(3,4)]
1863  [(-10,2),(-10,3)]  | [(0,0),(6,6)]
1864  [(-10,2),(-10,3)]  | [(10,-10),(-3,-4)]
1865  [(-10,2),(-10,3)]  | [(-1000000,200),(300000,-40)]
1866  [(-10,2),(-10,3)]  | [(11,22),(33,44)]
1867  [(-10,2),(-10,3)]  | [(0,-20),(30,-20)]
1868  [(0,-20),(30,-20)] | [(-1000000,200),(300000,-40)]
1869  [(0,-20),(30,-20)] | [(11,22),(33,44)]
1870 (21 rows)
1872 -- Has points less than or equal to line segment
1873 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s <= l2.s;
1874                s               |               s               
1875 -------------------------------+-------------------------------
1876  [(1,2),(3,4)]                 | [(1,2),(3,4)]
1877  [(1,2),(3,4)]                 | [(0,0),(6,6)]
1878  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]
1879  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)]
1880  [(1,2),(3,4)]                 | [(11,22),(33,44)]
1881  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]
1882  [(0,0),(6,6)]                 | [(0,0),(6,6)]
1883  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]
1884  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)]
1885  [(0,0),(6,6)]                 | [(11,22),(33,44)]
1886  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]
1887  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
1888  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)]
1889  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]
1890  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]
1891  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
1892  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)]
1893  [(11,22),(33,44)]             | [(11,22),(33,44)]
1894  [(-10,2),(-10,3)]             | [(1,2),(3,4)]
1895  [(-10,2),(-10,3)]             | [(0,0),(6,6)]
1896  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]
1897  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)]
1898  [(-10,2),(-10,3)]             | [(11,22),(33,44)]
1899  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
1900  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]
1901  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)]
1902  [(0,-20),(30,-20)]            | [(11,22),(33,44)]
1903  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
1904 (28 rows)
1906 -- Has points equal to line segment
1907 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s = l2.s;
1908                s               |               s               
1909 -------------------------------+-------------------------------
1910  [(1,2),(3,4)]                 | [(1,2),(3,4)]
1911  [(0,0),(6,6)]                 | [(0,0),(6,6)]
1912  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
1913  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
1914  [(11,22),(33,44)]             | [(11,22),(33,44)]
1915  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
1916  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
1917  [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]
1918 (8 rows)
1920 -- Has points greater than or equal to line segment
1921 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s >= l2.s;
1922                s               |               s               
1923 -------------------------------+-------------------------------
1924  [(1,2),(3,4)]                 | [(1,2),(3,4)]
1925  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
1926  [(0,0),(6,6)]                 | [(1,2),(3,4)]
1927  [(0,0),(6,6)]                 | [(0,0),(6,6)]
1928  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
1929  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
1930  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
1931  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
1932  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
1933  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
1934  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
1935  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
1936  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
1937  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
1938  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
1939  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
1940  [(11,22),(33,44)]             | [(1,2),(3,4)]
1941  [(11,22),(33,44)]             | [(0,0),(6,6)]
1942  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
1943  [(11,22),(33,44)]             | [(11,22),(33,44)]
1944  [(11,22),(33,44)]             | [(-10,2),(-10,3)]
1945  [(11,22),(33,44)]             | [(0,-20),(30,-20)]
1946  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
1947  [(0,-20),(30,-20)]            | [(1,2),(3,4)]
1948  [(0,-20),(30,-20)]            | [(0,0),(6,6)]
1949  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
1950  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
1951  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
1952 (28 rows)
1954 -- Has points greater than line segment
1955 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s > l2.s;
1956                s               |         s          
1957 -------------------------------+--------------------
1958  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
1959  [(0,0),(6,6)]                 | [(1,2),(3,4)]
1960  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
1961  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
1962  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
1963  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
1964  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
1965  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
1966  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
1967  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
1968  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
1969  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
1970  [(11,22),(33,44)]             | [(1,2),(3,4)]
1971  [(11,22),(33,44)]             | [(0,0),(6,6)]
1972  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
1973  [(11,22),(33,44)]             | [(-10,2),(-10,3)]
1974  [(11,22),(33,44)]             | [(0,-20),(30,-20)]
1975  [(0,-20),(30,-20)]            | [(1,2),(3,4)]
1976  [(0,-20),(30,-20)]            | [(0,0),(6,6)]
1977  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
1978  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
1979 (21 rows)
1981 -- Has points not equal to line segment
1982 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s != l2.s;
1983                s               |               s               
1984 -------------------------------+-------------------------------
1985  [(1,2),(3,4)]                 | [(0,0),(6,6)]
1986  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]
1987  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)]
1988  [(1,2),(3,4)]                 | [(11,22),(33,44)]
1989  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
1990  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]
1991  [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]
1992  [(0,0),(6,6)]                 | [(1,2),(3,4)]
1993  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]
1994  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)]
1995  [(0,0),(6,6)]                 | [(11,22),(33,44)]
1996  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
1997  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]
1998  [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]
1999  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
2000  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
2001  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)]
2002  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]
2003  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
2004  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]
2005  [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]
2006  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
2007  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
2008  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
2009  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
2010  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
2011  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
2012  [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]
2013  [(11,22),(33,44)]             | [(1,2),(3,4)]
2014  [(11,22),(33,44)]             | [(0,0),(6,6)]
2015  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
2016  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)]
2017  [(11,22),(33,44)]             | [(-10,2),(-10,3)]
2018  [(11,22),(33,44)]             | [(0,-20),(30,-20)]
2019  [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]
2020  [(-10,2),(-10,3)]             | [(1,2),(3,4)]
2021  [(-10,2),(-10,3)]             | [(0,0),(6,6)]
2022  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]
2023  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)]
2024  [(-10,2),(-10,3)]             | [(11,22),(33,44)]
2025  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]
2026  [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]
2027  [(0,-20),(30,-20)]            | [(1,2),(3,4)]
2028  [(0,-20),(30,-20)]            | [(0,0),(6,6)]
2029  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
2030  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)]
2031  [(0,-20),(30,-20)]            | [(11,22),(33,44)]
2032  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
2033  [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]
2034  [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]
2035  [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]
2036  [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]
2037  [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)]
2038  [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]
2039  [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]
2040  [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]
2041 (56 rows)
2043 -- Parallel with line segment
2044 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?|| l2.s;
2045                s               |               s               
2046 -------------------------------+-------------------------------
2047  [(1,2),(3,4)]                 | [(1,2),(3,4)]
2048  [(1,2),(3,4)]                 | [(0,0),(6,6)]
2049  [(1,2),(3,4)]                 | [(11,22),(33,44)]
2050  [(0,0),(6,6)]                 | [(1,2),(3,4)]
2051  [(0,0),(6,6)]                 | [(0,0),(6,6)]
2052  [(0,0),(6,6)]                 | [(11,22),(33,44)]
2053  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
2054  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
2055  [(11,22),(33,44)]             | [(1,2),(3,4)]
2056  [(11,22),(33,44)]             | [(0,0),(6,6)]
2057  [(11,22),(33,44)]             | [(11,22),(33,44)]
2058  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
2059  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
2060 (13 rows)
2062 -- Perpendicular with line segment
2063 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?-| l2.s;
2064          s          |         s          
2065 --------------------+--------------------
2066  [(-10,2),(-10,3)]  | [(0,-20),(30,-20)]
2067  [(0,-20),(30,-20)] | [(-10,2),(-10,3)]
2068 (2 rows)
2070 -- Distance to line
2071 SELECT l.s, l1.s, l.s <-> l1.s AS dist_sl, l1.s <-> l.s AS dist_ls FROM LSEG_TBL l, LINE_TBL l1;
2072                s               |                   s                   |    dist_sl     |    dist_ls     
2073 -------------------------------+---------------------------------------+----------------+----------------
2074  [(1,2),(3,4)]                 | {0,-1,5}                              |              1 |              1
2075  [(0,0),(6,6)]                 | {0,-1,5}                              |              0 |              0
2076  [(10,-10),(-3,-4)]            | {0,-1,5}                              |              9 |              9
2077  [(-1000000,200),(300000,-40)] | {0,-1,5}                              |              0 |              0
2078  [(11,22),(33,44)]             | {0,-1,5}                              |             17 |             17
2079  [(-10,2),(-10,3)]             | {0,-1,5}                              |              2 |              2
2080  [(0,-20),(30,-20)]            | {0,-1,5}                              |             25 |             25
2081  [(NaN,1),(NaN,90)]            | {0,-1,5}                              |            NaN |            NaN
2082  [(1,2),(3,4)]                 | {1,0,5}                               |              6 |              6
2083  [(0,0),(6,6)]                 | {1,0,5}                               |              5 |              5
2084  [(10,-10),(-3,-4)]            | {1,0,5}                               |              2 |              2
2085  [(-1000000,200),(300000,-40)] | {1,0,5}                               |              0 |              0
2086  [(11,22),(33,44)]             | {1,0,5}                               |             16 |             16
2087  [(-10,2),(-10,3)]             | {1,0,5}                               |              5 |              5
2088  [(0,-20),(30,-20)]            | {1,0,5}                               |              5 |              5
2089  [(NaN,1),(NaN,90)]            | {1,0,5}                               |            NaN |            NaN
2090  [(1,2),(3,4)]                 | {0,3,0}                               |              2 |              2
2091  [(0,0),(6,6)]                 | {0,3,0}                               |              0 |              0
2092  [(10,-10),(-3,-4)]            | {0,3,0}                               |              4 |              4
2093  [(-1000000,200),(300000,-40)] | {0,3,0}                               |              0 |              0
2094  [(11,22),(33,44)]             | {0,3,0}                               |             22 |             22
2095  [(-10,2),(-10,3)]             | {0,3,0}                               |              2 |              2
2096  [(0,-20),(30,-20)]            | {0,3,0}                               |             20 |             20
2097  [(NaN,1),(NaN,90)]            | {0,3,0}                               |            NaN |            NaN
2098  [(1,2),(3,4)]                 | {1,-1,0}                              | 0.707106781187 | 0.707106781187
2099  [(0,0),(6,6)]                 | {1,-1,0}                              |              0 |              0
2100  [(10,-10),(-3,-4)]            | {1,-1,0}                              | 0.707106781187 | 0.707106781187
2101  [(-1000000,200),(300000,-40)] | {1,-1,0}                              |              0 |              0
2102  [(11,22),(33,44)]             | {1,-1,0}                              |  7.77817459305 |  7.77817459305
2103  [(-10,2),(-10,3)]             | {1,-1,0}                              |  8.48528137424 |  8.48528137424
2104  [(0,-20),(30,-20)]            | {1,-1,0}                              |  14.1421356237 |  14.1421356237
2105  [(NaN,1),(NaN,90)]            | {1,-1,0}                              |            NaN |            NaN
2106  [(1,2),(3,4)]                 | {-0.4,-1,-6}                          |  7.79920420344 |  7.79920420344
2107  [(0,0),(6,6)]                 | {-0.4,-1,-6}                          |  5.57086014531 |  5.57086014531
2108  [(10,-10),(-3,-4)]            | {-0.4,-1,-6}                          |              0 |              0
2109  [(-1000000,200),(300000,-40)] | {-0.4,-1,-6}                          |              0 |              0
2110  [(11,22),(33,44)]             | {-0.4,-1,-6}                          |  30.0826447847 |  30.0826447847
2111  [(-10,2),(-10,3)]             | {-0.4,-1,-6}                          |  3.71390676354 |  3.71390676354
2112  [(0,-20),(30,-20)]            | {-0.4,-1,-6}                          |  1.85695338177 |  1.85695338177
2113  [(NaN,1),(NaN,90)]            | {-0.4,-1,-6}                          |            NaN |            NaN
2114  [(1,2),(3,4)]                 | {-0.000184615384615,-1,15.3846153846} |  11.3840613445 |  11.3840613445
2115  [(0,0),(6,6)]                 | {-0.000184615384615,-1,15.3846153846} |   9.3835075324 |   9.3835075324
2116  [(10,-10),(-3,-4)]            | {-0.000184615384615,-1,15.3846153846} |  19.3851689004 |  19.3851689004
2117  [(-1000000,200),(300000,-40)] | {-0.000184615384615,-1,15.3846153846} |              0 |              0
2118  [(11,22),(33,44)]             | {-0.000184615384615,-1,15.3846153846} |  6.61741527185 |  6.61741527185
2119  [(-10,2),(-10,3)]             | {-0.000184615384615,-1,15.3846153846} |  12.3864613274 |  12.3864613274
2120  [(0,-20),(30,-20)]            | {-0.000184615384615,-1,15.3846153846} |  35.3790763202 |  35.3790763202
2121  [(NaN,1),(NaN,90)]            | {-0.000184615384615,-1,15.3846153846} |            NaN |            NaN
2122  [(1,2),(3,4)]                 | {3,NaN,5}                             |            NaN |            NaN
2123  [(0,0),(6,6)]                 | {3,NaN,5}                             |            NaN |            NaN
2124  [(10,-10),(-3,-4)]            | {3,NaN,5}                             |            NaN |            NaN
2125  [(-1000000,200),(300000,-40)] | {3,NaN,5}                             |            NaN |            NaN
2126  [(11,22),(33,44)]             | {3,NaN,5}                             |            NaN |            NaN
2127  [(-10,2),(-10,3)]             | {3,NaN,5}                             |            NaN |            NaN
2128  [(0,-20),(30,-20)]            | {3,NaN,5}                             |            NaN |            NaN
2129  [(NaN,1),(NaN,90)]            | {3,NaN,5}                             |            NaN |            NaN
2130  [(1,2),(3,4)]                 | {NaN,NaN,NaN}                         |            NaN |            NaN
2131  [(0,0),(6,6)]                 | {NaN,NaN,NaN}                         |            NaN |            NaN
2132  [(10,-10),(-3,-4)]            | {NaN,NaN,NaN}                         |            NaN |            NaN
2133  [(-1000000,200),(300000,-40)] | {NaN,NaN,NaN}                         |            NaN |            NaN
2134  [(11,22),(33,44)]             | {NaN,NaN,NaN}                         |            NaN |            NaN
2135  [(-10,2),(-10,3)]             | {NaN,NaN,NaN}                         |            NaN |            NaN
2136  [(0,-20),(30,-20)]            | {NaN,NaN,NaN}                         |            NaN |            NaN
2137  [(NaN,1),(NaN,90)]            | {NaN,NaN,NaN}                         |            NaN |            NaN
2138  [(1,2),(3,4)]                 | {0,-1,3}                              |              0 |              0
2139  [(0,0),(6,6)]                 | {0,-1,3}                              |              0 |              0
2140  [(10,-10),(-3,-4)]            | {0,-1,3}                              |              7 |              7
2141  [(-1000000,200),(300000,-40)] | {0,-1,3}                              |              0 |              0
2142  [(11,22),(33,44)]             | {0,-1,3}                              |             19 |             19
2143  [(-10,2),(-10,3)]             | {0,-1,3}                              |              0 |              0
2144  [(0,-20),(30,-20)]            | {0,-1,3}                              |             23 |             23
2145  [(NaN,1),(NaN,90)]            | {0,-1,3}                              |            NaN |            NaN
2146  [(1,2),(3,4)]                 | {-1,0,3}                              |              0 |              0
2147  [(0,0),(6,6)]                 | {-1,0,3}                              |              0 |              0
2148  [(10,-10),(-3,-4)]            | {-1,0,3}                              |              0 |              0
2149  [(-1000000,200),(300000,-40)] | {-1,0,3}                              |              0 |              0
2150  [(11,22),(33,44)]             | {-1,0,3}                              |              8 |              8
2151  [(-10,2),(-10,3)]             | {-1,0,3}                              |             13 |             13
2152  [(0,-20),(30,-20)]            | {-1,0,3}                              |              0 |              0
2153  [(NaN,1),(NaN,90)]            | {-1,0,3}                              |            NaN |            NaN
2154 (80 rows)
2156 -- Distance to line segment
2157 SELECT l1.s, l2.s, l1.s <-> l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
2158                s               |               s               |    ?column?    
2159 -------------------------------+-------------------------------+----------------
2160  [(1,2),(3,4)]                 | [(1,2),(3,4)]                 |              0
2161  [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 0.707106781187
2162  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            |  7.12398901685
2163  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] |  11.3840613445
2164  [(1,2),(3,4)]                 | [(11,22),(33,44)]             |  19.6977156036
2165  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             |             11
2166  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            |             22
2167  [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            |            NaN
2168  [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 0.707106781187
2169  [(0,0),(6,6)]                 | [(0,0),(6,6)]                 |              0
2170  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            |  4.88901207039
2171  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] |   9.3835075324
2172  [(0,0),(6,6)]                 | [(11,22),(33,44)]             |  16.7630546142
2173  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             |  10.1980390272
2174  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            |             20
2175  [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            |            NaN
2176  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 |  7.12398901685
2177  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 |  4.88901207039
2178  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            |              0
2179  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] |  19.3851689004
2180  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             |  29.4737584815
2181  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             |  9.21954445729
2182  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            |             10
2183  [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            |            NaN
2184  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 |  11.3840613445
2185  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 |   9.3835075324
2186  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            |  19.3851689004
2187  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] |              0
2188  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             |  6.61741527185
2189  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             |  12.3864613274
2190  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            |  35.3790763202
2191  [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            |            NaN
2192  [(11,22),(33,44)]             | [(1,2),(3,4)]                 |  19.6977156036
2193  [(11,22),(33,44)]             | [(0,0),(6,6)]                 |  16.7630546142
2194  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            |  29.4737584815
2195  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] |  6.61741527185
2196  [(11,22),(33,44)]             | [(11,22),(33,44)]             |              0
2197  [(11,22),(33,44)]             | [(-10,2),(-10,3)]             |   28.319604517
2198  [(11,22),(33,44)]             | [(0,-20),(30,-20)]            |             42
2199  [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            |            NaN
2200  [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 |             11
2201  [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 |  10.1980390272
2202  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            |  9.21954445729
2203  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] |  12.3864613274
2204  [(-10,2),(-10,3)]             | [(11,22),(33,44)]             |   28.319604517
2205  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             |              0
2206  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            |  24.1660919472
2207  [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            |            NaN
2208  [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 |             22
2209  [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 |             20
2210  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            |             10
2211  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] |  35.3790763202
2212  [(0,-20),(30,-20)]            | [(11,22),(33,44)]             |             42
2213  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             |  24.1660919472
2214  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            |              0
2215  [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            |            NaN
2216  [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 |            NaN
2217  [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 |            NaN
2218  [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            |            NaN
2219  [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] |            NaN
2220  [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             |            NaN
2221  [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             |            NaN
2222  [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            |            NaN
2223  [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            |            NaN
2224 (64 rows)
2226 -- Distance to box
2227 SELECT l.s, b.f1, l.s <-> b.f1 AS dist_sb, b.f1 <-> l.s AS dist_bs FROM LSEG_TBL l, BOX_TBL b;
2228                s               |         f1          |    dist_sb     |    dist_bs     
2229 -------------------------------+---------------------+----------------+----------------
2230  [(1,2),(3,4)]                 | (2,2),(0,0)         |              0 |              0
2231  [(1,2),(3,4)]                 | (3,3),(1,1)         |              0 |              0
2232  [(1,2),(3,4)]                 | (-2,2),(-8,-10)     |              3 |              3
2233  [(1,2),(3,4)]                 | (2.5,3.5),(2.5,2.5) |              0 |              0
2234  [(1,2),(3,4)]                 | (3,3),(3,3)         | 0.707106781187 | 0.707106781187
2235  [(0,0),(6,6)]                 | (2,2),(0,0)         |              0 |              0
2236  [(0,0),(6,6)]                 | (3,3),(1,1)         |              0 |              0
2237  [(0,0),(6,6)]                 | (-2,2),(-8,-10)     |              2 |              2
2238  [(0,0),(6,6)]                 | (2.5,3.5),(2.5,2.5) |              0 |              0
2239  [(0,0),(6,6)]                 | (3,3),(3,3)         |              0 |              0
2240  [(10,-10),(-3,-4)]            | (2,2),(0,0)         |  4.88901207039 |  4.88901207039
2241  [(10,-10),(-3,-4)]            | (3,3),(1,1)         |  6.21602963235 |  6.21602963235
2242  [(10,-10),(-3,-4)]            | (-2,2),(-8,-10)     |              0 |              0
2243  [(10,-10),(-3,-4)]            | (2.5,3.5),(2.5,2.5) |  8.20655597529 |  8.20655597529
2244  [(10,-10),(-3,-4)]            | (3,3),(3,3)         |  8.87006475627 |  8.87006475627
2245  [(-1000000,200),(300000,-40)] | (2,2),(0,0)         |  13.3842459258 |  13.3842459258
2246  [(-1000000,200),(300000,-40)] | (3,3),(1,1)         |  12.3840613274 |  12.3840613274
2247  [(-1000000,200),(300000,-40)] | (-2,2),(-8,-10)     |  13.3849843873 |  13.3849843873
2248  [(-1000000,200),(300000,-40)] | (2.5,3.5),(2.5,2.5) |  11.8841536436 |  11.8841536436
2249  [(-1000000,200),(300000,-40)] | (3,3),(3,3)         |  12.3840613274 |  12.3840613274
2250  [(11,22),(33,44)]             | (2,2),(0,0)         |  21.9317121995 |  21.9317121995
2251  [(11,22),(33,44)]             | (3,3),(1,1)         |  20.6155281281 |  20.6155281281
2252  [(11,22),(33,44)]             | (-2,2),(-8,-10)     |  23.8537208838 |  23.8537208838
2253  [(11,22),(33,44)]             | (2.5,3.5),(2.5,2.5) |  20.3592730715 |  20.3592730715
2254  [(11,22),(33,44)]             | (3,3),(3,3)         |  20.6155281281 |  20.6155281281
2255  [(-10,2),(-10,3)]             | (2,2),(0,0)         |             10 |             10
2256  [(-10,2),(-10,3)]             | (3,3),(1,1)         |             11 |             11
2257  [(-10,2),(-10,3)]             | (-2,2),(-8,-10)     |              2 |              2
2258  [(-10,2),(-10,3)]             | (2.5,3.5),(2.5,2.5) |           12.5 |           12.5
2259  [(-10,2),(-10,3)]             | (3,3),(3,3)         |             13 |             13
2260  [(0,-20),(30,-20)]            | (2,2),(0,0)         |             20 |             20
2261  [(0,-20),(30,-20)]            | (3,3),(1,1)         |             21 |             21
2262  [(0,-20),(30,-20)]            | (-2,2),(-8,-10)     |  10.1980390272 |  10.1980390272
2263  [(0,-20),(30,-20)]            | (2.5,3.5),(2.5,2.5) |           22.5 |           22.5
2264  [(0,-20),(30,-20)]            | (3,3),(3,3)         |             23 |             23
2265  [(NaN,1),(NaN,90)]            | (2,2),(0,0)         |            NaN |            NaN
2266  [(NaN,1),(NaN,90)]            | (3,3),(1,1)         |            NaN |            NaN
2267  [(NaN,1),(NaN,90)]            | (-2,2),(-8,-10)     |            NaN |            NaN
2268  [(NaN,1),(NaN,90)]            | (2.5,3.5),(2.5,2.5) |            NaN |            NaN
2269  [(NaN,1),(NaN,90)]            | (3,3),(3,3)         |            NaN |            NaN
2270 (40 rows)
2272 -- Intersect with line segment
2273 SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s ?# l1.s;
2274                s               |      s       
2275 -------------------------------+--------------
2276  [(0,0),(6,6)]                 | {0,-1,5}
2277  [(-1000000,200),(300000,-40)] | {0,-1,5}
2278  [(-1000000,200),(300000,-40)] | {1,0,5}
2279  [(0,0),(6,6)]                 | {0,3,0}
2280  [(-1000000,200),(300000,-40)] | {0,3,0}
2281  [(-1000000,200),(300000,-40)] | {1,-1,0}
2282  [(10,-10),(-3,-4)]            | {-0.4,-1,-6}
2283  [(-1000000,200),(300000,-40)] | {-0.4,-1,-6}
2284  [(1,2),(3,4)]                 | {0,-1,3}
2285  [(0,0),(6,6)]                 | {0,-1,3}
2286  [(-1000000,200),(300000,-40)] | {0,-1,3}
2287  [(-10,2),(-10,3)]             | {0,-1,3}
2288  [(1,2),(3,4)]                 | {-1,0,3}
2289  [(0,0),(6,6)]                 | {-1,0,3}
2290  [(10,-10),(-3,-4)]            | {-1,0,3}
2291  [(-1000000,200),(300000,-40)] | {-1,0,3}
2292  [(0,-20),(30,-20)]            | {-1,0,3}
2293 (17 rows)
2295 -- Intersect with box
2296 SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
2297          s          |         f1          
2298 --------------------+---------------------
2299  [(1,2),(3,4)]      | (2,2),(0,0)
2300  [(1,2),(3,4)]      | (3,3),(1,1)
2301  [(1,2),(3,4)]      | (2.5,3.5),(2.5,2.5)
2302  [(0,0),(6,6)]      | (2,2),(0,0)
2303  [(0,0),(6,6)]      | (3,3),(1,1)
2304  [(0,0),(6,6)]      | (2.5,3.5),(2.5,2.5)
2305  [(0,0),(6,6)]      | (3,3),(3,3)
2306  [(10,-10),(-3,-4)] | (-2,2),(-8,-10)
2307 (8 rows)
2309 -- Intersection point with line segment
2310 SELECT l1.s, l2.s, l1.s # l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
2311                s               |               s               | ?column? 
2312 -------------------------------+-------------------------------+----------
2313  [(1,2),(3,4)]                 | [(1,2),(3,4)]                 | 
2314  [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 
2315  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            | 
2316  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] | 
2317  [(1,2),(3,4)]                 | [(11,22),(33,44)]             | 
2318  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             | 
2319  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            | 
2320  [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            | 
2321  [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 
2322  [(0,0),(6,6)]                 | [(0,0),(6,6)]                 | 
2323  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            | 
2324  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] | 
2325  [(0,0),(6,6)]                 | [(11,22),(33,44)]             | 
2326  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             | 
2327  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            | 
2328  [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            | 
2329  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 | 
2330  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 | 
2331  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            | 
2332  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] | 
2333  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             | 
2334  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             | 
2335  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            | 
2336  [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            | 
2337  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 | 
2338  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 | 
2339  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            | 
2340  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] | 
2341  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             | 
2342  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             | 
2343  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            | 
2344  [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            | 
2345  [(11,22),(33,44)]             | [(1,2),(3,4)]                 | 
2346  [(11,22),(33,44)]             | [(0,0),(6,6)]                 | 
2347  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            | 
2348  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] | 
2349  [(11,22),(33,44)]             | [(11,22),(33,44)]             | 
2350  [(11,22),(33,44)]             | [(-10,2),(-10,3)]             | 
2351  [(11,22),(33,44)]             | [(0,-20),(30,-20)]            | 
2352  [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            | 
2353  [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 | 
2354  [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 | 
2355  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            | 
2356  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] | 
2357  [(-10,2),(-10,3)]             | [(11,22),(33,44)]             | 
2358  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             | 
2359  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            | 
2360  [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            | 
2361  [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 | 
2362  [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 | 
2363  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            | 
2364  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] | 
2365  [(0,-20),(30,-20)]            | [(11,22),(33,44)]             | 
2366  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             | 
2367  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            | 
2368  [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            | 
2369  [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 | 
2370  [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 | 
2371  [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            | 
2372  [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] | 
2373  [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             | 
2374  [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             | 
2375  [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            | 
2376  [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            | 
2377 (64 rows)
2379 -- Closest point to line
2380 SELECT l.s, l1.s, l.s ## l1.s FROM LSEG_TBL l, LINE_TBL l1;
2381 ERROR:  function "close_sl" not implemented
2382 -- Closest point to line segment
2383 SELECT l1.s, l2.s, l1.s ## l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
2384                s               |               s               |            ?column?             
2385 -------------------------------+-------------------------------+---------------------------------
2386  [(1,2),(3,4)]                 | [(1,2),(3,4)]                 | 
2387  [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 
2388  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            | (-1.98536585366,-4.46829268293)
2389  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] | (3.00210167283,15.3840611505)
2390  [(1,2),(3,4)]                 | [(11,22),(33,44)]             | 
2391  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             | (-10,2)
2392  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            | (1,-20)
2393  [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            | 
2394  [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 
2395  [(0,0),(6,6)]                 | [(0,0),(6,6)]                 | 
2396  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
2397  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] | (6.00173233982,15.3835073725)
2398  [(0,0),(6,6)]                 | [(11,22),(33,44)]             | 
2399  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             | (-10,2)
2400  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            | (0,-20)
2401  [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            | 
2402  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 | (1,2)
2403  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 | (0,0)
2404  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            | 
2405  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] | (-2.99642119965,15.3851685701)
2406  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             | (11,22)
2407  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             | (-10,2)
2408  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            | (10,-20)
2409  [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            | 
2410  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 | (3,4)
2411  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 | (6,6)
2412  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            | (-3,-4)
2413  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] | 
2414  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             | (11,22)
2415  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             | (-10,3)
2416  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            | (30,-20)
2417  [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            | 
2418  [(11,22),(33,44)]             | [(1,2),(3,4)]                 | 
2419  [(11,22),(33,44)]             | [(0,0),(6,6)]                 | 
2420  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            | (-1.3512195122,-4.76097560976)
2421  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] | (10.9987783234,15.3825848409)
2422  [(11,22),(33,44)]             | [(11,22),(33,44)]             | 
2423  [(11,22),(33,44)]             | [(-10,2),(-10,3)]             | (-10,3)
2424  [(11,22),(33,44)]             | [(0,-20),(30,-20)]            | (11,-20)
2425  [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            | 
2426  [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 | (1,2)
2427  [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 | (0,0)
2428  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            | (-3,-4)
2429  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] | (-9.99771326872,15.3864611163)
2430  [(-10,2),(-10,3)]             | [(11,22),(33,44)]             | (11,22)
2431  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             | 
2432  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            | (0,-20)
2433  [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            | 
2434  [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 | (1,2)
2435  [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 | (0,0)
2436  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            | (10,-10)
2437  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] | (30.0065315217,15.3790757173)
2438  [(0,-20),(30,-20)]            | [(11,22),(33,44)]             | (11,22)
2439  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             | (-10,2)
2440  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            | 
2441  [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            | 
2442  [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 | 
2443  [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 | 
2444  [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            | 
2445  [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] | 
2446  [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             | 
2447  [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             | 
2448  [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            | 
2449  [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            | 
2450 (64 rows)
2452 -- Closest point to box
2453 SELECT l.s, b.f1, l.s ## b.f1 FROM LSEG_TBL l, BOX_TBL b;
2454                s               |         f1          |  ?column?   
2455 -------------------------------+---------------------+-------------
2456  [(1,2),(3,4)]                 | (2,2),(0,0)         | (1,2)
2457  [(1,2),(3,4)]                 | (3,3),(1,1)         | (1.5,2.5)
2458  [(1,2),(3,4)]                 | (-2,2),(-8,-10)     | (-2,2)
2459  [(1,2),(3,4)]                 | (2.5,3.5),(2.5,2.5) | (2.25,3.25)
2460  [(1,2),(3,4)]                 | (3,3),(3,3)         | (3,3)
2461  [(0,0),(6,6)]                 | (2,2),(0,0)         | (1,1)
2462  [(0,0),(6,6)]                 | (3,3),(1,1)         | (2,2)
2463  [(0,0),(6,6)]                 | (-2,2),(-8,-10)     | (-2,0)
2464  [(0,0),(6,6)]                 | (2.5,3.5),(2.5,2.5) | (2.75,2.75)
2465  [(0,0),(6,6)]                 | (3,3),(3,3)         | (3,3)
2466  [(10,-10),(-3,-4)]            | (2,2),(0,0)         | (0,0)
2467  [(10,-10),(-3,-4)]            | (3,3),(1,1)         | (1,1)
2468  [(10,-10),(-3,-4)]            | (-2,2),(-8,-10)     | (-3,-4)
2469  [(10,-10),(-3,-4)]            | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
2470  [(10,-10),(-3,-4)]            | (3,3),(3,3)         | (3,3)
2471  [(-1000000,200),(300000,-40)] | (2,2),(0,0)         | (2,2)
2472  [(-1000000,200),(300000,-40)] | (3,3),(1,1)         | (3,3)
2473  [(-1000000,200),(300000,-40)] | (-2,2),(-8,-10)     | (-2,2)
2474  [(-1000000,200),(300000,-40)] | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
2475  [(-1000000,200),(300000,-40)] | (3,3),(3,3)         | (3,3)
2476  [(11,22),(33,44)]             | (2,2),(0,0)         | (2,2)
2477  [(11,22),(33,44)]             | (3,3),(1,1)         | (3,3)
2478  [(11,22),(33,44)]             | (-2,2),(-8,-10)     | (-2,2)
2479  [(11,22),(33,44)]             | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
2480  [(11,22),(33,44)]             | (3,3),(3,3)         | (3,3)
2481  [(-10,2),(-10,3)]             | (2,2),(0,0)         | (0,2)
2482  [(-10,2),(-10,3)]             | (3,3),(1,1)         | (1,2)
2483  [(-10,2),(-10,3)]             | (-2,2),(-8,-10)     | (-8,2)
2484  [(-10,2),(-10,3)]             | (2.5,3.5),(2.5,2.5) | (2.5,3)
2485  [(-10,2),(-10,3)]             | (3,3),(3,3)         | (3,3)
2486  [(0,-20),(30,-20)]            | (2,2),(0,0)         | (0,0)
2487  [(0,-20),(30,-20)]            | (3,3),(1,1)         | (1,1)
2488  [(0,-20),(30,-20)]            | (-2,2),(-8,-10)     | (-2,-10)
2489  [(0,-20),(30,-20)]            | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
2490  [(0,-20),(30,-20)]            | (3,3),(3,3)         | (3,3)
2491  [(NaN,1),(NaN,90)]            | (2,2),(0,0)         | 
2492  [(NaN,1),(NaN,90)]            | (3,3),(1,1)         | 
2493  [(NaN,1),(NaN,90)]            | (-2,2),(-8,-10)     | 
2494  [(NaN,1),(NaN,90)]            | (2.5,3.5),(2.5,2.5) | 
2495  [(NaN,1),(NaN,90)]            | (3,3),(3,3)         | 
2496 (40 rows)
2498 -- On line
2499 SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s <@ l1.s;
2500                s               |                   s                   
2501 -------------------------------+---------------------------------------
2502  [(0,0),(6,6)]                 | {1,-1,0}
2503  [(-1000000,200),(300000,-40)] | {-0.000184615384615,-1,15.3846153846}
2504 (2 rows)
2506 -- On box
2507 SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s <@ b.f1;
2508  s | f1 
2509 ---+----
2510 (0 rows)
2513 -- Boxes
2515 SELECT box(f1) AS box FROM CIRCLE_TBL;
2516                               box                               
2517 ----------------------------------------------------------------
2518  (7.12132034356,3.12132034356),(2.87867965644,-1.12132034356)
2519  (71.7106781187,72.7106781187),(-69.7106781187,-68.7106781187)
2520  (4.53553390593,6.53553390593),(-2.53553390593,-0.535533905933)
2521  (3.12132034356,4.12132034356),(-1.12132034356,-0.12132034356)
2522  (107.071067812,207.071067812),(92.9289321881,192.928932188)
2523  (181.317279836,82.3172798365),(18.6827201635,-80.3172798365)
2524  (3,5),(3,5)
2525  (NaN,NaN),(NaN,NaN)
2526 (8 rows)
2528 -- translation
2529 SELECT b.f1 + p.f1 AS translation
2530    FROM BOX_TBL b, POINT_TBL p;
2531              translation             
2532 -------------------------------------
2533  (2,2),(0,0)
2534  (3,3),(1,1)
2535  (-2,2),(-8,-10)
2536  (2.5,3.5),(2.5,2.5)
2537  (3,3),(3,3)
2538  (-8,2),(-10,0)
2539  (-7,3),(-9,1)
2540  (-12,2),(-18,-10)
2541  (-7.5,3.5),(-7.5,2.5)
2542  (-7,3),(-7,3)
2543  (-1,6),(-3,4)
2544  (0,7),(-2,5)
2545  (-5,6),(-11,-6)
2546  (-0.5,7.5),(-0.5,6.5)
2547  (0,7),(0,7)
2548  (7.1,36.5),(5.1,34.5)
2549  (8.1,37.5),(6.1,35.5)
2550  (3.1,36.5),(-2.9,24.5)
2551  (7.6,38),(7.6,37)
2552  (8.1,37.5),(8.1,37.5)
2553  (-3,-10),(-5,-12)
2554  (-2,-9),(-4,-11)
2555  (-7,-10),(-13,-22)
2556  (-2.5,-8.5),(-2.5,-9.5)
2557  (-2,-9),(-2,-9)
2558  (2,2),(1e-300,-1e-300)
2559  (3,3),(1,1)
2560  (-2,2),(-8,-10)
2561  (2.5,3.5),(2.5,2.5)
2562  (3,3),(3,3)
2563  (1e+300,Infinity),(1e+300,Infinity)
2564  (1e+300,Infinity),(1e+300,Infinity)
2565  (1e+300,Infinity),(1e+300,Infinity)
2566  (1e+300,Infinity),(1e+300,Infinity)
2567  (1e+300,Infinity),(1e+300,Infinity)
2568  (Infinity,1e+300),(Infinity,1e+300)
2569  (Infinity,1e+300),(Infinity,1e+300)
2570  (Infinity,1e+300),(Infinity,1e+300)
2571  (Infinity,1e+300),(Infinity,1e+300)
2572  (Infinity,1e+300),(Infinity,1e+300)
2573  (NaN,NaN),(NaN,NaN)
2574  (NaN,NaN),(NaN,NaN)
2575  (NaN,NaN),(NaN,NaN)
2576  (NaN,NaN),(NaN,NaN)
2577  (NaN,NaN),(NaN,NaN)
2578  (12,12),(10,10)
2579  (13,13),(11,11)
2580  (8,12),(2,0)
2581  (12.5,13.5),(12.5,12.5)
2582  (13,13),(13,13)
2583 (50 rows)
2585 SELECT b.f1 - p.f1 AS translation
2586    FROM BOX_TBL b, POINT_TBL p;
2587                translation               
2588 -----------------------------------------
2589  (2,2),(0,0)
2590  (3,3),(1,1)
2591  (-2,2),(-8,-10)
2592  (2.5,3.5),(2.5,2.5)
2593  (3,3),(3,3)
2594  (12,2),(10,0)
2595  (13,3),(11,1)
2596  (8,2),(2,-10)
2597  (12.5,3.5),(12.5,2.5)
2598  (13,3),(13,3)
2599  (5,-2),(3,-4)
2600  (6,-1),(4,-3)
2601  (1,-2),(-5,-14)
2602  (5.5,-0.5),(5.5,-1.5)
2603  (6,-1),(6,-1)
2604  (-3.1,-32.5),(-5.1,-34.5)
2605  (-2.1,-31.5),(-4.1,-33.5)
2606  (-7.1,-32.5),(-13.1,-44.5)
2607  (-2.6,-31),(-2.6,-32)
2608  (-2.1,-31.5),(-2.1,-31.5)
2609  (7,14),(5,12)
2610  (8,15),(6,13)
2611  (3,14),(-3,2)
2612  (7.5,15.5),(7.5,14.5)
2613  (8,15),(8,15)
2614  (2,2),(-1e-300,1e-300)
2615  (3,3),(1,1)
2616  (-2,2),(-8,-10)
2617  (2.5,3.5),(2.5,2.5)
2618  (3,3),(3,3)
2619  (-1e+300,-Infinity),(-1e+300,-Infinity)
2620  (-1e+300,-Infinity),(-1e+300,-Infinity)
2621  (-1e+300,-Infinity),(-1e+300,-Infinity)
2622  (-1e+300,-Infinity),(-1e+300,-Infinity)
2623  (-1e+300,-Infinity),(-1e+300,-Infinity)
2624  (-Infinity,-1e+300),(-Infinity,-1e+300)
2625  (-Infinity,-1e+300),(-Infinity,-1e+300)
2626  (-Infinity,-1e+300),(-Infinity,-1e+300)
2627  (-Infinity,-1e+300),(-Infinity,-1e+300)
2628  (-Infinity,-1e+300),(-Infinity,-1e+300)
2629  (NaN,NaN),(NaN,NaN)
2630  (NaN,NaN),(NaN,NaN)
2631  (NaN,NaN),(NaN,NaN)
2632  (NaN,NaN),(NaN,NaN)
2633  (NaN,NaN),(NaN,NaN)
2634  (-8,-8),(-10,-10)
2635  (-7,-7),(-9,-9)
2636  (-12,-8),(-18,-20)
2637  (-7.5,-6.5),(-7.5,-7.5)
2638  (-7,-7),(-7,-7)
2639 (50 rows)
2641 -- Multiply with point
2642 SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
2643          f1          |     f1     |          ?column?           
2644 ---------------------+------------+-----------------------------
2645  (2,2),(0,0)         | (5.1,34.5) | (0,79.2),(-58.8,0)
2646  (2,2),(0,0)         | (10,10)    | (0,40),(0,0)
2647  (3,3),(1,1)         | (5.1,34.5) | (-29.4,118.8),(-88.2,39.6)
2648  (3,3),(1,1)         | (10,10)    | (0,60),(0,20)
2649  (-2,2),(-8,-10)     | (5.1,34.5) | (304.2,-58.8),(-79.2,-327)
2650  (-2,2),(-8,-10)     | (10,10)    | (20,0),(-40,-180)
2651  (2.5,3.5),(2.5,2.5) | (5.1,34.5) | (-73.5,104.1),(-108,99)
2652  (2.5,3.5),(2.5,2.5) | (10,10)    | (0,60),(-10,50)
2653  (3,3),(3,3)         | (5.1,34.5) | (-88.2,118.8),(-88.2,118.8)
2654  (3,3),(3,3)         | (10,10)    | (0,60),(0,60)
2655 (10 rows)
2657 -- Overflow error
2658 SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] > 1000;
2659          f1          |        f1         |                  ?column?                  
2660 ---------------------+-------------------+--------------------------------------------
2661  (2,2),(0,0)         | (1e+300,Infinity) | (NaN,NaN),(-Infinity,Infinity)
2662  (2,2),(0,0)         | (Infinity,1e+300) | (NaN,NaN),(Infinity,Infinity)
2663  (2,2),(0,0)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2664  (3,3),(1,1)         | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
2665  (3,3),(1,1)         | (Infinity,1e+300) | (Infinity,Infinity),(Infinity,Infinity)
2666  (3,3),(1,1)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2667  (-2,2),(-8,-10)     | (1e+300,Infinity) | (Infinity,-Infinity),(-Infinity,-Infinity)
2668  (-2,2),(-8,-10)     | (Infinity,1e+300) | (-Infinity,Infinity),(-Infinity,-Infinity)
2669  (-2,2),(-8,-10)     | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2670  (2.5,3.5),(2.5,2.5) | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
2671  (2.5,3.5),(2.5,2.5) | (Infinity,1e+300) | (Infinity,Infinity),(Infinity,Infinity)
2672  (2.5,3.5),(2.5,2.5) | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2673  (3,3),(3,3)         | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
2674  (3,3),(3,3)         | (Infinity,1e+300) | (Infinity,Infinity),(Infinity,Infinity)
2675  (3,3),(3,3)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2676 (15 rows)
2678 -- Divide by point
2679 SELECT b.f1, p.f1, b.f1 / p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
2680          f1          |     f1     |                               ?column?                               
2681 ---------------------+------------+----------------------------------------------------------------------
2682  (2,2),(0,0)         | (5.1,34.5) | (0.0651176557644,0),(0,-0.0483449262493)
2683  (2,2),(0,0)         | (10,10)    | (0.2,0),(0,0)
2684  (3,3),(1,1)         | (5.1,34.5) | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374)
2685  (3,3),(1,1)         | (10,10)    | (0.3,0),(0.1,0)
2686  (-2,2),(-8,-10)     | (5.1,34.5) | (0.0483449262493,0.18499334024),(-0.317201914064,0.0651176557644)
2687  (-2,2),(-8,-10)     | (10,10)    | (0,0.2),(-0.9,-0.1)
2688  (2.5,3.5),(2.5,2.5) | (5.1,34.5) | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117)
2689  (2.5,3.5),(2.5,2.5) | (10,10)    | (0.3,0.05),(0.25,0)
2690  (3,3),(3,3)         | (5.1,34.5) | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374)
2691  (3,3),(3,3)         | (10,10)    | (0.3,0),(0.3,0)
2692 (10 rows)
2694 -- To box
2695 SELECT f1::box
2696         FROM POINT_TBL;
2697                  f1                  
2698 -------------------------------------
2699  (0,0),(0,0)
2700  (-10,0),(-10,0)
2701  (-3,4),(-3,4)
2702  (5.1,34.5),(5.1,34.5)
2703  (-5,-12),(-5,-12)
2704  (1e-300,-1e-300),(1e-300,-1e-300)
2705  (1e+300,Infinity),(1e+300,Infinity)
2706  (Infinity,1e+300),(Infinity,1e+300)
2707  (NaN,NaN),(NaN,NaN)
2708  (10,10),(10,10)
2709 (10 rows)
2711 SELECT bound_box(a.f1, b.f1)
2712         FROM BOX_TBL a, BOX_TBL b;
2713       bound_box      
2714 ---------------------
2715  (2,2),(0,0)
2716  (3,3),(0,0)
2717  (2,2),(-8,-10)
2718  (2.5,3.5),(0,0)
2719  (3,3),(0,0)
2720  (3,3),(0,0)
2721  (3,3),(1,1)
2722  (3,3),(-8,-10)
2723  (3,3.5),(1,1)
2724  (3,3),(1,1)
2725  (2,2),(-8,-10)
2726  (3,3),(-8,-10)
2727  (-2,2),(-8,-10)
2728  (2.5,3.5),(-8,-10)
2729  (3,3),(-8,-10)
2730  (2.5,3.5),(0,0)
2731  (3,3.5),(1,1)
2732  (2.5,3.5),(-8,-10)
2733  (2.5,3.5),(2.5,2.5)
2734  (3,3.5),(2.5,2.5)
2735  (3,3),(0,0)
2736  (3,3),(1,1)
2737  (3,3),(-8,-10)
2738  (3,3.5),(2.5,2.5)
2739  (3,3),(3,3)
2740 (25 rows)
2742 -- Below box
2743 SELECT b1.f1, b2.f1, b1.f1 <^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
2744          f1          |         f1          | ?column? 
2745 ---------------------+---------------------+----------
2746  (2,2),(0,0)         | (2,2),(0,0)         | f
2747  (2,2),(0,0)         | (3,3),(1,1)         | f
2748  (2,2),(0,0)         | (-2,2),(-8,-10)     | f
2749  (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | t
2750  (2,2),(0,0)         | (3,3),(3,3)         | t
2751  (3,3),(1,1)         | (2,2),(0,0)         | f
2752  (3,3),(1,1)         | (3,3),(1,1)         | f
2753  (3,3),(1,1)         | (-2,2),(-8,-10)     | f
2754  (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | f
2755  (3,3),(1,1)         | (3,3),(3,3)         | t
2756  (-2,2),(-8,-10)     | (2,2),(0,0)         | f
2757  (-2,2),(-8,-10)     | (3,3),(1,1)         | f
2758  (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | f
2759  (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | t
2760  (-2,2),(-8,-10)     | (3,3),(3,3)         | t
2761  (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | f
2762  (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | f
2763  (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | f
2764  (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | f
2765  (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | f
2766  (3,3),(3,3)         | (2,2),(0,0)         | f
2767  (3,3),(3,3)         | (3,3),(1,1)         | f
2768  (3,3),(3,3)         | (-2,2),(-8,-10)     | f
2769  (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | f
2770  (3,3),(3,3)         | (3,3),(3,3)         | t
2771 (25 rows)
2773 -- Above box
2774 SELECT b1.f1, b2.f1, b1.f1 >^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
2775          f1          |         f1          | ?column? 
2776 ---------------------+---------------------+----------
2777  (2,2),(0,0)         | (2,2),(0,0)         | f
2778  (2,2),(0,0)         | (3,3),(1,1)         | f
2779  (2,2),(0,0)         | (-2,2),(-8,-10)     | f
2780  (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | f
2781  (2,2),(0,0)         | (3,3),(3,3)         | f
2782  (3,3),(1,1)         | (2,2),(0,0)         | f
2783  (3,3),(1,1)         | (3,3),(1,1)         | f
2784  (3,3),(1,1)         | (-2,2),(-8,-10)     | f
2785  (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | f
2786  (3,3),(1,1)         | (3,3),(3,3)         | f
2787  (-2,2),(-8,-10)     | (2,2),(0,0)         | f
2788  (-2,2),(-8,-10)     | (3,3),(1,1)         | f
2789  (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | f
2790  (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | f
2791  (-2,2),(-8,-10)     | (3,3),(3,3)         | f
2792  (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | t
2793  (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | f
2794  (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | t
2795  (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | f
2796  (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | f
2797  (3,3),(3,3)         | (2,2),(0,0)         | t
2798  (3,3),(3,3)         | (3,3),(1,1)         | t
2799  (3,3),(3,3)         | (-2,2),(-8,-10)     | t
2800  (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | f
2801  (3,3),(3,3)         | (3,3),(3,3)         | t
2802 (25 rows)
2804 -- Intersection point with box
2805 SELECT b1.f1, b2.f1, b1.f1 # b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
2806          f1          |         f1          |      ?column?       
2807 ---------------------+---------------------+---------------------
2808  (2,2),(0,0)         | (2,2),(0,0)         | (2,2),(0,0)
2809  (2,2),(0,0)         | (3,3),(1,1)         | (2,2),(1,1)
2810  (2,2),(0,0)         | (-2,2),(-8,-10)     | 
2811  (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | 
2812  (2,2),(0,0)         | (3,3),(3,3)         | 
2813  (3,3),(1,1)         | (2,2),(0,0)         | (2,2),(1,1)
2814  (3,3),(1,1)         | (3,3),(1,1)         | (3,3),(1,1)
2815  (3,3),(1,1)         | (-2,2),(-8,-10)     | 
2816  (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | (2.5,3),(2.5,2.5)
2817  (3,3),(1,1)         | (3,3),(3,3)         | (3,3),(3,3)
2818  (-2,2),(-8,-10)     | (2,2),(0,0)         | 
2819  (-2,2),(-8,-10)     | (3,3),(1,1)         | 
2820  (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | (-2,2),(-8,-10)
2821  (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | 
2822  (-2,2),(-8,-10)     | (3,3),(3,3)         | 
2823  (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | 
2824  (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | (2.5,3),(2.5,2.5)
2825  (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | 
2826  (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
2827  (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | 
2828  (3,3),(3,3)         | (2,2),(0,0)         | 
2829  (3,3),(3,3)         | (3,3),(1,1)         | (3,3),(3,3)
2830  (3,3),(3,3)         | (-2,2),(-8,-10)     | 
2831  (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | 
2832  (3,3),(3,3)         | (3,3),(3,3)         | (3,3),(3,3)
2833 (25 rows)
2835 -- Diagonal
2836 SELECT f1, diagonal(f1) FROM BOX_TBL;
2837          f1          |       diagonal        
2838 ---------------------+-----------------------
2839  (2,2),(0,0)         | [(2,2),(0,0)]
2840  (3,3),(1,1)         | [(3,3),(1,1)]
2841  (-2,2),(-8,-10)     | [(-2,2),(-8,-10)]
2842  (2.5,3.5),(2.5,2.5) | [(2.5,3.5),(2.5,2.5)]
2843  (3,3),(3,3)         | [(3,3),(3,3)]
2844 (5 rows)
2846 -- Distance to box
2847 SELECT b1.f1, b2.f1, b1.f1 <-> b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
2848          f1          |         f1          |   ?column?    
2849 ---------------------+---------------------+---------------
2850  (2,2),(0,0)         | (2,2),(0,0)         |             0
2851  (2,2),(0,0)         | (3,3),(1,1)         | 1.41421356237
2852  (2,2),(0,0)         | (-2,2),(-8,-10)     | 7.81024967591
2853  (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) |           2.5
2854  (2,2),(0,0)         | (3,3),(3,3)         | 2.82842712475
2855  (3,3),(1,1)         | (2,2),(0,0)         | 1.41421356237
2856  (3,3),(1,1)         | (3,3),(1,1)         |             0
2857  (3,3),(1,1)         | (-2,2),(-8,-10)     | 9.21954445729
2858  (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | 1.11803398875
2859  (3,3),(1,1)         | (3,3),(3,3)         | 1.41421356237
2860  (-2,2),(-8,-10)     | (2,2),(0,0)         | 7.81024967591
2861  (-2,2),(-8,-10)     | (3,3),(1,1)         | 9.21954445729
2862  (-2,2),(-8,-10)     | (-2,2),(-8,-10)     |             0
2863  (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | 10.2591422643
2864  (-2,2),(-8,-10)     | (3,3),(3,3)         | 10.6301458127
2865  (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         |           2.5
2866  (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | 1.11803398875
2867  (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | 10.2591422643
2868  (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) |             0
2869  (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         |           0.5
2870  (3,3),(3,3)         | (2,2),(0,0)         | 2.82842712475
2871  (3,3),(3,3)         | (3,3),(1,1)         | 1.41421356237
2872  (3,3),(3,3)         | (-2,2),(-8,-10)     | 10.6301458127
2873  (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) |           0.5
2874  (3,3),(3,3)         | (3,3),(3,3)         |             0
2875 (25 rows)
2878 -- Paths
2880 -- Points
2881 SELECT f1, npoints(f1) FROM PATH_TBL;
2882             f1             | npoints 
2883 ---------------------------+---------
2884  [(1,2),(3,4)]             |       2
2885  ((1,2),(3,4))             |       2
2886  [(0,0),(3,0),(4,5),(1,6)] |       4
2887  ((1,2),(3,4))             |       2
2888  ((1,2),(3,4))             |       2
2889  [(1,2),(3,4)]             |       2
2890  ((10,20))                 |       1
2891  [(11,12),(13,14)]         |       2
2892  ((11,12),(13,14))         |       2
2893 (9 rows)
2895 -- Area
2896 SELECT f1, area(f1) FROM PATH_TBL;
2897             f1             | area 
2898 ---------------------------+------
2899  [(1,2),(3,4)]             |     
2900  ((1,2),(3,4))             |    0
2901  [(0,0),(3,0),(4,5),(1,6)] |     
2902  ((1,2),(3,4))             |    0
2903  ((1,2),(3,4))             |    0
2904  [(1,2),(3,4)]             |     
2905  ((10,20))                 |    0
2906  [(11,12),(13,14)]         |     
2907  ((11,12),(13,14))         |    0
2908 (9 rows)
2910 -- Length
2911 SELECT f1, @-@ f1 FROM PATH_TBL;
2912             f1             |   ?column?    
2913 ---------------------------+---------------
2914  [(1,2),(3,4)]             | 2.82842712475
2915  ((1,2),(3,4))             | 5.65685424949
2916  [(0,0),(3,0),(4,5),(1,6)] | 11.2612971738
2917  ((1,2),(3,4))             | 5.65685424949
2918  ((1,2),(3,4))             | 5.65685424949
2919  [(1,2),(3,4)]             | 2.82842712475
2920  ((10,20))                 |             0
2921  [(11,12),(13,14)]         | 2.82842712475
2922  ((11,12),(13,14))         | 5.65685424949
2923 (9 rows)
2925 -- Center
2926 SELECT f1, @@ f1 FROM PATH_TBL;
2927 ERROR:  function "path_center" not implemented
2928 -- To polygon
2929 SELECT f1, f1::polygon FROM PATH_TBL WHERE isclosed(f1);
2930         f1         |        f1         
2931 -------------------+-------------------
2932  ((1,2),(3,4))     | ((1,2),(3,4))
2933  ((1,2),(3,4))     | ((1,2),(3,4))
2934  ((1,2),(3,4))     | ((1,2),(3,4))
2935  ((10,20))         | ((10,20))
2936  ((11,12),(13,14)) | ((11,12),(13,14))
2937 (5 rows)
2939 -- Open path cannot be converted to polygon error
2940 SELECT f1, f1::polygon FROM PATH_TBL WHERE isopen(f1);
2941 ERROR:  open path cannot be converted to polygon
2942 -- Has points less than path
2943 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 < p2.f1;
2944         f1         |            f1             
2945 -------------------+---------------------------
2946  [(1,2),(3,4)]     | [(0,0),(3,0),(4,5),(1,6)]
2947  ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
2948  ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
2949  ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
2950  [(1,2),(3,4)]     | [(0,0),(3,0),(4,5),(1,6)]
2951  ((10,20))         | [(1,2),(3,4)]
2952  ((10,20))         | ((1,2),(3,4))
2953  ((10,20))         | [(0,0),(3,0),(4,5),(1,6)]
2954  ((10,20))         | ((1,2),(3,4))
2955  ((10,20))         | ((1,2),(3,4))
2956  ((10,20))         | [(1,2),(3,4)]
2957  ((10,20))         | [(11,12),(13,14)]
2958  ((10,20))         | ((11,12),(13,14))
2959  [(11,12),(13,14)] | [(0,0),(3,0),(4,5),(1,6)]
2960  ((11,12),(13,14)) | [(0,0),(3,0),(4,5),(1,6)]
2961 (15 rows)
2963 -- Has points less than or equal to path
2964 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 <= p2.f1;
2965             f1             |            f1             
2966 ---------------------------+---------------------------
2967  [(1,2),(3,4)]             | [(1,2),(3,4)]
2968  [(1,2),(3,4)]             | ((1,2),(3,4))
2969  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)]
2970  [(1,2),(3,4)]             | ((1,2),(3,4))
2971  [(1,2),(3,4)]             | ((1,2),(3,4))
2972  [(1,2),(3,4)]             | [(1,2),(3,4)]
2973  [(1,2),(3,4)]             | [(11,12),(13,14)]
2974  [(1,2),(3,4)]             | ((11,12),(13,14))
2975  ((1,2),(3,4))             | [(1,2),(3,4)]
2976  ((1,2),(3,4))             | ((1,2),(3,4))
2977  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)]
2978  ((1,2),(3,4))             | ((1,2),(3,4))
2979  ((1,2),(3,4))             | ((1,2),(3,4))
2980  ((1,2),(3,4))             | [(1,2),(3,4)]
2981  ((1,2),(3,4))             | [(11,12),(13,14)]
2982  ((1,2),(3,4))             | ((11,12),(13,14))
2983  [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
2984  ((1,2),(3,4))             | [(1,2),(3,4)]
2985  ((1,2),(3,4))             | ((1,2),(3,4))
2986  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)]
2987  ((1,2),(3,4))             | ((1,2),(3,4))
2988  ((1,2),(3,4))             | ((1,2),(3,4))
2989  ((1,2),(3,4))             | [(1,2),(3,4)]
2990  ((1,2),(3,4))             | [(11,12),(13,14)]
2991  ((1,2),(3,4))             | ((11,12),(13,14))
2992  ((1,2),(3,4))             | [(1,2),(3,4)]
2993  ((1,2),(3,4))             | ((1,2),(3,4))
2994  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)]
2995  ((1,2),(3,4))             | ((1,2),(3,4))
2996  ((1,2),(3,4))             | ((1,2),(3,4))
2997  ((1,2),(3,4))             | [(1,2),(3,4)]
2998  ((1,2),(3,4))             | [(11,12),(13,14)]
2999  ((1,2),(3,4))             | ((11,12),(13,14))
3000  [(1,2),(3,4)]             | [(1,2),(3,4)]
3001  [(1,2),(3,4)]             | ((1,2),(3,4))
3002  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)]
3003  [(1,2),(3,4)]             | ((1,2),(3,4))
3004  [(1,2),(3,4)]             | ((1,2),(3,4))
3005  [(1,2),(3,4)]             | [(1,2),(3,4)]
3006  [(1,2),(3,4)]             | [(11,12),(13,14)]
3007  [(1,2),(3,4)]             | ((11,12),(13,14))
3008  ((10,20))                 | [(1,2),(3,4)]
3009  ((10,20))                 | ((1,2),(3,4))
3010  ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)]
3011  ((10,20))                 | ((1,2),(3,4))
3012  ((10,20))                 | ((1,2),(3,4))
3013  ((10,20))                 | [(1,2),(3,4)]
3014  ((10,20))                 | ((10,20))
3015  ((10,20))                 | [(11,12),(13,14)]
3016  ((10,20))                 | ((11,12),(13,14))
3017  [(11,12),(13,14)]         | [(1,2),(3,4)]
3018  [(11,12),(13,14)]         | ((1,2),(3,4))
3019  [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)]
3020  [(11,12),(13,14)]         | ((1,2),(3,4))
3021  [(11,12),(13,14)]         | ((1,2),(3,4))
3022  [(11,12),(13,14)]         | [(1,2),(3,4)]
3023  [(11,12),(13,14)]         | [(11,12),(13,14)]
3024  [(11,12),(13,14)]         | ((11,12),(13,14))
3025  ((11,12),(13,14))         | [(1,2),(3,4)]
3026  ((11,12),(13,14))         | ((1,2),(3,4))
3027  ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)]
3028  ((11,12),(13,14))         | ((1,2),(3,4))
3029  ((11,12),(13,14))         | ((1,2),(3,4))
3030  ((11,12),(13,14))         | [(1,2),(3,4)]
3031  ((11,12),(13,14))         | [(11,12),(13,14)]
3032  ((11,12),(13,14))         | ((11,12),(13,14))
3033 (66 rows)
3035 -- Has points equal to path
3036 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 = p2.f1;
3037             f1             |            f1             
3038 ---------------------------+---------------------------
3039  [(1,2),(3,4)]             | [(1,2),(3,4)]
3040  [(1,2),(3,4)]             | ((1,2),(3,4))
3041  [(1,2),(3,4)]             | ((1,2),(3,4))
3042  [(1,2),(3,4)]             | ((1,2),(3,4))
3043  [(1,2),(3,4)]             | [(1,2),(3,4)]
3044  [(1,2),(3,4)]             | [(11,12),(13,14)]
3045  [(1,2),(3,4)]             | ((11,12),(13,14))
3046  ((1,2),(3,4))             | [(1,2),(3,4)]
3047  ((1,2),(3,4))             | ((1,2),(3,4))
3048  ((1,2),(3,4))             | ((1,2),(3,4))
3049  ((1,2),(3,4))             | ((1,2),(3,4))
3050  ((1,2),(3,4))             | [(1,2),(3,4)]
3051  ((1,2),(3,4))             | [(11,12),(13,14)]
3052  ((1,2),(3,4))             | ((11,12),(13,14))
3053  [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
3054  ((1,2),(3,4))             | [(1,2),(3,4)]
3055  ((1,2),(3,4))             | ((1,2),(3,4))
3056  ((1,2),(3,4))             | ((1,2),(3,4))
3057  ((1,2),(3,4))             | ((1,2),(3,4))
3058  ((1,2),(3,4))             | [(1,2),(3,4)]
3059  ((1,2),(3,4))             | [(11,12),(13,14)]
3060  ((1,2),(3,4))             | ((11,12),(13,14))
3061  ((1,2),(3,4))             | [(1,2),(3,4)]
3062  ((1,2),(3,4))             | ((1,2),(3,4))
3063  ((1,2),(3,4))             | ((1,2),(3,4))
3064  ((1,2),(3,4))             | ((1,2),(3,4))
3065  ((1,2),(3,4))             | [(1,2),(3,4)]
3066  ((1,2),(3,4))             | [(11,12),(13,14)]
3067  ((1,2),(3,4))             | ((11,12),(13,14))
3068  [(1,2),(3,4)]             | [(1,2),(3,4)]
3069  [(1,2),(3,4)]             | ((1,2),(3,4))
3070  [(1,2),(3,4)]             | ((1,2),(3,4))
3071  [(1,2),(3,4)]             | ((1,2),(3,4))
3072  [(1,2),(3,4)]             | [(1,2),(3,4)]
3073  [(1,2),(3,4)]             | [(11,12),(13,14)]
3074  [(1,2),(3,4)]             | ((11,12),(13,14))
3075  ((10,20))                 | ((10,20))
3076  [(11,12),(13,14)]         | [(1,2),(3,4)]
3077  [(11,12),(13,14)]         | ((1,2),(3,4))
3078  [(11,12),(13,14)]         | ((1,2),(3,4))
3079  [(11,12),(13,14)]         | ((1,2),(3,4))
3080  [(11,12),(13,14)]         | [(1,2),(3,4)]
3081  [(11,12),(13,14)]         | [(11,12),(13,14)]
3082  [(11,12),(13,14)]         | ((11,12),(13,14))
3083  ((11,12),(13,14))         | [(1,2),(3,4)]
3084  ((11,12),(13,14))         | ((1,2),(3,4))
3085  ((11,12),(13,14))         | ((1,2),(3,4))
3086  ((11,12),(13,14))         | ((1,2),(3,4))
3087  ((11,12),(13,14))         | [(1,2),(3,4)]
3088  ((11,12),(13,14))         | [(11,12),(13,14)]
3089  ((11,12),(13,14))         | ((11,12),(13,14))
3090 (51 rows)
3092 -- Has points greater than or equal to path
3093 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 >= p2.f1;
3094             f1             |            f1             
3095 ---------------------------+---------------------------
3096  [(1,2),(3,4)]             | [(1,2),(3,4)]
3097  [(1,2),(3,4)]             | ((1,2),(3,4))
3098  [(1,2),(3,4)]             | ((1,2),(3,4))
3099  [(1,2),(3,4)]             | ((1,2),(3,4))
3100  [(1,2),(3,4)]             | [(1,2),(3,4)]
3101  [(1,2),(3,4)]             | ((10,20))
3102  [(1,2),(3,4)]             | [(11,12),(13,14)]
3103  [(1,2),(3,4)]             | ((11,12),(13,14))
3104  ((1,2),(3,4))             | [(1,2),(3,4)]
3105  ((1,2),(3,4))             | ((1,2),(3,4))
3106  ((1,2),(3,4))             | ((1,2),(3,4))
3107  ((1,2),(3,4))             | ((1,2),(3,4))
3108  ((1,2),(3,4))             | [(1,2),(3,4)]
3109  ((1,2),(3,4))             | ((10,20))
3110  ((1,2),(3,4))             | [(11,12),(13,14)]
3111  ((1,2),(3,4))             | ((11,12),(13,14))
3112  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
3113  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3114  [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
3115  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3116  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3117  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
3118  [(0,0),(3,0),(4,5),(1,6)] | ((10,20))
3119  [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]
3120  [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))
3121  ((1,2),(3,4))             | [(1,2),(3,4)]
3122  ((1,2),(3,4))             | ((1,2),(3,4))
3123  ((1,2),(3,4))             | ((1,2),(3,4))
3124  ((1,2),(3,4))             | ((1,2),(3,4))
3125  ((1,2),(3,4))             | [(1,2),(3,4)]
3126  ((1,2),(3,4))             | ((10,20))
3127  ((1,2),(3,4))             | [(11,12),(13,14)]
3128  ((1,2),(3,4))             | ((11,12),(13,14))
3129  ((1,2),(3,4))             | [(1,2),(3,4)]
3130  ((1,2),(3,4))             | ((1,2),(3,4))
3131  ((1,2),(3,4))             | ((1,2),(3,4))
3132  ((1,2),(3,4))             | ((1,2),(3,4))
3133  ((1,2),(3,4))             | [(1,2),(3,4)]
3134  ((1,2),(3,4))             | ((10,20))
3135  ((1,2),(3,4))             | [(11,12),(13,14)]
3136  ((1,2),(3,4))             | ((11,12),(13,14))
3137  [(1,2),(3,4)]             | [(1,2),(3,4)]
3138  [(1,2),(3,4)]             | ((1,2),(3,4))
3139  [(1,2),(3,4)]             | ((1,2),(3,4))
3140  [(1,2),(3,4)]             | ((1,2),(3,4))
3141  [(1,2),(3,4)]             | [(1,2),(3,4)]
3142  [(1,2),(3,4)]             | ((10,20))
3143  [(1,2),(3,4)]             | [(11,12),(13,14)]
3144  [(1,2),(3,4)]             | ((11,12),(13,14))
3145  ((10,20))                 | ((10,20))
3146  [(11,12),(13,14)]         | [(1,2),(3,4)]
3147  [(11,12),(13,14)]         | ((1,2),(3,4))
3148  [(11,12),(13,14)]         | ((1,2),(3,4))
3149  [(11,12),(13,14)]         | ((1,2),(3,4))
3150  [(11,12),(13,14)]         | [(1,2),(3,4)]
3151  [(11,12),(13,14)]         | ((10,20))
3152  [(11,12),(13,14)]         | [(11,12),(13,14)]
3153  [(11,12),(13,14)]         | ((11,12),(13,14))
3154  ((11,12),(13,14))         | [(1,2),(3,4)]
3155  ((11,12),(13,14))         | ((1,2),(3,4))
3156  ((11,12),(13,14))         | ((1,2),(3,4))
3157  ((11,12),(13,14))         | ((1,2),(3,4))
3158  ((11,12),(13,14))         | [(1,2),(3,4)]
3159  ((11,12),(13,14))         | ((10,20))
3160  ((11,12),(13,14))         | [(11,12),(13,14)]
3161  ((11,12),(13,14))         | ((11,12),(13,14))
3162 (66 rows)
3164 -- Has points greater than path
3165 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 > p2.f1;
3166             f1             |        f1         
3167 ---------------------------+-------------------
3168  [(1,2),(3,4)]             | ((10,20))
3169  ((1,2),(3,4))             | ((10,20))
3170  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
3171  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3172  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3173  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3174  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
3175  [(0,0),(3,0),(4,5),(1,6)] | ((10,20))
3176  [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]
3177  [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))
3178  ((1,2),(3,4))             | ((10,20))
3179  ((1,2),(3,4))             | ((10,20))
3180  [(1,2),(3,4)]             | ((10,20))
3181  [(11,12),(13,14)]         | ((10,20))
3182  ((11,12),(13,14))         | ((10,20))
3183 (15 rows)
3185 -- Add path
3186 SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM PATH_TBL p1, PATH_TBL p2;
3187             f1             |            f1             |                     ?column?                      
3188 ---------------------------+---------------------------+---------------------------------------------------
3189  [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
3190  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3191  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4),(0,0),(3,0),(4,5),(1,6)]
3192  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3193  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3194  [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
3195  [(1,2),(3,4)]             | ((10,20))                 | 
3196  [(1,2),(3,4)]             | [(11,12),(13,14)]         | [(1,2),(3,4),(11,12),(13,14)]
3197  [(1,2),(3,4)]             | ((11,12),(13,14))         | 
3198  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3199  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3200  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
3201  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3202  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3203  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3204  ((1,2),(3,4))             | ((10,20))                 | 
3205  ((1,2),(3,4))             | [(11,12),(13,14)]         | 
3206  ((1,2),(3,4))             | ((11,12),(13,14))         | 
3207  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6),(1,2),(3,4)]
3208  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
3209  [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6),(0,0),(3,0),(4,5),(1,6)]
3210  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
3211  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
3212  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6),(1,2),(3,4)]
3213  [(0,0),(3,0),(4,5),(1,6)] | ((10,20))                 | 
3214  [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6),(11,12),(13,14)]
3215  [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))         | 
3216  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3217  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3218  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
3219  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3220  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3221  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3222  ((1,2),(3,4))             | ((10,20))                 | 
3223  ((1,2),(3,4))             | [(11,12),(13,14)]         | 
3224  ((1,2),(3,4))             | ((11,12),(13,14))         | 
3225  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3226  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3227  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
3228  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3229  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3230  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3231  ((1,2),(3,4))             | ((10,20))                 | 
3232  ((1,2),(3,4))             | [(11,12),(13,14)]         | 
3233  ((1,2),(3,4))             | ((11,12),(13,14))         | 
3234  [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
3235  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3236  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4),(0,0),(3,0),(4,5),(1,6)]
3237  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3238  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3239  [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
3240  [(1,2),(3,4)]             | ((10,20))                 | 
3241  [(1,2),(3,4)]             | [(11,12),(13,14)]         | [(1,2),(3,4),(11,12),(13,14)]
3242  [(1,2),(3,4)]             | ((11,12),(13,14))         | 
3243  ((10,20))                 | [(1,2),(3,4)]             | 
3244  ((10,20))                 | ((1,2),(3,4))             | 
3245  ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)] | 
3246  ((10,20))                 | ((1,2),(3,4))             | 
3247  ((10,20))                 | ((1,2),(3,4))             | 
3248  ((10,20))                 | [(1,2),(3,4)]             | 
3249  ((10,20))                 | ((10,20))                 | 
3250  ((10,20))                 | [(11,12),(13,14)]         | 
3251  ((10,20))                 | ((11,12),(13,14))         | 
3252  [(11,12),(13,14)]         | [(1,2),(3,4)]             | [(11,12),(13,14),(1,2),(3,4)]
3253  [(11,12),(13,14)]         | ((1,2),(3,4))             | 
3254  [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14),(0,0),(3,0),(4,5),(1,6)]
3255  [(11,12),(13,14)]         | ((1,2),(3,4))             | 
3256  [(11,12),(13,14)]         | ((1,2),(3,4))             | 
3257  [(11,12),(13,14)]         | [(1,2),(3,4)]             | [(11,12),(13,14),(1,2),(3,4)]
3258  [(11,12),(13,14)]         | ((10,20))                 | 
3259  [(11,12),(13,14)]         | [(11,12),(13,14)]         | [(11,12),(13,14),(11,12),(13,14)]
3260  [(11,12),(13,14)]         | ((11,12),(13,14))         | 
3261  ((11,12),(13,14))         | [(1,2),(3,4)]             | 
3262  ((11,12),(13,14))         | ((1,2),(3,4))             | 
3263  ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)] | 
3264  ((11,12),(13,14))         | ((1,2),(3,4))             | 
3265  ((11,12),(13,14))         | ((1,2),(3,4))             | 
3266  ((11,12),(13,14))         | [(1,2),(3,4)]             | 
3267  ((11,12),(13,14))         | ((10,20))                 | 
3268  ((11,12),(13,14))         | [(11,12),(13,14)]         | 
3269  ((11,12),(13,14))         | ((11,12),(13,14))         | 
3270 (81 rows)
3272 -- Add point
3273 SELECT p.f1, p1.f1, p.f1 + p1.f1 FROM PATH_TBL p, POINT_TBL p1;
3274             f1             |        f1         |                                 ?column?                                  
3275 ---------------------------+-------------------+---------------------------------------------------------------------------
3276  [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
3277  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3278  [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(3,0),(4,5),(1,6)]
3279  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3280  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3281  [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
3282  ((10,20))                 | (0,0)             | ((10,20))
3283  [(11,12),(13,14)]         | (0,0)             | [(11,12),(13,14)]
3284  ((11,12),(13,14))         | (0,0)             | ((11,12),(13,14))
3285  [(1,2),(3,4)]             | (-10,0)           | [(-9,2),(-7,4)]
3286  ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
3287  [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(-10,0),(-7,0),(-6,5),(-9,6)]
3288  ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
3289  ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
3290  [(1,2),(3,4)]             | (-10,0)           | [(-9,2),(-7,4)]
3291  ((10,20))                 | (-10,0)           | ((0,20))
3292  [(11,12),(13,14)]         | (-10,0)           | [(1,12),(3,14)]
3293  ((11,12),(13,14))         | (-10,0)           | ((1,12),(3,14))
3294  [(1,2),(3,4)]             | (-3,4)            | [(-2,6),(0,8)]
3295  ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
3296  [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(-3,4),(0,4),(1,9),(-2,10)]
3297  ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
3298  ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
3299  [(1,2),(3,4)]             | (-3,4)            | [(-2,6),(0,8)]
3300  ((10,20))                 | (-3,4)            | ((7,24))
3301  [(11,12),(13,14)]         | (-3,4)            | [(8,16),(10,18)]
3302  ((11,12),(13,14))         | (-3,4)            | ((8,16),(10,18))
3303  [(1,2),(3,4)]             | (5.1,34.5)        | [(6.1,36.5),(8.1,38.5)]
3304  ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
3305  [(0,0),(3,0),(4,5),(1,6)] | (5.1,34.5)        | [(5.1,34.5),(8.1,34.5),(9.1,39.5),(6.1,40.5)]
3306  ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
3307  ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
3308  [(1,2),(3,4)]             | (5.1,34.5)        | [(6.1,36.5),(8.1,38.5)]
3309  ((10,20))                 | (5.1,34.5)        | ((15.1,54.5))
3310  [(11,12),(13,14)]         | (5.1,34.5)        | [(16.1,46.5),(18.1,48.5)]
3311  ((11,12),(13,14))         | (5.1,34.5)        | ((16.1,46.5),(18.1,48.5))
3312  [(1,2),(3,4)]             | (-5,-12)          | [(-4,-10),(-2,-8)]
3313  ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
3314  [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(-5,-12),(-2,-12),(-1,-7),(-4,-6)]
3315  ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
3316  ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
3317  [(1,2),(3,4)]             | (-5,-12)          | [(-4,-10),(-2,-8)]
3318  ((10,20))                 | (-5,-12)          | ((5,8))
3319  [(11,12),(13,14)]         | (-5,-12)          | [(6,0),(8,2)]
3320  ((11,12),(13,14))         | (-5,-12)          | ((6,0),(8,2))
3321  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
3322  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3323  [(0,0),(3,0),(4,5),(1,6)] | (1e-300,-1e-300)  | [(1e-300,-1e-300),(3,-1e-300),(4,5),(1,6)]
3324  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3325  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3326  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
3327  ((10,20))                 | (1e-300,-1e-300)  | ((10,20))
3328  [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(11,12),(13,14)]
3329  ((11,12),(13,14))         | (1e-300,-1e-300)  | ((11,12),(13,14))
3330  [(1,2),(3,4)]             | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
3331  ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
3332  [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity),(1e+300,Infinity),(1e+300,Infinity)]
3333  ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
3334  ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
3335  [(1,2),(3,4)]             | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
3336  ((10,20))                 | (1e+300,Infinity) | ((1e+300,Infinity))
3337  [(11,12),(13,14)]         | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
3338  ((11,12),(13,14))         | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
3339  [(1,2),(3,4)]             | (Infinity,1e+300) | [(Infinity,1e+300),(Infinity,1e+300)]
3340  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,1e+300),(Infinity,1e+300))
3341  [(0,0),(3,0),(4,5),(1,6)] | (Infinity,1e+300) | [(Infinity,1e+300),(Infinity,1e+300),(Infinity,1e+300),(Infinity,1e+300)]
3342  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,1e+300),(Infinity,1e+300))
3343  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,1e+300),(Infinity,1e+300))
3344  [(1,2),(3,4)]             | (Infinity,1e+300) | [(Infinity,1e+300),(Infinity,1e+300)]
3345  ((10,20))                 | (Infinity,1e+300) | ((Infinity,1e+300))
3346  [(11,12),(13,14)]         | (Infinity,1e+300) | [(Infinity,1e+300),(Infinity,1e+300)]
3347  ((11,12),(13,14))         | (Infinity,1e+300) | ((Infinity,1e+300),(Infinity,1e+300))
3348  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3349  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3350  [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
3351  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3352  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3353  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3354  ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
3355  [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3356  ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3357  [(1,2),(3,4)]             | (10,10)           | [(11,12),(13,14)]
3358  ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
3359  [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(10,10),(13,10),(14,15),(11,16)]
3360  ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
3361  ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
3362  [(1,2),(3,4)]             | (10,10)           | [(11,12),(13,14)]
3363  ((10,20))                 | (10,10)           | ((20,30))
3364  [(11,12),(13,14)]         | (10,10)           | [(21,22),(23,24)]
3365  ((11,12),(13,14))         | (10,10)           | ((21,22),(23,24))
3366 (90 rows)
3368 -- Subtract point
3369 SELECT p.f1, p1.f1, p.f1 - p1.f1 FROM PATH_TBL p, POINT_TBL p1;
3370             f1             |        f1         |                                     ?column?                                      
3371 ---------------------------+-------------------+-----------------------------------------------------------------------------------
3372  [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
3373  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3374  [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(3,0),(4,5),(1,6)]
3375  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3376  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3377  [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
3378  ((10,20))                 | (0,0)             | ((10,20))
3379  [(11,12),(13,14)]         | (0,0)             | [(11,12),(13,14)]
3380  ((11,12),(13,14))         | (0,0)             | ((11,12),(13,14))
3381  [(1,2),(3,4)]             | (-10,0)           | [(11,2),(13,4)]
3382  ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
3383  [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(10,0),(13,0),(14,5),(11,6)]
3384  ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
3385  ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
3386  [(1,2),(3,4)]             | (-10,0)           | [(11,2),(13,4)]
3387  ((10,20))                 | (-10,0)           | ((20,20))
3388  [(11,12),(13,14)]         | (-10,0)           | [(21,12),(23,14)]
3389  ((11,12),(13,14))         | (-10,0)           | ((21,12),(23,14))
3390  [(1,2),(3,4)]             | (-3,4)            | [(4,-2),(6,0)]
3391  ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
3392  [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(3,-4),(6,-4),(7,1),(4,2)]
3393  ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
3394  ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
3395  [(1,2),(3,4)]             | (-3,4)            | [(4,-2),(6,0)]
3396  ((10,20))                 | (-3,4)            | ((13,16))
3397  [(11,12),(13,14)]         | (-3,4)            | [(14,8),(16,10)]
3398  ((11,12),(13,14))         | (-3,4)            | ((14,8),(16,10))
3399  [(1,2),(3,4)]             | (5.1,34.5)        | [(-4.1,-32.5),(-2.1,-30.5)]
3400  ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
3401  [(0,0),(3,0),(4,5),(1,6)] | (5.1,34.5)        | [(-5.1,-34.5),(-2.1,-34.5),(-1.1,-29.5),(-4.1,-28.5)]
3402  ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
3403  ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
3404  [(1,2),(3,4)]             | (5.1,34.5)        | [(-4.1,-32.5),(-2.1,-30.5)]
3405  ((10,20))                 | (5.1,34.5)        | ((4.9,-14.5))
3406  [(11,12),(13,14)]         | (5.1,34.5)        | [(5.9,-22.5),(7.9,-20.5)]
3407  ((11,12),(13,14))         | (5.1,34.5)        | ((5.9,-22.5),(7.9,-20.5))
3408  [(1,2),(3,4)]             | (-5,-12)          | [(6,14),(8,16)]
3409  ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
3410  [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(5,12),(8,12),(9,17),(6,18)]
3411  ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
3412  ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
3413  [(1,2),(3,4)]             | (-5,-12)          | [(6,14),(8,16)]
3414  ((10,20))                 | (-5,-12)          | ((15,32))
3415  [(11,12),(13,14)]         | (-5,-12)          | [(16,24),(18,26)]
3416  ((11,12),(13,14))         | (-5,-12)          | ((16,24),(18,26))
3417  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
3418  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3419  [(0,0),(3,0),(4,5),(1,6)] | (1e-300,-1e-300)  | [(-1e-300,1e-300),(3,1e-300),(4,5),(1,6)]
3420  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3421  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3422  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
3423  ((10,20))                 | (1e-300,-1e-300)  | ((10,20))
3424  [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(11,12),(13,14)]
3425  ((11,12),(13,14))         | (1e-300,-1e-300)  | ((11,12),(13,14))
3426  [(1,2),(3,4)]             | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
3427  ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
3428  [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity),(-1e+300,-Infinity),(-1e+300,-Infinity)]
3429  ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
3430  ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
3431  [(1,2),(3,4)]             | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
3432  ((10,20))                 | (1e+300,Infinity) | ((-1e+300,-Infinity))
3433  [(11,12),(13,14)]         | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
3434  ((11,12),(13,14))         | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
3435  [(1,2),(3,4)]             | (Infinity,1e+300) | [(-Infinity,-1e+300),(-Infinity,-1e+300)]
3436  ((1,2),(3,4))             | (Infinity,1e+300) | ((-Infinity,-1e+300),(-Infinity,-1e+300))
3437  [(0,0),(3,0),(4,5),(1,6)] | (Infinity,1e+300) | [(-Infinity,-1e+300),(-Infinity,-1e+300),(-Infinity,-1e+300),(-Infinity,-1e+300)]
3438  ((1,2),(3,4))             | (Infinity,1e+300) | ((-Infinity,-1e+300),(-Infinity,-1e+300))
3439  ((1,2),(3,4))             | (Infinity,1e+300) | ((-Infinity,-1e+300),(-Infinity,-1e+300))
3440  [(1,2),(3,4)]             | (Infinity,1e+300) | [(-Infinity,-1e+300),(-Infinity,-1e+300)]
3441  ((10,20))                 | (Infinity,1e+300) | ((-Infinity,-1e+300))
3442  [(11,12),(13,14)]         | (Infinity,1e+300) | [(-Infinity,-1e+300),(-Infinity,-1e+300)]
3443  ((11,12),(13,14))         | (Infinity,1e+300) | ((-Infinity,-1e+300),(-Infinity,-1e+300))
3444  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3445  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3446  [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
3447  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3448  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3449  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3450  ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
3451  [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3452  ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3453  [(1,2),(3,4)]             | (10,10)           | [(-9,-8),(-7,-6)]
3454  ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
3455  [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(-10,-10),(-7,-10),(-6,-5),(-9,-4)]
3456  ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
3457  ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
3458  [(1,2),(3,4)]             | (10,10)           | [(-9,-8),(-7,-6)]
3459  ((10,20))                 | (10,10)           | ((0,10))
3460  [(11,12),(13,14)]         | (10,10)           | [(1,2),(3,4)]
3461  ((11,12),(13,14))         | (10,10)           | ((1,2),(3,4))
3462 (90 rows)
3464 -- Multiply with point
3465 SELECT p.f1, p1.f1, p.f1 * p1.f1 FROM PATH_TBL p, POINT_TBL p1;
3466             f1             |        f1         |                               ?column?                               
3467 ---------------------------+-------------------+----------------------------------------------------------------------
3468  [(1,2),(3,4)]             | (0,0)             | [(0,0),(0,0)]
3469  ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
3470  [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(0,0),(0,0),(0,0)]
3471  ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
3472  ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
3473  [(1,2),(3,4)]             | (0,0)             | [(0,0),(0,0)]
3474  ((10,20))                 | (0,0)             | ((0,0))
3475  [(11,12),(13,14)]         | (0,0)             | [(0,0),(0,0)]
3476  ((11,12),(13,14))         | (0,0)             | ((0,0),(0,0))
3477  [(1,2),(3,4)]             | (-10,0)           | [(-10,-20),(-30,-40)]
3478  ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
3479  [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(-0,0),(-30,0),(-40,-50),(-10,-60)]
3480  ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
3481  ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
3482  [(1,2),(3,4)]             | (-10,0)           | [(-10,-20),(-30,-40)]
3483  ((10,20))                 | (-10,0)           | ((-100,-200))
3484  [(11,12),(13,14)]         | (-10,0)           | [(-110,-120),(-130,-140)]
3485  ((11,12),(13,14))         | (-10,0)           | ((-110,-120),(-130,-140))
3486  [(1,2),(3,4)]             | (-3,4)            | [(-11,-2),(-25,0)]
3487  ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
3488  [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(-0,0),(-9,12),(-32,1),(-27,-14)]
3489  ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
3490  ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
3491  [(1,2),(3,4)]             | (-3,4)            | [(-11,-2),(-25,0)]
3492  ((10,20))                 | (-3,4)            | ((-110,-20))
3493  [(11,12),(13,14)]         | (-3,4)            | [(-81,8),(-95,10)]
3494  ((11,12),(13,14))         | (-3,4)            | ((-81,8),(-95,10))
3495  [(1,2),(3,4)]             | (5.1,34.5)        | [(-63.9,44.7),(-122.7,123.9)]
3496  ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
3497  [(0,0),(3,0),(4,5),(1,6)] | (5.1,34.5)        | [(0,0),(15.3,103.5),(-152.1,163.5),(-201.9,65.1)]
3498  ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
3499  ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
3500  [(1,2),(3,4)]             | (5.1,34.5)        | [(-63.9,44.7),(-122.7,123.9)]
3501  ((10,20))                 | (5.1,34.5)        | ((-639,447))
3502  [(11,12),(13,14)]         | (5.1,34.5)        | [(-357.9,440.7),(-416.7,519.9)]
3503  ((11,12),(13,14))         | (5.1,34.5)        | ((-357.9,440.7),(-416.7,519.9))
3504  [(1,2),(3,4)]             | (-5,-12)          | [(19,-22),(33,-56)]
3505  ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
3506  [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(0,-0),(-15,-36),(40,-73),(67,-42)]
3507  ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
3508  ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
3509  [(1,2),(3,4)]             | (-5,-12)          | [(19,-22),(33,-56)]
3510  ((10,20))                 | (-5,-12)          | ((190,-220))
3511  [(11,12),(13,14)]         | (-5,-12)          | [(89,-192),(103,-226)]
3512  ((11,12),(13,14))         | (-5,-12)          | ((89,-192),(103,-226))
3513  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(3e-300,1e-300),(7e-300,1e-300)]
3514  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
3515  [(0,0),(3,0),(4,5),(1,6)] | (1e-300,-1e-300)  | [(0,0),(3e-300,-3e-300),(9e-300,1e-300),(7e-300,5e-300)]
3516  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
3517  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
3518  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(3e-300,1e-300),(7e-300,1e-300)]
3519  ((10,20))                 | (1e-300,-1e-300)  | ((3e-299,1e-299))
3520  [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(2.3e-299,1e-300),(2.7e-299,1e-300)]
3521  ((11,12),(13,14))         | (1e-300,-1e-300)  | ((2.3e-299,1e-300),(2.7e-299,1e-300))
3522  [(1,2),(3,4)]             | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
3523  ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
3524  [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(NaN,NaN),(NaN,Infinity),(-Infinity,Infinity),(-Infinity,Infinity)]
3525  ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
3526  ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
3527  [(1,2),(3,4)]             | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
3528  ((10,20))                 | (1e+300,Infinity) | ((-Infinity,Infinity))
3529  [(11,12),(13,14)]         | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
3530  ((11,12),(13,14))         | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
3531  [(1,2),(3,4)]             | (Infinity,1e+300) | [(Infinity,Infinity),(Infinity,Infinity)]
3532  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,Infinity),(Infinity,Infinity))
3533  [(0,0),(3,0),(4,5),(1,6)] | (Infinity,1e+300) | [(NaN,NaN),(Infinity,NaN),(Infinity,Infinity),(Infinity,Infinity)]
3534  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,Infinity),(Infinity,Infinity))
3535  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,Infinity),(Infinity,Infinity))
3536  [(1,2),(3,4)]             | (Infinity,1e+300) | [(Infinity,Infinity),(Infinity,Infinity)]
3537  ((10,20))                 | (Infinity,1e+300) | ((Infinity,Infinity))
3538  [(11,12),(13,14)]         | (Infinity,1e+300) | [(Infinity,Infinity),(Infinity,Infinity)]
3539  ((11,12),(13,14))         | (Infinity,1e+300) | ((Infinity,Infinity),(Infinity,Infinity))
3540  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3541  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3542  [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
3543  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3544  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3545  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3546  ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
3547  [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3548  ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3549  [(1,2),(3,4)]             | (10,10)           | [(-10,30),(-10,70)]
3550  ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
3551  [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(0,0),(30,30),(-10,90),(-50,70)]
3552  ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
3553  ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
3554  [(1,2),(3,4)]             | (10,10)           | [(-10,30),(-10,70)]
3555  ((10,20))                 | (10,10)           | ((-100,300))
3556  [(11,12),(13,14)]         | (10,10)           | [(-10,230),(-10,270)]
3557  ((11,12),(13,14))         | (10,10)           | ((-10,230),(-10,270))
3558 (90 rows)
3560 -- Divide by point
3561 SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1[0] BETWEEN 1 AND 1000;
3562             f1             |     f1     |                                                    ?column?                                                     
3563 ---------------------------+------------+-----------------------------------------------------------------------------------------------------------------
3564  [(1,2),(3,4)]             | (5.1,34.5) | [(0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952)]
3565  [(1,2),(3,4)]             | (10,10)    | [(0.15,0.05),(0.35,0.05)]
3566  ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
3567  ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
3568  [(0,0),(3,0),(4,5),(1,6)] | (5.1,34.5) | [(0,0),(0.0125795471363,-0.0850969365103),(0.158600957032,-0.0924966701199),(0.174387055399,-0.00320655123082)]
3569  [(0,0),(3,0),(4,5),(1,6)] | (10,10)    | [(0,0),(0.15,-0.15),(0.45,0.05),(0.35,0.25)]
3570  ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
3571  ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
3572  ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
3573  ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
3574  [(1,2),(3,4)]             | (5.1,34.5) | [(0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952)]
3575  [(1,2),(3,4)]             | (10,10)    | [(0.15,0.05),(0.35,0.05)]
3576  ((10,20))                 | (5.1,34.5) | ((0.609244733856,-0.199792807459))
3577  ((10,20))                 | (10,10)    | ((1.5,0.5))
3578  [(11,12),(13,14)]         | (5.1,34.5) | [(0.386512752208,-0.261703911993),(0.451630407972,-0.310048838242)]
3579  [(11,12),(13,14)]         | (10,10)    | [(1.15,0.05),(1.35,0.05)]
3580  ((11,12),(13,14))         | (5.1,34.5) | ((0.386512752208,-0.261703911993),(0.451630407972,-0.310048838242))
3581  ((11,12),(13,14))         | (10,10)    | ((1.15,0.05),(1.35,0.05))
3582 (18 rows)
3584 -- Division by 0 error
3585 SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1 ~= '(0,0)'::point;
3586 ERROR:  division by zero
3587 -- Distance to path
3588 SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM PATH_TBL p1, PATH_TBL p2;
3589             f1             |            f1             |    ?column?    
3590 ---------------------------+---------------------------+----------------
3591  [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
3592  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3593  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3594  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3595  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3596  [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
3597  [(1,2),(3,4)]             | ((10,20))                 |  17.4642491966
3598  [(1,2),(3,4)]             | [(11,12),(13,14)]         |   11.313708499
3599  [(1,2),(3,4)]             | ((11,12),(13,14))         |   11.313708499
3600  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3601  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3602  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3603  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3604  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3605  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3606  ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
3607  ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
3608  ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
3609  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | 0.784464540553
3610  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
3611  [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)] |              0
3612  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
3613  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
3614  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | 0.784464540553
3615  [(0,0),(3,0),(4,5),(1,6)] | ((10,20))                 |  16.1554944214
3616  [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]         |  9.89949493661
3617  [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))         |  9.89949493661
3618  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3619  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3620  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3621  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3622  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3623  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3624  ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
3625  ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
3626  ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
3627  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3628  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3629  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3630  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3631  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3632  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3633  ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
3634  ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
3635  ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
3636  [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
3637  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3638  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3639  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3640  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3641  [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
3642  [(1,2),(3,4)]             | ((10,20))                 |  17.4642491966
3643  [(1,2),(3,4)]             | [(11,12),(13,14)]         |   11.313708499
3644  [(1,2),(3,4)]             | ((11,12),(13,14))         |   11.313708499
3645  ((10,20))                 | [(1,2),(3,4)]             |  17.4642491966
3646  ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
3647  ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)] |  16.1554944214
3648  ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
3649  ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
3650  ((10,20))                 | [(1,2),(3,4)]             |  17.4642491966
3651  ((10,20))                 | ((10,20))                 |              0
3652  ((10,20))                 | [(11,12),(13,14)]         |   6.7082039325
3653  ((10,20))                 | ((11,12),(13,14))         |   6.7082039325
3654  [(11,12),(13,14)]         | [(1,2),(3,4)]             |   11.313708499
3655  [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
3656  [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)] |  9.89949493661
3657  [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
3658  [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
3659  [(11,12),(13,14)]         | [(1,2),(3,4)]             |   11.313708499
3660  [(11,12),(13,14)]         | ((10,20))                 |   6.7082039325
3661  [(11,12),(13,14)]         | [(11,12),(13,14)]         |              0
3662  [(11,12),(13,14)]         | ((11,12),(13,14))         |              0
3663  ((11,12),(13,14))         | [(1,2),(3,4)]             |   11.313708499
3664  ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
3665  ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)] |  9.89949493661
3666  ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
3667  ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
3668  ((11,12),(13,14))         | [(1,2),(3,4)]             |   11.313708499
3669  ((11,12),(13,14))         | ((10,20))                 |   6.7082039325
3670  ((11,12),(13,14))         | [(11,12),(13,14)]         |              0
3671  ((11,12),(13,14))         | ((11,12),(13,14))         |              0
3672 (81 rows)
3675 -- Polygons
3677 -- containment
3678 SELECT p.f1, poly.f1, poly.f1 @> p.f1 AS contains
3679    FROM POLYGON_TBL poly, POINT_TBL p;
3680         f1         |             f1             | contains 
3681 -------------------+----------------------------+----------
3682  (0,0)             | ((2,0),(2,4),(0,0))        | t
3683  (0,0)             | ((3,1),(3,3),(1,0))        | f
3684  (0,0)             | ((1,2),(3,4),(5,6),(7,8))  | f
3685  (0,0)             | ((7,8),(5,6),(3,4),(1,2))  | f
3686  (0,0)             | ((1,2),(7,8),(5,6),(3,-4)) | f
3687  (0,0)             | ((0,0))                    | t
3688  (0,0)             | ((0,1),(0,1))              | f
3689  (-10,0)           | ((2,0),(2,4),(0,0))        | f
3690  (-10,0)           | ((3,1),(3,3),(1,0))        | f
3691  (-10,0)           | ((1,2),(3,4),(5,6),(7,8))  | f
3692  (-10,0)           | ((7,8),(5,6),(3,4),(1,2))  | f
3693  (-10,0)           | ((1,2),(7,8),(5,6),(3,-4)) | f
3694  (-10,0)           | ((0,0))                    | f
3695  (-10,0)           | ((0,1),(0,1))              | f
3696  (-3,4)            | ((2,0),(2,4),(0,0))        | f
3697  (-3,4)            | ((3,1),(3,3),(1,0))        | f
3698  (-3,4)            | ((1,2),(3,4),(5,6),(7,8))  | f
3699  (-3,4)            | ((7,8),(5,6),(3,4),(1,2))  | f
3700  (-3,4)            | ((1,2),(7,8),(5,6),(3,-4)) | f
3701  (-3,4)            | ((0,0))                    | f
3702  (-3,4)            | ((0,1),(0,1))              | f
3703  (5.1,34.5)        | ((2,0),(2,4),(0,0))        | f
3704  (5.1,34.5)        | ((3,1),(3,3),(1,0))        | f
3705  (5.1,34.5)        | ((1,2),(3,4),(5,6),(7,8))  | f
3706  (5.1,34.5)        | ((7,8),(5,6),(3,4),(1,2))  | f
3707  (5.1,34.5)        | ((1,2),(7,8),(5,6),(3,-4)) | f
3708  (5.1,34.5)        | ((0,0))                    | f
3709  (5.1,34.5)        | ((0,1),(0,1))              | f
3710  (-5,-12)          | ((2,0),(2,4),(0,0))        | f
3711  (-5,-12)          | ((3,1),(3,3),(1,0))        | f
3712  (-5,-12)          | ((1,2),(3,4),(5,6),(7,8))  | f
3713  (-5,-12)          | ((7,8),(5,6),(3,4),(1,2))  | f
3714  (-5,-12)          | ((1,2),(7,8),(5,6),(3,-4)) | f
3715  (-5,-12)          | ((0,0))                    | f
3716  (-5,-12)          | ((0,1),(0,1))              | f
3717  (1e-300,-1e-300)  | ((2,0),(2,4),(0,0))        | t
3718  (1e-300,-1e-300)  | ((3,1),(3,3),(1,0))        | f
3719  (1e-300,-1e-300)  | ((1,2),(3,4),(5,6),(7,8))  | f
3720  (1e-300,-1e-300)  | ((7,8),(5,6),(3,4),(1,2))  | f
3721  (1e-300,-1e-300)  | ((1,2),(7,8),(5,6),(3,-4)) | f
3722  (1e-300,-1e-300)  | ((0,0))                    | t
3723  (1e-300,-1e-300)  | ((0,1),(0,1))              | f
3724  (1e+300,Infinity) | ((2,0),(2,4),(0,0))        | f
3725  (1e+300,Infinity) | ((3,1),(3,3),(1,0))        | f
3726  (1e+300,Infinity) | ((1,2),(3,4),(5,6),(7,8))  | f
3727  (1e+300,Infinity) | ((7,8),(5,6),(3,4),(1,2))  | f
3728  (1e+300,Infinity) | ((1,2),(7,8),(5,6),(3,-4)) | f
3729  (1e+300,Infinity) | ((0,0))                    | f
3730  (1e+300,Infinity) | ((0,1),(0,1))              | f
3731  (Infinity,1e+300) | ((2,0),(2,4),(0,0))        | f
3732  (Infinity,1e+300) | ((3,1),(3,3),(1,0))        | f
3733  (Infinity,1e+300) | ((1,2),(3,4),(5,6),(7,8))  | f
3734  (Infinity,1e+300) | ((7,8),(5,6),(3,4),(1,2))  | f
3735  (Infinity,1e+300) | ((1,2),(7,8),(5,6),(3,-4)) | f
3736  (Infinity,1e+300) | ((0,0))                    | f
3737  (Infinity,1e+300) | ((0,1),(0,1))              | f
3738  (NaN,NaN)         | ((2,0),(2,4),(0,0))        | t
3739  (NaN,NaN)         | ((3,1),(3,3),(1,0))        | t
3740  (NaN,NaN)         | ((1,2),(3,4),(5,6),(7,8))  | t
3741  (NaN,NaN)         | ((7,8),(5,6),(3,4),(1,2))  | t
3742  (NaN,NaN)         | ((1,2),(7,8),(5,6),(3,-4)) | t
3743  (NaN,NaN)         | ((0,0))                    | t
3744  (NaN,NaN)         | ((0,1),(0,1))              | t
3745  (10,10)           | ((2,0),(2,4),(0,0))        | f
3746  (10,10)           | ((3,1),(3,3),(1,0))        | f
3747  (10,10)           | ((1,2),(3,4),(5,6),(7,8))  | f
3748  (10,10)           | ((7,8),(5,6),(3,4),(1,2))  | f
3749  (10,10)           | ((1,2),(7,8),(5,6),(3,-4)) | f
3750  (10,10)           | ((0,0))                    | f
3751  (10,10)           | ((0,1),(0,1))              | f
3752 (70 rows)
3754 SELECT p.f1, poly.f1, p.f1 <@ poly.f1 AS contained
3755    FROM POLYGON_TBL poly, POINT_TBL p;
3756         f1         |             f1             | contained 
3757 -------------------+----------------------------+-----------
3758  (0,0)             | ((2,0),(2,4),(0,0))        | t
3759  (0,0)             | ((3,1),(3,3),(1,0))        | f
3760  (0,0)             | ((1,2),(3,4),(5,6),(7,8))  | f
3761  (0,0)             | ((7,8),(5,6),(3,4),(1,2))  | f
3762  (0,0)             | ((1,2),(7,8),(5,6),(3,-4)) | f
3763  (0,0)             | ((0,0))                    | t
3764  (0,0)             | ((0,1),(0,1))              | f
3765  (-10,0)           | ((2,0),(2,4),(0,0))        | f
3766  (-10,0)           | ((3,1),(3,3),(1,0))        | f
3767  (-10,0)           | ((1,2),(3,4),(5,6),(7,8))  | f
3768  (-10,0)           | ((7,8),(5,6),(3,4),(1,2))  | f
3769  (-10,0)           | ((1,2),(7,8),(5,6),(3,-4)) | f
3770  (-10,0)           | ((0,0))                    | f
3771  (-10,0)           | ((0,1),(0,1))              | f
3772  (-3,4)            | ((2,0),(2,4),(0,0))        | f
3773  (-3,4)            | ((3,1),(3,3),(1,0))        | f
3774  (-3,4)            | ((1,2),(3,4),(5,6),(7,8))  | f
3775  (-3,4)            | ((7,8),(5,6),(3,4),(1,2))  | f
3776  (-3,4)            | ((1,2),(7,8),(5,6),(3,-4)) | f
3777  (-3,4)            | ((0,0))                    | f
3778  (-3,4)            | ((0,1),(0,1))              | f
3779  (5.1,34.5)        | ((2,0),(2,4),(0,0))        | f
3780  (5.1,34.5)        | ((3,1),(3,3),(1,0))        | f
3781  (5.1,34.5)        | ((1,2),(3,4),(5,6),(7,8))  | f
3782  (5.1,34.5)        | ((7,8),(5,6),(3,4),(1,2))  | f
3783  (5.1,34.5)        | ((1,2),(7,8),(5,6),(3,-4)) | f
3784  (5.1,34.5)        | ((0,0))                    | f
3785  (5.1,34.5)        | ((0,1),(0,1))              | f
3786  (-5,-12)          | ((2,0),(2,4),(0,0))        | f
3787  (-5,-12)          | ((3,1),(3,3),(1,0))        | f
3788  (-5,-12)          | ((1,2),(3,4),(5,6),(7,8))  | f
3789  (-5,-12)          | ((7,8),(5,6),(3,4),(1,2))  | f
3790  (-5,-12)          | ((1,2),(7,8),(5,6),(3,-4)) | f
3791  (-5,-12)          | ((0,0))                    | f
3792  (-5,-12)          | ((0,1),(0,1))              | f
3793  (1e-300,-1e-300)  | ((2,0),(2,4),(0,0))        | t
3794  (1e-300,-1e-300)  | ((3,1),(3,3),(1,0))        | f
3795  (1e-300,-1e-300)  | ((1,2),(3,4),(5,6),(7,8))  | f
3796  (1e-300,-1e-300)  | ((7,8),(5,6),(3,4),(1,2))  | f
3797  (1e-300,-1e-300)  | ((1,2),(7,8),(5,6),(3,-4)) | f
3798  (1e-300,-1e-300)  | ((0,0))                    | t
3799  (1e-300,-1e-300)  | ((0,1),(0,1))              | f
3800  (1e+300,Infinity) | ((2,0),(2,4),(0,0))        | f
3801  (1e+300,Infinity) | ((3,1),(3,3),(1,0))        | f
3802  (1e+300,Infinity) | ((1,2),(3,4),(5,6),(7,8))  | f
3803  (1e+300,Infinity) | ((7,8),(5,6),(3,4),(1,2))  | f
3804  (1e+300,Infinity) | ((1,2),(7,8),(5,6),(3,-4)) | f
3805  (1e+300,Infinity) | ((0,0))                    | f
3806  (1e+300,Infinity) | ((0,1),(0,1))              | f
3807  (Infinity,1e+300) | ((2,0),(2,4),(0,0))        | f
3808  (Infinity,1e+300) | ((3,1),(3,3),(1,0))        | f
3809  (Infinity,1e+300) | ((1,2),(3,4),(5,6),(7,8))  | f
3810  (Infinity,1e+300) | ((7,8),(5,6),(3,4),(1,2))  | f
3811  (Infinity,1e+300) | ((1,2),(7,8),(5,6),(3,-4)) | f
3812  (Infinity,1e+300) | ((0,0))                    | f
3813  (Infinity,1e+300) | ((0,1),(0,1))              | f
3814  (NaN,NaN)         | ((2,0),(2,4),(0,0))        | t
3815  (NaN,NaN)         | ((3,1),(3,3),(1,0))        | t
3816  (NaN,NaN)         | ((1,2),(3,4),(5,6),(7,8))  | t
3817  (NaN,NaN)         | ((7,8),(5,6),(3,4),(1,2))  | t
3818  (NaN,NaN)         | ((1,2),(7,8),(5,6),(3,-4)) | t
3819  (NaN,NaN)         | ((0,0))                    | t
3820  (NaN,NaN)         | ((0,1),(0,1))              | t
3821  (10,10)           | ((2,0),(2,4),(0,0))        | f
3822  (10,10)           | ((3,1),(3,3),(1,0))        | f
3823  (10,10)           | ((1,2),(3,4),(5,6),(7,8))  | f
3824  (10,10)           | ((7,8),(5,6),(3,4),(1,2))  | f
3825  (10,10)           | ((1,2),(7,8),(5,6),(3,-4)) | f
3826  (10,10)           | ((0,0))                    | f
3827  (10,10)           | ((0,1),(0,1))              | f
3828 (70 rows)
3830 SELECT npoints(f1) AS npoints, f1 AS polygon
3831    FROM POLYGON_TBL;
3832  npoints |          polygon           
3833 ---------+----------------------------
3834        3 | ((2,0),(2,4),(0,0))
3835        3 | ((3,1),(3,3),(1,0))
3836        4 | ((1,2),(3,4),(5,6),(7,8))
3837        4 | ((7,8),(5,6),(3,4),(1,2))
3838        4 | ((1,2),(7,8),(5,6),(3,-4))
3839        1 | ((0,0))
3840        2 | ((0,1),(0,1))
3841 (7 rows)
3843 SELECT polygon(f1)
3844    FROM BOX_TBL;
3845                   polygon                  
3846 -------------------------------------------
3847  ((0,0),(0,2),(2,2),(2,0))
3848  ((1,1),(1,3),(3,3),(3,1))
3849  ((-8,-10),(-8,2),(-2,2),(-2,-10))
3850  ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5))
3851  ((3,3),(3,3),(3,3),(3,3))
3852 (5 rows)
3854 SELECT polygon(f1)
3855    FROM PATH_TBL WHERE isclosed(f1);
3856       polygon      
3857 -------------------
3858  ((1,2),(3,4))
3859  ((1,2),(3,4))
3860  ((1,2),(3,4))
3861  ((10,20))
3862  ((11,12),(13,14))
3863 (5 rows)
3865 SELECT f1 AS open_path, polygon( pclose(f1)) AS polygon
3866    FROM PATH_TBL
3867    WHERE isopen(f1);
3868          open_path         |          polygon          
3869 ---------------------------+---------------------------
3870  [(1,2),(3,4)]             | ((1,2),(3,4))
3871  [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6))
3872  [(1,2),(3,4)]             | ((1,2),(3,4))
3873  [(11,12),(13,14)]         | ((11,12),(13,14))
3874 (4 rows)
3876 -- To box
3877 SELECT f1, f1::box FROM POLYGON_TBL;
3878              f1             |      f1      
3879 ----------------------------+--------------
3880  ((2,0),(2,4),(0,0))        | (2,4),(0,0)
3881  ((3,1),(3,3),(1,0))        | (3,3),(1,0)
3882  ((1,2),(3,4),(5,6),(7,8))  | (7,8),(1,2)
3883  ((7,8),(5,6),(3,4),(1,2))  | (7,8),(1,2)
3884  ((1,2),(7,8),(5,6),(3,-4)) | (7,8),(1,-4)
3885  ((0,0))                    | (0,0),(0,0)
3886  ((0,1),(0,1))              | (0,1),(0,1)
3887 (7 rows)
3889 -- To path
3890 SELECT f1, f1::path FROM POLYGON_TBL;
3891              f1             |             f1             
3892 ----------------------------+----------------------------
3893  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3894  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3895  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3896  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3897  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3898  ((0,0))                    | ((0,0))
3899  ((0,1),(0,1))              | ((0,1),(0,1))
3900 (7 rows)
3902 -- Same as polygon
3903 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 ~= p2.f1;
3904              f1             |             f1             
3905 ----------------------------+----------------------------
3906  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3907  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3908  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3909  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3910  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
3911  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3912  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3913  ((0,0))                    | ((0,0))
3914  ((0,1),(0,1))              | ((0,1),(0,1))
3915 (9 rows)
3917 -- Contained by polygon
3918 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <@ p2.f1;
3919              f1             |             f1             
3920 ----------------------------+----------------------------
3921  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3922  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3923  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3924  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3925  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
3926  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
3927  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3928  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
3929  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3930  ((0,0))                    | ((2,0),(2,4),(0,0))
3931  ((0,0))                    | ((0,0))
3932  ((0,1),(0,1))              | ((0,1),(0,1))
3933 (12 rows)
3935 -- Contains polygon
3936 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 @> p2.f1;
3937              f1             |             f1             
3938 ----------------------------+----------------------------
3939  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3940  ((2,0),(2,4),(0,0))        | ((0,0))
3941  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3942  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3943  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3944  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
3945  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3946  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
3947  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
3948  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3949  ((0,0))                    | ((0,0))
3950  ((0,1),(0,1))              | ((0,1),(0,1))
3951 (12 rows)
3953 -- Overlap with polygon
3954 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 && p2.f1;
3955              f1             |             f1             
3956 ----------------------------+----------------------------
3957  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3958  ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
3959  ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
3960  ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
3961  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
3962  ((2,0),(2,4),(0,0))        | ((0,0))
3963  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
3964  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3965  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
3966  ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
3967  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3968  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3969  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
3970  ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
3971  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
3972  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3973  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
3974  ((1,2),(7,8),(5,6),(3,-4)) | ((2,0),(2,4),(0,0))
3975  ((1,2),(7,8),(5,6),(3,-4)) | ((3,1),(3,3),(1,0))
3976  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
3977  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
3978  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3979  ((0,0))                    | ((2,0),(2,4),(0,0))
3980  ((0,0))                    | ((0,0))
3981  ((0,1),(0,1))              | ((0,1),(0,1))
3982 (25 rows)
3984 -- Left of polygon
3985 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 << p2.f1;
3986       f1       |             f1             
3987 ---------------+----------------------------
3988  ((0,0))       | ((3,1),(3,3),(1,0))
3989  ((0,0))       | ((1,2),(3,4),(5,6),(7,8))
3990  ((0,0))       | ((7,8),(5,6),(3,4),(1,2))
3991  ((0,0))       | ((1,2),(7,8),(5,6),(3,-4))
3992  ((0,1),(0,1)) | ((3,1),(3,3),(1,0))
3993  ((0,1),(0,1)) | ((1,2),(3,4),(5,6),(7,8))
3994  ((0,1),(0,1)) | ((7,8),(5,6),(3,4),(1,2))
3995  ((0,1),(0,1)) | ((1,2),(7,8),(5,6),(3,-4))
3996 (8 rows)
3998 -- Overlap of left of polygon
3999 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &< p2.f1;
4000              f1             |             f1             
4001 ----------------------------+----------------------------
4002  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
4003  ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
4004  ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
4005  ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
4006  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
4007  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
4008  ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
4009  ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
4010  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
4011  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
4012  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
4013  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
4014  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
4015  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
4016  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
4017  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
4018  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
4019  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
4020  ((0,0))                    | ((2,0),(2,4),(0,0))
4021  ((0,0))                    | ((3,1),(3,3),(1,0))
4022  ((0,0))                    | ((1,2),(3,4),(5,6),(7,8))
4023  ((0,0))                    | ((7,8),(5,6),(3,4),(1,2))
4024  ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
4025  ((0,0))                    | ((0,0))
4026  ((0,0))                    | ((0,1),(0,1))
4027  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
4028  ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
4029  ((0,1),(0,1))              | ((1,2),(3,4),(5,6),(7,8))
4030  ((0,1),(0,1))              | ((7,8),(5,6),(3,4),(1,2))
4031  ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
4032  ((0,1),(0,1))              | ((0,0))
4033  ((0,1),(0,1))              | ((0,1),(0,1))
4034 (32 rows)
4036 -- Right of polygon
4037 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 >> p2.f1;
4038              f1             |      f1       
4039 ----------------------------+---------------
4040  ((3,1),(3,3),(1,0))        | ((0,0))
4041  ((3,1),(3,3),(1,0))        | ((0,1),(0,1))
4042  ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
4043  ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
4044  ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
4045  ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
4046  ((1,2),(7,8),(5,6),(3,-4)) | ((0,0))
4047  ((1,2),(7,8),(5,6),(3,-4)) | ((0,1),(0,1))
4048 (8 rows)
4050 -- Overlap of right of polygon
4051 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &> p2.f1;
4052              f1             |             f1             
4053 ----------------------------+----------------------------
4054  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
4055  ((2,0),(2,4),(0,0))        | ((0,0))
4056  ((2,0),(2,4),(0,0))        | ((0,1),(0,1))
4057  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
4058  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
4059  ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
4060  ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
4061  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
4062  ((3,1),(3,3),(1,0))        | ((0,0))
4063  ((3,1),(3,3),(1,0))        | ((0,1),(0,1))
4064  ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
4065  ((1,2),(3,4),(5,6),(7,8))  | ((3,1),(3,3),(1,0))
4066  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
4067  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
4068  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
4069  ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
4070  ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
4071  ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
4072  ((7,8),(5,6),(3,4),(1,2))  | ((3,1),(3,3),(1,0))
4073  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
4074  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
4075  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
4076  ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
4077  ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
4078  ((1,2),(7,8),(5,6),(3,-4)) | ((2,0),(2,4),(0,0))
4079  ((1,2),(7,8),(5,6),(3,-4)) | ((3,1),(3,3),(1,0))
4080  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
4081  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
4082  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
4083  ((1,2),(7,8),(5,6),(3,-4)) | ((0,0))
4084  ((1,2),(7,8),(5,6),(3,-4)) | ((0,1),(0,1))
4085  ((0,0))                    | ((2,0),(2,4),(0,0))
4086  ((0,0))                    | ((0,0))
4087  ((0,0))                    | ((0,1),(0,1))
4088  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
4089  ((0,1),(0,1))              | ((0,0))
4090  ((0,1),(0,1))              | ((0,1),(0,1))
4091 (37 rows)
4093 -- Below polygon
4094 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <<| p2.f1;
4095       f1       |            f1             
4096 ---------------+---------------------------
4097  ((0,0))       | ((1,2),(3,4),(5,6),(7,8))
4098  ((0,0))       | ((7,8),(5,6),(3,4),(1,2))
4099  ((0,0))       | ((0,1),(0,1))
4100  ((0,1),(0,1)) | ((1,2),(3,4),(5,6),(7,8))
4101  ((0,1),(0,1)) | ((7,8),(5,6),(3,4),(1,2))
4102 (5 rows)
4104 -- Overlap or below polygon
4105 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &<| p2.f1;
4106              f1             |             f1             
4107 ----------------------------+----------------------------
4108  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
4109  ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
4110  ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
4111  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
4112  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
4113  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
4114  ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
4115  ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
4116  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
4117  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
4118  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
4119  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
4120  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
4121  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
4122  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
4123  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
4124  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
4125  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
4126  ((0,0))                    | ((2,0),(2,4),(0,0))
4127  ((0,0))                    | ((3,1),(3,3),(1,0))
4128  ((0,0))                    | ((1,2),(3,4),(5,6),(7,8))
4129  ((0,0))                    | ((7,8),(5,6),(3,4),(1,2))
4130  ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
4131  ((0,0))                    | ((0,0))
4132  ((0,0))                    | ((0,1),(0,1))
4133  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
4134  ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
4135  ((0,1),(0,1))              | ((1,2),(3,4),(5,6),(7,8))
4136  ((0,1),(0,1))              | ((7,8),(5,6),(3,4),(1,2))
4137  ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
4138  ((0,1),(0,1))              | ((0,1),(0,1))
4139 (31 rows)
4141 -- Above polygon
4142 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |>> p2.f1;
4143             f1             |      f1       
4144 ---------------------------+---------------
4145  ((1,2),(3,4),(5,6),(7,8)) | ((0,0))
4146  ((1,2),(3,4),(5,6),(7,8)) | ((0,1),(0,1))
4147  ((7,8),(5,6),(3,4),(1,2)) | ((0,0))
4148  ((7,8),(5,6),(3,4),(1,2)) | ((0,1),(0,1))
4149  ((0,1),(0,1))             | ((0,0))
4150 (5 rows)
4152 -- Overlap or above polygon
4153 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |&> p2.f1;
4154              f1             |             f1             
4155 ----------------------------+----------------------------
4156  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
4157  ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
4158  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
4159  ((2,0),(2,4),(0,0))        | ((0,0))
4160  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
4161  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
4162  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
4163  ((3,1),(3,3),(1,0))        | ((0,0))
4164  ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
4165  ((1,2),(3,4),(5,6),(7,8))  | ((3,1),(3,3),(1,0))
4166  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
4167  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
4168  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
4169  ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
4170  ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
4171  ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
4172  ((7,8),(5,6),(3,4),(1,2))  | ((3,1),(3,3),(1,0))
4173  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
4174  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
4175  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
4176  ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
4177  ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
4178  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
4179  ((0,0))                    | ((2,0),(2,4),(0,0))
4180  ((0,0))                    | ((3,1),(3,3),(1,0))
4181  ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
4182  ((0,0))                    | ((0,0))
4183  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
4184  ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
4185  ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
4186  ((0,1),(0,1))              | ((0,0))
4187  ((0,1),(0,1))              | ((0,1),(0,1))
4188 (32 rows)
4190 -- Distance to polygon
4191 SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2;
4192 ERROR:  function "poly_distance" not implemented
4194 -- Circles
4196 SELECT circle(f1, 50.0)
4197    FROM POINT_TBL;
4198          circle         
4199 ------------------------
4200  <(0,0),50>
4201  <(-10,0),50>
4202  <(-3,4),50>
4203  <(5.1,34.5),50>
4204  <(-5,-12),50>
4205  <(1e-300,-1e-300),50>
4206  <(1e+300,Infinity),50>
4207  <(Infinity,1e+300),50>
4208  <(NaN,NaN),50>
4209  <(10,10),50>
4210 (10 rows)
4212 SELECT circle(f1)
4213    FROM BOX_TBL;
4214          circle         
4215 ------------------------
4216  <(1,1),1.41421356237>
4217  <(2,2),1.41421356237>
4218  <(-5,-4),6.7082039325>
4219  <(2.5,3),0.5>
4220  <(3,3),0>
4221 (5 rows)
4223 SELECT circle(f1)
4224    FROM POLYGON_TBL
4225    WHERE (# f1) >= 3;
4226                     circle                     
4227 -----------------------------------------------
4228  <(1.33333333333,1.33333333333),2.04168905064>
4229  <(2.33333333333,1.33333333333),1.47534300379>
4230  <(4,5),2.82842712475>
4231  <(4,5),2.82842712475>
4232  <(4,3),4.80664375676>
4233 (5 rows)
4235 SELECT c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
4236    FROM CIRCLE_TBL c1, POINT_TBL p1
4237    WHERE (p1.f1 <-> c1.f1) > 0
4238    ORDER BY distance, area(c1.f1), p1.f1[0];
4239      circle     |       point       |   distance    
4240 ----------------+-------------------+---------------
4241  <(1,2),3>      | (-3,4)            |   1.472135955
4242  <(5,1),3>      | (0,0)             | 2.09901951359
4243  <(5,1),3>      | (1e-300,-1e-300)  | 2.09901951359
4244  <(5,1),3>      | (-3,4)            | 5.54400374532
4245  <(3,5),0>      | (0,0)             | 5.83095189485
4246  <(3,5),0>      | (1e-300,-1e-300)  | 5.83095189485
4247  <(3,5),0>      | (-3,4)            |  6.0827625303
4248  <(1,3),5>      | (-10,0)           | 6.40175425099
4249  <(1,3),5>      | (10,10)           | 6.40175425099
4250  <(5,1),3>      | (10,10)           | 7.29563014099
4251  <(1,2),3>      | (-10,0)           |  8.1803398875
4252  <(3,5),0>      | (10,10)           | 8.60232526704
4253  <(1,2),3>      | (10,10)           | 9.04159457879
4254  <(1,3),5>      | (-5,-12)          | 11.1554944214
4255  <(5,1),3>      | (-10,0)           | 12.0332963784
4256  <(1,2),3>      | (-5,-12)          | 12.2315462117
4257  <(5,1),3>      | (-5,-12)          | 13.4012194669
4258  <(3,5),0>      | (-10,0)           | 13.9283882772
4259  <(3,5),0>      | (-5,-12)          | 18.7882942281
4260  <(1,3),5>      | (5.1,34.5)        | 26.7657047773
4261  <(3,5),0>      | (5.1,34.5)        | 29.5746513082
4262  <(1,2),3>      | (5.1,34.5)        | 29.7575945393
4263  <(5,1),3>      | (5.1,34.5)        | 30.5001492534
4264  <(100,200),10> | (5.1,34.5)        | 180.778038568
4265  <(100,200),10> | (10,10)           | 200.237960416
4266  <(100,200),10> | (-3,4)            | 211.415898255
4267  <(100,200),10> | (0,0)             |  213.60679775
4268  <(100,200),10> | (1e-300,-1e-300)  |  213.60679775
4269  <(100,200),10> | (-10,0)           |  218.25424421
4270  <(100,200),10> | (-5,-12)          | 226.577682802
4271  <(3,5),0>      | (1e+300,Infinity) |      Infinity
4272  <(3,5),0>      | (Infinity,1e+300) |      Infinity
4273  <(1,2),3>      | (1e+300,Infinity) |      Infinity
4274  <(5,1),3>      | (1e+300,Infinity) |      Infinity
4275  <(5,1),3>      | (Infinity,1e+300) |      Infinity
4276  <(1,2),3>      | (Infinity,1e+300) |      Infinity
4277  <(1,3),5>      | (1e+300,Infinity) |      Infinity
4278  <(1,3),5>      | (Infinity,1e+300) |      Infinity
4279  <(100,200),10> | (1e+300,Infinity) |      Infinity
4280  <(100,200),10> | (Infinity,1e+300) |      Infinity
4281  <(1,2),100>    | (1e+300,Infinity) |      Infinity
4282  <(1,2),100>    | (Infinity,1e+300) |      Infinity
4283  <(100,1),115>  | (1e+300,Infinity) |      Infinity
4284  <(100,1),115>  | (Infinity,1e+300) |      Infinity
4285  <(3,5),0>      | (NaN,NaN)         |           NaN
4286  <(1,2),3>      | (NaN,NaN)         |           NaN
4287  <(5,1),3>      | (NaN,NaN)         |           NaN
4288  <(1,3),5>      | (NaN,NaN)         |           NaN
4289  <(100,200),10> | (NaN,NaN)         |           NaN
4290  <(1,2),100>    | (NaN,NaN)         |           NaN
4291  <(100,1),115>  | (NaN,NaN)         |           NaN
4292  <(3,5),NaN>    | (-10,0)           |           NaN
4293  <(3,5),NaN>    | (-5,-12)          |           NaN
4294  <(3,5),NaN>    | (-3,4)            |           NaN
4295  <(3,5),NaN>    | (0,0)             |           NaN
4296  <(3,5),NaN>    | (1e-300,-1e-300)  |           NaN
4297  <(3,5),NaN>    | (5.1,34.5)        |           NaN
4298  <(3,5),NaN>    | (10,10)           |           NaN
4299  <(3,5),NaN>    | (1e+300,Infinity) |           NaN
4300  <(3,5),NaN>    | (Infinity,1e+300) |           NaN
4301  <(3,5),NaN>    | (NaN,NaN)         |           NaN
4302 (61 rows)
4304 -- To polygon
4305 SELECT f1, f1::polygon FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
4306        f1       |                                                                                                          f1                                                                                                          
4307 ----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4308  <(5,1),3>      | ((2,1),(2.40192378865,2.5),(3.5,3.59807621135),(5,4),(6.5,3.59807621135),(7.59807621135,2.5),(8,1),(7.59807621135,-0.5),(6.5,-1.59807621135),(5,-2),(3.5,-1.59807621135),(2.40192378865,-0.5))
4309  <(1,2),100>    | ((-99,2),(-85.6025403784,52),(-49,88.6025403784),(1,102),(51,88.6025403784),(87.6025403784,52),(101,2),(87.6025403784,-48),(51,-84.6025403784),(1,-98),(-49,-84.6025403784),(-85.6025403784,-48))
4310  <(1,3),5>      | ((-4,3),(-3.33012701892,5.5),(-1.5,7.33012701892),(1,8),(3.5,7.33012701892),(5.33012701892,5.5),(6,3),(5.33012701892,0.5),(3.5,-1.33012701892),(1,-2),(-1.5,-1.33012701892),(-3.33012701892,0.5))
4311  <(1,2),3>      | ((-2,2),(-1.59807621135,3.5),(-0.5,4.59807621135),(1,5),(2.5,4.59807621135),(3.59807621135,3.5),(4,2),(3.59807621135,0.5),(2.5,-0.598076211353),(1,-1),(-0.5,-0.598076211353),(-1.59807621135,0.5))
4312  <(100,200),10> | ((90,200),(91.3397459622,205),(95,208.660254038),(100,210),(105,208.660254038),(108.660254038,205),(110,200),(108.660254038,195),(105,191.339745962),(100,190),(95,191.339745962),(91.3397459622,195))
4313  <(100,1),115>  | ((-15,1),(0.40707856479,58.5),(42.5,100.592921435),(100,116),(157.5,100.592921435),(199.592921435,58.5),(215,1),(199.592921435,-56.5),(157.5,-98.5929214352),(100,-114),(42.5,-98.5929214352),(0.40707856479,-56.5))
4314 (6 rows)
4316 -- To polygon with less points
4317 SELECT f1, polygon(8, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
4318        f1       |                                                                             polygon                                                                              
4319 ----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------
4320  <(5,1),3>      | ((2,1),(2.87867965644,3.12132034356),(5,4),(7.12132034356,3.12132034356),(8,1),(7.12132034356,-1.12132034356),(5,-2),(2.87867965644,-1.12132034356))
4321  <(1,2),100>    | ((-99,2),(-69.7106781187,72.7106781187),(1,102),(71.7106781187,72.7106781187),(101,2),(71.7106781187,-68.7106781187),(1,-98),(-69.7106781187,-68.7106781187))
4322  <(1,3),5>      | ((-4,3),(-2.53553390593,6.53553390593),(1,8),(4.53553390593,6.53553390593),(6,3),(4.53553390593,-0.535533905933),(1,-2),(-2.53553390593,-0.535533905933))
4323  <(1,2),3>      | ((-2,2),(-1.12132034356,4.12132034356),(1,5),(3.12132034356,4.12132034356),(4,2),(3.12132034356,-0.12132034356),(1,-1),(-1.12132034356,-0.12132034356))
4324  <(100,200),10> | ((90,200),(92.9289321881,207.071067812),(100,210),(107.071067812,207.071067812),(110,200),(107.071067812,192.928932188),(100,190),(92.9289321881,192.928932188))
4325  <(100,1),115>  | ((-15,1),(18.6827201635,82.3172798365),(100,116),(181.317279836,82.3172798365),(215,1),(181.317279836,-80.3172798365),(100,-114),(18.6827201635,-80.3172798365))
4326 (6 rows)
4328 -- Error for insufficient number of points
4329 SELECT f1, polygon(1, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
4330 ERROR:  must request at least 2 points
4331 -- Zero radius error
4332 SELECT f1, polygon(10, f1) FROM CIRCLE_TBL WHERE f1 < '<(0,0),1>';
4333 ERROR:  cannot convert circle with radius zero to polygon
4334 -- Same as circle
4335 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 ~= c2.f1;
4336        f1       |       f1       
4337 ----------------+----------------
4338  <(5,1),3>      | <(5,1),3>
4339  <(1,2),100>    | <(1,2),100>
4340  <(1,3),5>      | <(1,3),5>
4341  <(1,2),3>      | <(1,2),3>
4342  <(100,200),10> | <(100,200),10>
4343  <(100,1),115>  | <(100,1),115>
4344  <(3,5),0>      | <(3,5),0>
4345  <(3,5),NaN>    | <(3,5),0>
4346  <(3,5),NaN>    | <(3,5),NaN>
4347 (9 rows)
4349 -- Overlap with circle
4350 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 && c2.f1;
4351        f1       |       f1       
4352 ----------------+----------------
4353  <(5,1),3>      | <(5,1),3>
4354  <(5,1),3>      | <(1,2),100>
4355  <(5,1),3>      | <(1,3),5>
4356  <(5,1),3>      | <(1,2),3>
4357  <(5,1),3>      | <(100,1),115>
4358  <(1,2),100>    | <(5,1),3>
4359  <(1,2),100>    | <(1,2),100>
4360  <(1,2),100>    | <(1,3),5>
4361  <(1,2),100>    | <(1,2),3>
4362  <(1,2),100>    | <(100,1),115>
4363  <(1,2),100>    | <(3,5),0>
4364  <(1,3),5>      | <(5,1),3>
4365  <(1,3),5>      | <(1,2),100>
4366  <(1,3),5>      | <(1,3),5>
4367  <(1,3),5>      | <(1,2),3>
4368  <(1,3),5>      | <(100,1),115>
4369  <(1,3),5>      | <(3,5),0>
4370  <(1,2),3>      | <(5,1),3>
4371  <(1,2),3>      | <(1,2),100>
4372  <(1,2),3>      | <(1,3),5>
4373  <(1,2),3>      | <(1,2),3>
4374  <(1,2),3>      | <(100,1),115>
4375  <(100,200),10> | <(100,200),10>
4376  <(100,1),115>  | <(5,1),3>
4377  <(100,1),115>  | <(1,2),100>
4378  <(100,1),115>  | <(1,3),5>
4379  <(100,1),115>  | <(1,2),3>
4380  <(100,1),115>  | <(100,1),115>
4381  <(100,1),115>  | <(3,5),0>
4382  <(3,5),0>      | <(1,2),100>
4383  <(3,5),0>      | <(1,3),5>
4384  <(3,5),0>      | <(100,1),115>
4385  <(3,5),0>      | <(3,5),0>
4386 (33 rows)
4388 -- Overlap or left of circle
4389 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &< c2.f1;
4390        f1       |       f1       
4391 ----------------+----------------
4392  <(5,1),3>      | <(5,1),3>
4393  <(5,1),3>      | <(1,2),100>
4394  <(5,1),3>      | <(100,200),10>
4395  <(5,1),3>      | <(100,1),115>
4396  <(1,2),100>    | <(1,2),100>
4397  <(1,2),100>    | <(100,200),10>
4398  <(1,2),100>    | <(100,1),115>
4399  <(1,3),5>      | <(5,1),3>
4400  <(1,3),5>      | <(1,2),100>
4401  <(1,3),5>      | <(1,3),5>
4402  <(1,3),5>      | <(100,200),10>
4403  <(1,3),5>      | <(100,1),115>
4404  <(1,2),3>      | <(5,1),3>
4405  <(1,2),3>      | <(1,2),100>
4406  <(1,2),3>      | <(1,3),5>
4407  <(1,2),3>      | <(1,2),3>
4408  <(1,2),3>      | <(100,200),10>
4409  <(1,2),3>      | <(100,1),115>
4410  <(100,200),10> | <(100,200),10>
4411  <(100,200),10> | <(100,1),115>
4412  <(100,1),115>  | <(100,1),115>
4413  <(3,5),0>      | <(5,1),3>
4414  <(3,5),0>      | <(1,2),100>
4415  <(3,5),0>      | <(1,3),5>
4416  <(3,5),0>      | <(1,2),3>
4417  <(3,5),0>      | <(100,200),10>
4418  <(3,5),0>      | <(100,1),115>
4419  <(3,5),0>      | <(3,5),0>
4420 (28 rows)
4422 -- Left of circle
4423 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 << c2.f1;
4424     f1     |       f1       
4425 -----------+----------------
4426  <(5,1),3> | <(100,200),10>
4427  <(1,3),5> | <(100,200),10>
4428  <(1,2),3> | <(100,200),10>
4429  <(3,5),0> | <(100,200),10>
4430 (4 rows)
4432 -- Right of circle
4433 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >> c2.f1;
4434        f1       |    f1     
4435 ----------------+-----------
4436  <(100,200),10> | <(5,1),3>
4437  <(100,200),10> | <(1,3),5>
4438  <(100,200),10> | <(1,2),3>
4439  <(100,200),10> | <(3,5),0>
4440 (4 rows)
4442 -- Overlap or right of circle
4443 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &> c2.f1;
4444        f1       |       f1       
4445 ----------------+----------------
4446  <(5,1),3>      | <(5,1),3>
4447  <(5,1),3>      | <(1,2),100>
4448  <(5,1),3>      | <(1,3),5>
4449  <(5,1),3>      | <(1,2),3>
4450  <(5,1),3>      | <(100,1),115>
4451  <(1,2),100>    | <(1,2),100>
4452  <(1,3),5>      | <(1,2),100>
4453  <(1,3),5>      | <(1,3),5>
4454  <(1,3),5>      | <(100,1),115>
4455  <(1,2),3>      | <(1,2),100>
4456  <(1,2),3>      | <(1,3),5>
4457  <(1,2),3>      | <(1,2),3>
4458  <(1,2),3>      | <(100,1),115>
4459  <(100,200),10> | <(5,1),3>
4460  <(100,200),10> | <(1,2),100>
4461  <(100,200),10> | <(1,3),5>
4462  <(100,200),10> | <(1,2),3>
4463  <(100,200),10> | <(100,200),10>
4464  <(100,200),10> | <(100,1),115>
4465  <(100,200),10> | <(3,5),0>
4466  <(100,1),115>  | <(1,2),100>
4467  <(100,1),115>  | <(100,1),115>
4468  <(3,5),0>      | <(5,1),3>
4469  <(3,5),0>      | <(1,2),100>
4470  <(3,5),0>      | <(1,3),5>
4471  <(3,5),0>      | <(1,2),3>
4472  <(3,5),0>      | <(100,1),115>
4473  <(3,5),0>      | <(3,5),0>
4474 (28 rows)
4476 -- Contained by circle
4477 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <@ c2.f1;
4478        f1       |       f1       
4479 ----------------+----------------
4480  <(5,1),3>      | <(5,1),3>
4481  <(5,1),3>      | <(1,2),100>
4482  <(5,1),3>      | <(100,1),115>
4483  <(1,2),100>    | <(1,2),100>
4484  <(1,3),5>      | <(1,2),100>
4485  <(1,3),5>      | <(1,3),5>
4486  <(1,3),5>      | <(100,1),115>
4487  <(1,2),3>      | <(1,2),100>
4488  <(1,2),3>      | <(1,3),5>
4489  <(1,2),3>      | <(1,2),3>
4490  <(1,2),3>      | <(100,1),115>
4491  <(100,200),10> | <(100,200),10>
4492  <(100,1),115>  | <(100,1),115>
4493  <(3,5),0>      | <(1,2),100>
4494  <(3,5),0>      | <(1,3),5>
4495  <(3,5),0>      | <(100,1),115>
4496  <(3,5),0>      | <(3,5),0>
4497 (17 rows)
4499 -- Contain by circle
4500 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 @> c2.f1;
4501        f1       |       f1       
4502 ----------------+----------------
4503  <(5,1),3>      | <(5,1),3>
4504  <(1,2),100>    | <(5,1),3>
4505  <(1,2),100>    | <(1,2),100>
4506  <(1,2),100>    | <(1,3),5>
4507  <(1,2),100>    | <(1,2),3>
4508  <(1,2),100>    | <(3,5),0>
4509  <(1,3),5>      | <(1,3),5>
4510  <(1,3),5>      | <(1,2),3>
4511  <(1,3),5>      | <(3,5),0>
4512  <(1,2),3>      | <(1,2),3>
4513  <(100,200),10> | <(100,200),10>
4514  <(100,1),115>  | <(5,1),3>
4515  <(100,1),115>  | <(1,3),5>
4516  <(100,1),115>  | <(1,2),3>
4517  <(100,1),115>  | <(100,1),115>
4518  <(100,1),115>  | <(3,5),0>
4519  <(3,5),0>      | <(3,5),0>
4520 (17 rows)
4522 -- Below circle
4523 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <<| c2.f1;
4524       f1       |       f1       
4525 ---------------+----------------
4526  <(5,1),3>     | <(100,200),10>
4527  <(5,1),3>     | <(3,5),0>
4528  <(1,2),100>   | <(100,200),10>
4529  <(1,3),5>     | <(100,200),10>
4530  <(1,2),3>     | <(100,200),10>
4531  <(100,1),115> | <(100,200),10>
4532  <(3,5),0>     | <(100,200),10>
4533 (7 rows)
4535 -- Above circle
4536 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |>> c2.f1;
4537        f1       |      f1       
4538 ----------------+---------------
4539  <(100,200),10> | <(5,1),3>
4540  <(100,200),10> | <(1,2),100>
4541  <(100,200),10> | <(1,3),5>
4542  <(100,200),10> | <(1,2),3>
4543  <(100,200),10> | <(100,1),115>
4544  <(100,200),10> | <(3,5),0>
4545  <(3,5),0>      | <(5,1),3>
4546 (7 rows)
4548 -- Overlap or below circle
4549 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &<| c2.f1;
4550        f1       |       f1       
4551 ----------------+----------------
4552  <(5,1),3>      | <(5,1),3>
4553  <(5,1),3>      | <(1,2),100>
4554  <(5,1),3>      | <(1,3),5>
4555  <(5,1),3>      | <(1,2),3>
4556  <(5,1),3>      | <(100,200),10>
4557  <(5,1),3>      | <(100,1),115>
4558  <(5,1),3>      | <(3,5),0>
4559  <(1,2),100>    | <(1,2),100>
4560  <(1,2),100>    | <(100,200),10>
4561  <(1,2),100>    | <(100,1),115>
4562  <(1,3),5>      | <(1,2),100>
4563  <(1,3),5>      | <(1,3),5>
4564  <(1,3),5>      | <(100,200),10>
4565  <(1,3),5>      | <(100,1),115>
4566  <(1,2),3>      | <(1,2),100>
4567  <(1,2),3>      | <(1,3),5>
4568  <(1,2),3>      | <(1,2),3>
4569  <(1,2),3>      | <(100,200),10>
4570  <(1,2),3>      | <(100,1),115>
4571  <(1,2),3>      | <(3,5),0>
4572  <(100,200),10> | <(100,200),10>
4573  <(100,1),115>  | <(100,200),10>
4574  <(100,1),115>  | <(100,1),115>
4575  <(3,5),0>      | <(1,2),100>
4576  <(3,5),0>      | <(1,3),5>
4577  <(3,5),0>      | <(1,2),3>
4578  <(3,5),0>      | <(100,200),10>
4579  <(3,5),0>      | <(100,1),115>
4580  <(3,5),0>      | <(3,5),0>
4581 (29 rows)
4583 -- Overlap or above circle
4584 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |&> c2.f1;
4585        f1       |       f1       
4586 ----------------+----------------
4587  <(5,1),3>      | <(5,1),3>
4588  <(5,1),3>      | <(1,2),100>
4589  <(5,1),3>      | <(1,3),5>
4590  <(5,1),3>      | <(100,1),115>
4591  <(1,2),100>    | <(1,2),100>
4592  <(1,2),100>    | <(100,1),115>
4593  <(1,3),5>      | <(5,1),3>
4594  <(1,3),5>      | <(1,2),100>
4595  <(1,3),5>      | <(1,3),5>
4596  <(1,3),5>      | <(100,1),115>
4597  <(1,2),3>      | <(5,1),3>
4598  <(1,2),3>      | <(1,2),100>
4599  <(1,2),3>      | <(1,3),5>
4600  <(1,2),3>      | <(1,2),3>
4601  <(1,2),3>      | <(100,1),115>
4602  <(100,200),10> | <(5,1),3>
4603  <(100,200),10> | <(1,2),100>
4604  <(100,200),10> | <(1,3),5>
4605  <(100,200),10> | <(1,2),3>
4606  <(100,200),10> | <(100,200),10>
4607  <(100,200),10> | <(100,1),115>
4608  <(100,200),10> | <(3,5),0>
4609  <(100,1),115>  | <(100,1),115>
4610  <(3,5),0>      | <(5,1),3>
4611  <(3,5),0>      | <(1,2),100>
4612  <(3,5),0>      | <(1,3),5>
4613  <(3,5),0>      | <(1,2),3>
4614  <(3,5),0>      | <(100,1),115>
4615  <(3,5),0>      | <(3,5),0>
4616 (29 rows)
4618 -- Area equal with circle
4619 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 = c2.f1;
4620        f1       |       f1       
4621 ----------------+----------------
4622  <(5,1),3>      | <(5,1),3>
4623  <(5,1),3>      | <(1,2),3>
4624  <(1,2),100>    | <(1,2),100>
4625  <(1,3),5>      | <(1,3),5>
4626  <(1,2),3>      | <(5,1),3>
4627  <(1,2),3>      | <(1,2),3>
4628  <(100,200),10> | <(100,200),10>
4629  <(100,1),115>  | <(100,1),115>
4630  <(3,5),0>      | <(3,5),0>
4631 (9 rows)
4633 -- Area not equal with circle
4634 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 != c2.f1;
4635        f1       |       f1       
4636 ----------------+----------------
4637  <(5,1),3>      | <(1,2),100>
4638  <(5,1),3>      | <(1,3),5>
4639  <(5,1),3>      | <(100,200),10>
4640  <(5,1),3>      | <(100,1),115>
4641  <(5,1),3>      | <(3,5),0>
4642  <(1,2),100>    | <(5,1),3>
4643  <(1,2),100>    | <(1,3),5>
4644  <(1,2),100>    | <(1,2),3>
4645  <(1,2),100>    | <(100,200),10>
4646  <(1,2),100>    | <(100,1),115>
4647  <(1,2),100>    | <(3,5),0>
4648  <(1,3),5>      | <(5,1),3>
4649  <(1,3),5>      | <(1,2),100>
4650  <(1,3),5>      | <(1,2),3>
4651  <(1,3),5>      | <(100,200),10>
4652  <(1,3),5>      | <(100,1),115>
4653  <(1,3),5>      | <(3,5),0>
4654  <(1,2),3>      | <(1,2),100>
4655  <(1,2),3>      | <(1,3),5>
4656  <(1,2),3>      | <(100,200),10>
4657  <(1,2),3>      | <(100,1),115>
4658  <(1,2),3>      | <(3,5),0>
4659  <(100,200),10> | <(5,1),3>
4660  <(100,200),10> | <(1,2),100>
4661  <(100,200),10> | <(1,3),5>
4662  <(100,200),10> | <(1,2),3>
4663  <(100,200),10> | <(100,1),115>
4664  <(100,200),10> | <(3,5),0>
4665  <(100,1),115>  | <(5,1),3>
4666  <(100,1),115>  | <(1,2),100>
4667  <(100,1),115>  | <(1,3),5>
4668  <(100,1),115>  | <(1,2),3>
4669  <(100,1),115>  | <(100,200),10>
4670  <(100,1),115>  | <(3,5),0>
4671  <(3,5),0>      | <(5,1),3>
4672  <(3,5),0>      | <(1,2),100>
4673  <(3,5),0>      | <(1,3),5>
4674  <(3,5),0>      | <(1,2),3>
4675  <(3,5),0>      | <(100,200),10>
4676  <(3,5),0>      | <(100,1),115>
4677 (40 rows)
4679 -- Area less than circle
4680 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
4681        f1       |       f1       
4682 ----------------+----------------
4683  <(5,1),3>      | <(1,2),100>
4684  <(5,1),3>      | <(1,3),5>
4685  <(5,1),3>      | <(100,200),10>
4686  <(5,1),3>      | <(100,1),115>
4687  <(1,2),100>    | <(100,1),115>
4688  <(1,3),5>      | <(1,2),100>
4689  <(1,3),5>      | <(100,200),10>
4690  <(1,3),5>      | <(100,1),115>
4691  <(1,2),3>      | <(1,2),100>
4692  <(1,2),3>      | <(1,3),5>
4693  <(1,2),3>      | <(100,200),10>
4694  <(1,2),3>      | <(100,1),115>
4695  <(100,200),10> | <(1,2),100>
4696  <(100,200),10> | <(100,1),115>
4697  <(3,5),0>      | <(5,1),3>
4698  <(3,5),0>      | <(1,2),100>
4699  <(3,5),0>      | <(1,3),5>
4700  <(3,5),0>      | <(1,2),3>
4701  <(3,5),0>      | <(100,200),10>
4702  <(3,5),0>      | <(100,1),115>
4703 (20 rows)
4705 -- Area greater than circle
4706 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 > c2.f1;
4707        f1       |       f1       
4708 ----------------+----------------
4709  <(5,1),3>      | <(3,5),0>
4710  <(1,2),100>    | <(5,1),3>
4711  <(1,2),100>    | <(1,3),5>
4712  <(1,2),100>    | <(1,2),3>
4713  <(1,2),100>    | <(100,200),10>
4714  <(1,2),100>    | <(3,5),0>
4715  <(1,3),5>      | <(5,1),3>
4716  <(1,3),5>      | <(1,2),3>
4717  <(1,3),5>      | <(3,5),0>
4718  <(1,2),3>      | <(3,5),0>
4719  <(100,200),10> | <(5,1),3>
4720  <(100,200),10> | <(1,3),5>
4721  <(100,200),10> | <(1,2),3>
4722  <(100,200),10> | <(3,5),0>
4723  <(100,1),115>  | <(5,1),3>
4724  <(100,1),115>  | <(1,2),100>
4725  <(100,1),115>  | <(1,3),5>
4726  <(100,1),115>  | <(1,2),3>
4727  <(100,1),115>  | <(100,200),10>
4728  <(100,1),115>  | <(3,5),0>
4729 (20 rows)
4731 -- Area less than or equal circle
4732 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <= c2.f1;
4733        f1       |       f1       
4734 ----------------+----------------
4735  <(5,1),3>      | <(5,1),3>
4736  <(5,1),3>      | <(1,2),100>
4737  <(5,1),3>      | <(1,3),5>
4738  <(5,1),3>      | <(1,2),3>
4739  <(5,1),3>      | <(100,200),10>
4740  <(5,1),3>      | <(100,1),115>
4741  <(1,2),100>    | <(1,2),100>
4742  <(1,2),100>    | <(100,1),115>
4743  <(1,3),5>      | <(1,2),100>
4744  <(1,3),5>      | <(1,3),5>
4745  <(1,3),5>      | <(100,200),10>
4746  <(1,3),5>      | <(100,1),115>
4747  <(1,2),3>      | <(5,1),3>
4748  <(1,2),3>      | <(1,2),100>
4749  <(1,2),3>      | <(1,3),5>
4750  <(1,2),3>      | <(1,2),3>
4751  <(1,2),3>      | <(100,200),10>
4752  <(1,2),3>      | <(100,1),115>
4753  <(100,200),10> | <(1,2),100>
4754  <(100,200),10> | <(100,200),10>
4755  <(100,200),10> | <(100,1),115>
4756  <(100,1),115>  | <(100,1),115>
4757  <(3,5),0>      | <(5,1),3>
4758  <(3,5),0>      | <(1,2),100>
4759  <(3,5),0>      | <(1,3),5>
4760  <(3,5),0>      | <(1,2),3>
4761  <(3,5),0>      | <(100,200),10>
4762  <(3,5),0>      | <(100,1),115>
4763  <(3,5),0>      | <(3,5),0>
4764 (29 rows)
4766 -- Area greater than or equal circle
4767 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >= c2.f1;
4768        f1       |       f1       
4769 ----------------+----------------
4770  <(5,1),3>      | <(5,1),3>
4771  <(5,1),3>      | <(1,2),3>
4772  <(5,1),3>      | <(3,5),0>
4773  <(1,2),100>    | <(5,1),3>
4774  <(1,2),100>    | <(1,2),100>
4775  <(1,2),100>    | <(1,3),5>
4776  <(1,2),100>    | <(1,2),3>
4777  <(1,2),100>    | <(100,200),10>
4778  <(1,2),100>    | <(3,5),0>
4779  <(1,3),5>      | <(5,1),3>
4780  <(1,3),5>      | <(1,3),5>
4781  <(1,3),5>      | <(1,2),3>
4782  <(1,3),5>      | <(3,5),0>
4783  <(1,2),3>      | <(5,1),3>
4784  <(1,2),3>      | <(1,2),3>
4785  <(1,2),3>      | <(3,5),0>
4786  <(100,200),10> | <(5,1),3>
4787  <(100,200),10> | <(1,3),5>
4788  <(100,200),10> | <(1,2),3>
4789  <(100,200),10> | <(100,200),10>
4790  <(100,200),10> | <(3,5),0>
4791  <(100,1),115>  | <(5,1),3>
4792  <(100,1),115>  | <(1,2),100>
4793  <(100,1),115>  | <(1,3),5>
4794  <(100,1),115>  | <(1,2),3>
4795  <(100,1),115>  | <(100,200),10>
4796  <(100,1),115>  | <(100,1),115>
4797  <(100,1),115>  | <(3,5),0>
4798  <(3,5),0>      | <(3,5),0>
4799 (29 rows)
4801 -- Area less than circle
4802 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
4803        f1       |       f1       
4804 ----------------+----------------
4805  <(5,1),3>      | <(1,2),100>
4806  <(5,1),3>      | <(1,3),5>
4807  <(5,1),3>      | <(100,200),10>
4808  <(5,1),3>      | <(100,1),115>
4809  <(1,2),100>    | <(100,1),115>
4810  <(1,3),5>      | <(1,2),100>
4811  <(1,3),5>      | <(100,200),10>
4812  <(1,3),5>      | <(100,1),115>
4813  <(1,2),3>      | <(1,2),100>
4814  <(1,2),3>      | <(1,3),5>
4815  <(1,2),3>      | <(100,200),10>
4816  <(1,2),3>      | <(100,1),115>
4817  <(100,200),10> | <(1,2),100>
4818  <(100,200),10> | <(100,1),115>
4819  <(3,5),0>      | <(5,1),3>
4820  <(3,5),0>      | <(1,2),100>
4821  <(3,5),0>      | <(1,3),5>
4822  <(3,5),0>      | <(1,2),3>
4823  <(3,5),0>      | <(100,200),10>
4824  <(3,5),0>      | <(100,1),115>
4825 (20 rows)
4827 -- Area greater than circle
4828 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
4829        f1       |       f1       
4830 ----------------+----------------
4831  <(5,1),3>      | <(1,2),100>
4832  <(5,1),3>      | <(1,3),5>
4833  <(5,1),3>      | <(100,200),10>
4834  <(5,1),3>      | <(100,1),115>
4835  <(1,2),100>    | <(100,1),115>
4836  <(1,3),5>      | <(1,2),100>
4837  <(1,3),5>      | <(100,200),10>
4838  <(1,3),5>      | <(100,1),115>
4839  <(1,2),3>      | <(1,2),100>
4840  <(1,2),3>      | <(1,3),5>
4841  <(1,2),3>      | <(100,200),10>
4842  <(1,2),3>      | <(100,1),115>
4843  <(100,200),10> | <(1,2),100>
4844  <(100,200),10> | <(100,1),115>
4845  <(3,5),0>      | <(5,1),3>
4846  <(3,5),0>      | <(1,2),100>
4847  <(3,5),0>      | <(1,3),5>
4848  <(3,5),0>      | <(1,2),3>
4849  <(3,5),0>      | <(100,200),10>
4850  <(3,5),0>      | <(100,1),115>
4851 (20 rows)
4853 -- Add point
4854 SELECT c.f1, p.f1, c.f1 + p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
4855        f1       |        f1         |        ?column?         
4856 ----------------+-------------------+-------------------------
4857  <(5,1),3>      | (0,0)             | <(5,1),3>
4858  <(1,2),100>    | (0,0)             | <(1,2),100>
4859  <(1,3),5>      | (0,0)             | <(1,3),5>
4860  <(1,2),3>      | (0,0)             | <(1,2),3>
4861  <(100,200),10> | (0,0)             | <(100,200),10>
4862  <(100,1),115>  | (0,0)             | <(100,1),115>
4863  <(3,5),0>      | (0,0)             | <(3,5),0>
4864  <(3,5),NaN>    | (0,0)             | <(3,5),NaN>
4865  <(5,1),3>      | (-10,0)           | <(-5,1),3>
4866  <(1,2),100>    | (-10,0)           | <(-9,2),100>
4867  <(1,3),5>      | (-10,0)           | <(-9,3),5>
4868  <(1,2),3>      | (-10,0)           | <(-9,2),3>
4869  <(100,200),10> | (-10,0)           | <(90,200),10>
4870  <(100,1),115>  | (-10,0)           | <(90,1),115>
4871  <(3,5),0>      | (-10,0)           | <(-7,5),0>
4872  <(3,5),NaN>    | (-10,0)           | <(-7,5),NaN>
4873  <(5,1),3>      | (-3,4)            | <(2,5),3>
4874  <(1,2),100>    | (-3,4)            | <(-2,6),100>
4875  <(1,3),5>      | (-3,4)            | <(-2,7),5>
4876  <(1,2),3>      | (-3,4)            | <(-2,6),3>
4877  <(100,200),10> | (-3,4)            | <(97,204),10>
4878  <(100,1),115>  | (-3,4)            | <(97,5),115>
4879  <(3,5),0>      | (-3,4)            | <(0,9),0>
4880  <(3,5),NaN>    | (-3,4)            | <(0,9),NaN>
4881  <(5,1),3>      | (5.1,34.5)        | <(10.1,35.5),3>
4882  <(1,2),100>    | (5.1,34.5)        | <(6.1,36.5),100>
4883  <(1,3),5>      | (5.1,34.5)        | <(6.1,37.5),5>
4884  <(1,2),3>      | (5.1,34.5)        | <(6.1,36.5),3>
4885  <(100,200),10> | (5.1,34.5)        | <(105.1,234.5),10>
4886  <(100,1),115>  | (5.1,34.5)        | <(105.1,35.5),115>
4887  <(3,5),0>      | (5.1,34.5)        | <(8.1,39.5),0>
4888  <(3,5),NaN>    | (5.1,34.5)        | <(8.1,39.5),NaN>
4889  <(5,1),3>      | (-5,-12)          | <(0,-11),3>
4890  <(1,2),100>    | (-5,-12)          | <(-4,-10),100>
4891  <(1,3),5>      | (-5,-12)          | <(-4,-9),5>
4892  <(1,2),3>      | (-5,-12)          | <(-4,-10),3>
4893  <(100,200),10> | (-5,-12)          | <(95,188),10>
4894  <(100,1),115>  | (-5,-12)          | <(95,-11),115>
4895  <(3,5),0>      | (-5,-12)          | <(-2,-7),0>
4896  <(3,5),NaN>    | (-5,-12)          | <(-2,-7),NaN>
4897  <(5,1),3>      | (1e-300,-1e-300)  | <(5,1),3>
4898  <(1,2),100>    | (1e-300,-1e-300)  | <(1,2),100>
4899  <(1,3),5>      | (1e-300,-1e-300)  | <(1,3),5>
4900  <(1,2),3>      | (1e-300,-1e-300)  | <(1,2),3>
4901  <(100,200),10> | (1e-300,-1e-300)  | <(100,200),10>
4902  <(100,1),115>  | (1e-300,-1e-300)  | <(100,1),115>
4903  <(3,5),0>      | (1e-300,-1e-300)  | <(3,5),0>
4904  <(3,5),NaN>    | (1e-300,-1e-300)  | <(3,5),NaN>
4905  <(5,1),3>      | (1e+300,Infinity) | <(1e+300,Infinity),3>
4906  <(1,2),100>    | (1e+300,Infinity) | <(1e+300,Infinity),100>
4907  <(1,3),5>      | (1e+300,Infinity) | <(1e+300,Infinity),5>
4908  <(1,2),3>      | (1e+300,Infinity) | <(1e+300,Infinity),3>
4909  <(100,200),10> | (1e+300,Infinity) | <(1e+300,Infinity),10>
4910  <(100,1),115>  | (1e+300,Infinity) | <(1e+300,Infinity),115>
4911  <(3,5),0>      | (1e+300,Infinity) | <(1e+300,Infinity),0>
4912  <(3,5),NaN>    | (1e+300,Infinity) | <(1e+300,Infinity),NaN>
4913  <(5,1),3>      | (Infinity,1e+300) | <(Infinity,1e+300),3>
4914  <(1,2),100>    | (Infinity,1e+300) | <(Infinity,1e+300),100>
4915  <(1,3),5>      | (Infinity,1e+300) | <(Infinity,1e+300),5>
4916  <(1,2),3>      | (Infinity,1e+300) | <(Infinity,1e+300),3>
4917  <(100,200),10> | (Infinity,1e+300) | <(Infinity,1e+300),10>
4918  <(100,1),115>  | (Infinity,1e+300) | <(Infinity,1e+300),115>
4919  <(3,5),0>      | (Infinity,1e+300) | <(Infinity,1e+300),0>
4920  <(3,5),NaN>    | (Infinity,1e+300) | <(Infinity,1e+300),NaN>
4921  <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),3>
4922  <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),100>
4923  <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),5>
4924  <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),3>
4925  <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),10>
4926  <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),115>
4927  <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),0>
4928  <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
4929  <(5,1),3>      | (10,10)           | <(15,11),3>
4930  <(1,2),100>    | (10,10)           | <(11,12),100>
4931  <(1,3),5>      | (10,10)           | <(11,13),5>
4932  <(1,2),3>      | (10,10)           | <(11,12),3>
4933  <(100,200),10> | (10,10)           | <(110,210),10>
4934  <(100,1),115>  | (10,10)           | <(110,11),115>
4935  <(3,5),0>      | (10,10)           | <(13,15),0>
4936  <(3,5),NaN>    | (10,10)           | <(13,15),NaN>
4937 (80 rows)
4939 -- Subtract point
4940 SELECT c.f1, p.f1, c.f1 - p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
4941        f1       |        f1         |         ?column?          
4942 ----------------+-------------------+---------------------------
4943  <(5,1),3>      | (0,0)             | <(5,1),3>
4944  <(1,2),100>    | (0,0)             | <(1,2),100>
4945  <(1,3),5>      | (0,0)             | <(1,3),5>
4946  <(1,2),3>      | (0,0)             | <(1,2),3>
4947  <(100,200),10> | (0,0)             | <(100,200),10>
4948  <(100,1),115>  | (0,0)             | <(100,1),115>
4949  <(3,5),0>      | (0,0)             | <(3,5),0>
4950  <(3,5),NaN>    | (0,0)             | <(3,5),NaN>
4951  <(5,1),3>      | (-10,0)           | <(15,1),3>
4952  <(1,2),100>    | (-10,0)           | <(11,2),100>
4953  <(1,3),5>      | (-10,0)           | <(11,3),5>
4954  <(1,2),3>      | (-10,0)           | <(11,2),3>
4955  <(100,200),10> | (-10,0)           | <(110,200),10>
4956  <(100,1),115>  | (-10,0)           | <(110,1),115>
4957  <(3,5),0>      | (-10,0)           | <(13,5),0>
4958  <(3,5),NaN>    | (-10,0)           | <(13,5),NaN>
4959  <(5,1),3>      | (-3,4)            | <(8,-3),3>
4960  <(1,2),100>    | (-3,4)            | <(4,-2),100>
4961  <(1,3),5>      | (-3,4)            | <(4,-1),5>
4962  <(1,2),3>      | (-3,4)            | <(4,-2),3>
4963  <(100,200),10> | (-3,4)            | <(103,196),10>
4964  <(100,1),115>  | (-3,4)            | <(103,-3),115>
4965  <(3,5),0>      | (-3,4)            | <(6,1),0>
4966  <(3,5),NaN>    | (-3,4)            | <(6,1),NaN>
4967  <(5,1),3>      | (5.1,34.5)        | <(-0.1,-33.5),3>
4968  <(1,2),100>    | (5.1,34.5)        | <(-4.1,-32.5),100>
4969  <(1,3),5>      | (5.1,34.5)        | <(-4.1,-31.5),5>
4970  <(1,2),3>      | (5.1,34.5)        | <(-4.1,-32.5),3>
4971  <(100,200),10> | (5.1,34.5)        | <(94.9,165.5),10>
4972  <(100,1),115>  | (5.1,34.5)        | <(94.9,-33.5),115>
4973  <(3,5),0>      | (5.1,34.5)        | <(-2.1,-29.5),0>
4974  <(3,5),NaN>    | (5.1,34.5)        | <(-2.1,-29.5),NaN>
4975  <(5,1),3>      | (-5,-12)          | <(10,13),3>
4976  <(1,2),100>    | (-5,-12)          | <(6,14),100>
4977  <(1,3),5>      | (-5,-12)          | <(6,15),5>
4978  <(1,2),3>      | (-5,-12)          | <(6,14),3>
4979  <(100,200),10> | (-5,-12)          | <(105,212),10>
4980  <(100,1),115>  | (-5,-12)          | <(105,13),115>
4981  <(3,5),0>      | (-5,-12)          | <(8,17),0>
4982  <(3,5),NaN>    | (-5,-12)          | <(8,17),NaN>
4983  <(5,1),3>      | (1e-300,-1e-300)  | <(5,1),3>
4984  <(1,2),100>    | (1e-300,-1e-300)  | <(1,2),100>
4985  <(1,3),5>      | (1e-300,-1e-300)  | <(1,3),5>
4986  <(1,2),3>      | (1e-300,-1e-300)  | <(1,2),3>
4987  <(100,200),10> | (1e-300,-1e-300)  | <(100,200),10>
4988  <(100,1),115>  | (1e-300,-1e-300)  | <(100,1),115>
4989  <(3,5),0>      | (1e-300,-1e-300)  | <(3,5),0>
4990  <(3,5),NaN>    | (1e-300,-1e-300)  | <(3,5),NaN>
4991  <(5,1),3>      | (1e+300,Infinity) | <(-1e+300,-Infinity),3>
4992  <(1,2),100>    | (1e+300,Infinity) | <(-1e+300,-Infinity),100>
4993  <(1,3),5>      | (1e+300,Infinity) | <(-1e+300,-Infinity),5>
4994  <(1,2),3>      | (1e+300,Infinity) | <(-1e+300,-Infinity),3>
4995  <(100,200),10> | (1e+300,Infinity) | <(-1e+300,-Infinity),10>
4996  <(100,1),115>  | (1e+300,Infinity) | <(-1e+300,-Infinity),115>
4997  <(3,5),0>      | (1e+300,Infinity) | <(-1e+300,-Infinity),0>
4998  <(3,5),NaN>    | (1e+300,Infinity) | <(-1e+300,-Infinity),NaN>
4999  <(5,1),3>      | (Infinity,1e+300) | <(-Infinity,-1e+300),3>
5000  <(1,2),100>    | (Infinity,1e+300) | <(-Infinity,-1e+300),100>
5001  <(1,3),5>      | (Infinity,1e+300) | <(-Infinity,-1e+300),5>
5002  <(1,2),3>      | (Infinity,1e+300) | <(-Infinity,-1e+300),3>
5003  <(100,200),10> | (Infinity,1e+300) | <(-Infinity,-1e+300),10>
5004  <(100,1),115>  | (Infinity,1e+300) | <(-Infinity,-1e+300),115>
5005  <(3,5),0>      | (Infinity,1e+300) | <(-Infinity,-1e+300),0>
5006  <(3,5),NaN>    | (Infinity,1e+300) | <(-Infinity,-1e+300),NaN>
5007  <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),3>
5008  <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),100>
5009  <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),5>
5010  <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),3>
5011  <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),10>
5012  <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),115>
5013  <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),0>
5014  <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
5015  <(5,1),3>      | (10,10)           | <(-5,-9),3>
5016  <(1,2),100>    | (10,10)           | <(-9,-8),100>
5017  <(1,3),5>      | (10,10)           | <(-9,-7),5>
5018  <(1,2),3>      | (10,10)           | <(-9,-8),3>
5019  <(100,200),10> | (10,10)           | <(90,190),10>
5020  <(100,1),115>  | (10,10)           | <(90,-9),115>
5021  <(3,5),0>      | (10,10)           | <(-7,-5),0>
5022  <(3,5),NaN>    | (10,10)           | <(-7,-5),NaN>
5023 (80 rows)
5025 -- Multiply with point
5026 SELECT c.f1, p.f1, c.f1 * p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
5027        f1       |        f1         |                  ?column?                  
5028 ----------------+-------------------+--------------------------------------------
5029  <(5,1),3>      | (0,0)             | <(0,0),0>
5030  <(1,2),100>    | (0,0)             | <(0,0),0>
5031  <(1,3),5>      | (0,0)             | <(0,0),0>
5032  <(1,2),3>      | (0,0)             | <(0,0),0>
5033  <(100,200),10> | (0,0)             | <(0,0),0>
5034  <(100,1),115>  | (0,0)             | <(0,0),0>
5035  <(3,5),0>      | (0,0)             | <(0,0),0>
5036  <(3,5),NaN>    | (0,0)             | <(0,0),NaN>
5037  <(5,1),3>      | (-10,0)           | <(-50,-10),30>
5038  <(1,2),100>    | (-10,0)           | <(-10,-20),1000>
5039  <(1,3),5>      | (-10,0)           | <(-10,-30),50>
5040  <(1,2),3>      | (-10,0)           | <(-10,-20),30>
5041  <(100,200),10> | (-10,0)           | <(-1000,-2000),100>
5042  <(100,1),115>  | (-10,0)           | <(-1000,-10),1150>
5043  <(3,5),0>      | (-10,0)           | <(-30,-50),0>
5044  <(3,5),NaN>    | (-10,0)           | <(-30,-50),NaN>
5045  <(5,1),3>      | (-3,4)            | <(-19,17),15>
5046  <(1,2),100>    | (-3,4)            | <(-11,-2),500>
5047  <(1,3),5>      | (-3,4)            | <(-15,-5),25>
5048  <(1,2),3>      | (-3,4)            | <(-11,-2),15>
5049  <(100,200),10> | (-3,4)            | <(-1100,-200),50>
5050  <(100,1),115>  | (-3,4)            | <(-304,397),575>
5051  <(3,5),0>      | (-3,4)            | <(-29,-3),0>
5052  <(3,5),NaN>    | (-3,4)            | <(-29,-3),NaN>
5053  <(5,1),3>      | (5.1,34.5)        | <(-9,177.6),104.624758064>
5054  <(1,2),100>    | (5.1,34.5)        | <(-63.9,44.7),3487.49193547>
5055  <(1,3),5>      | (5.1,34.5)        | <(-98.4,49.8),174.374596774>
5056  <(1,2),3>      | (5.1,34.5)        | <(-63.9,44.7),104.624758064>
5057  <(100,200),10> | (5.1,34.5)        | <(-6390,4470),348.749193547>
5058  <(100,1),115>  | (5.1,34.5)        | <(475.5,3455.1),4010.6157258>
5059  <(3,5),0>      | (5.1,34.5)        | <(-157.2,129),0>
5060  <(3,5),NaN>    | (5.1,34.5)        | <(-157.2,129),NaN>
5061  <(5,1),3>      | (-5,-12)          | <(-13,-65),39>
5062  <(1,2),100>    | (-5,-12)          | <(19,-22),1300>
5063  <(1,3),5>      | (-5,-12)          | <(31,-27),65>
5064  <(1,2),3>      | (-5,-12)          | <(19,-22),39>
5065  <(100,200),10> | (-5,-12)          | <(1900,-2200),130>
5066  <(100,1),115>  | (-5,-12)          | <(-488,-1205),1495>
5067  <(3,5),0>      | (-5,-12)          | <(45,-61),0>
5068  <(3,5),NaN>    | (-5,-12)          | <(45,-61),NaN>
5069  <(5,1),3>      | (1e-300,-1e-300)  | <(6e-300,-4e-300),4.24264068712e-300>
5070  <(1,2),100>    | (1e-300,-1e-300)  | <(3e-300,1e-300),1.41421356237e-298>
5071  <(1,3),5>      | (1e-300,-1e-300)  | <(4e-300,2e-300),7.07106781187e-300>
5072  <(1,2),3>      | (1e-300,-1e-300)  | <(3e-300,1e-300),4.24264068712e-300>
5073  <(100,200),10> | (1e-300,-1e-300)  | <(3e-298,1e-298),1.41421356237e-299>
5074  <(100,1),115>  | (1e-300,-1e-300)  | <(1.01e-298,-9.9e-299),1.62634559673e-298>
5075  <(3,5),0>      | (1e-300,-1e-300)  | <(8e-300,2e-300),0>
5076  <(3,5),NaN>    | (1e-300,-1e-300)  | <(8e-300,2e-300),NaN>
5077  <(5,1),3>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5078  <(1,2),100>    | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5079  <(1,3),5>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5080  <(1,2),3>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5081  <(100,200),10> | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5082  <(100,1),115>  | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5083  <(3,5),0>      | (1e+300,Infinity) | <(-Infinity,Infinity),NaN>
5084  <(3,5),NaN>    | (1e+300,Infinity) | <(-Infinity,Infinity),NaN>
5085  <(5,1),3>      | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5086  <(1,2),100>    | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5087  <(1,3),5>      | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5088  <(1,2),3>      | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5089  <(100,200),10> | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5090  <(100,1),115>  | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5091  <(3,5),0>      | (Infinity,1e+300) | <(Infinity,Infinity),NaN>
5092  <(3,5),NaN>    | (Infinity,1e+300) | <(Infinity,Infinity),NaN>
5093  <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),NaN>
5094  <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),NaN>
5095  <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),NaN>
5096  <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),NaN>
5097  <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),NaN>
5098  <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),NaN>
5099  <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),NaN>
5100  <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
5101  <(5,1),3>      | (10,10)           | <(40,60),42.4264068712>
5102  <(1,2),100>    | (10,10)           | <(-10,30),1414.21356237>
5103  <(1,3),5>      | (10,10)           | <(-20,40),70.7106781187>
5104  <(1,2),3>      | (10,10)           | <(-10,30),42.4264068712>
5105  <(100,200),10> | (10,10)           | <(-1000,3000),141.421356237>
5106  <(100,1),115>  | (10,10)           | <(990,1010),1626.34559673>
5107  <(3,5),0>      | (10,10)           | <(-20,80),0>
5108  <(3,5),NaN>    | (10,10)           | <(-20,80),NaN>
5109 (80 rows)
5111 -- Divide by point
5112 SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
5113        f1       |     f1     |                       ?column?                       
5114 ----------------+------------+------------------------------------------------------
5115  <(5,1),3>      | (5.1,34.5) | <(0.0493315573973,-0.137635045138),0.0860217042937>
5116  <(5,1),3>      | (10,10)    | <(0.3,-0.2),0.212132034356>
5117  <(1,2),100>    | (5.1,34.5) | <(0.0609244733856,-0.0199792807459),2.86739014312>
5118  <(1,2),100>    | (10,10)    | <(0.15,0.05),7.07106781187>
5119  <(1,3),5>      | (5.1,34.5) | <(0.0892901188891,-0.0157860983671),0.143369507156>
5120  <(1,3),5>      | (10,10)    | <(0.2,0.1),0.353553390593>
5121  <(1,2),3>      | (5.1,34.5) | <(0.0609244733856,-0.0199792807459),0.0860217042937>
5122  <(1,2),3>      | (10,10)    | <(0.15,0.05),0.212132034356>
5123  <(100,200),10> | (5.1,34.5) | <(6.09244733856,-1.99792807459),0.286739014312>
5124  <(100,200),10> | (10,10)    | <(15,5),0.707106781187>
5125  <(100,1),115>  | (5.1,34.5) | <(0.44768388338,-2.83237136796),3.29749866459>
5126  <(100,1),115>  | (10,10)    | <(5.05,-4.95),8.13172798365>
5127  <(3,5),0>      | (5.1,34.5) | <(0.154407774653,-0.0641310246164),0>
5128  <(3,5),0>      | (10,10)    | <(0.4,0.1),0>
5129  <(3,5),NaN>    | (5.1,34.5) | <(0.154407774653,-0.0641310246164),NaN>
5130  <(3,5),NaN>    | (10,10)    | <(0.4,0.1),NaN>
5131 (16 rows)
5133 -- Overflow error
5134 SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] > 1000;
5135 ERROR:  value out of range: overflow
5136 -- Division by 0 error
5137 SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1 ~= '(0,0)'::point;
5138 ERROR:  division by zero
5139 -- Distance to polygon
5140 SELECT c.f1, p.f1, c.f1 <-> p.f1 FROM CIRCLE_TBL c, POLYGON_TBL p;
5141        f1       |             f1             |    ?column?    
5142 ----------------+----------------------------+----------------
5143  <(5,1),3>      | ((2,0),(2,4),(0,0))        |              0
5144  <(5,1),3>      | ((3,1),(3,3),(1,0))        |              0
5145  <(5,1),3>      | ((1,2),(3,4),(5,6),(7,8))  | 0.535533905933
5146  <(5,1),3>      | ((7,8),(5,6),(3,4),(1,2))  | 0.535533905933
5147  <(5,1),3>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
5148  <(5,1),3>      | ((0,0))                    |  2.09901951359
5149  <(5,1),3>      | ((0,1),(0,1))              |              2
5150  <(1,2),100>    | ((2,0),(2,4),(0,0))        |              0
5151  <(1,2),100>    | ((3,1),(3,3),(1,0))        |              0
5152  <(1,2),100>    | ((1,2),(3,4),(5,6),(7,8))  |              0
5153  <(1,2),100>    | ((7,8),(5,6),(3,4),(1,2))  |              0
5154  <(1,2),100>    | ((1,2),(7,8),(5,6),(3,-4)) |              0
5155  <(1,2),100>    | ((0,0))                    |              0
5156  <(1,2),100>    | ((0,1),(0,1))              |              0
5157  <(1,3),5>      | ((2,0),(2,4),(0,0))        |              0
5158  <(1,3),5>      | ((3,1),(3,3),(1,0))        |              0
5159  <(1,3),5>      | ((1,2),(3,4),(5,6),(7,8))  |              0
5160  <(1,3),5>      | ((7,8),(5,6),(3,4),(1,2))  |              0
5161  <(1,3),5>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
5162  <(1,3),5>      | ((0,0))                    |              0
5163  <(1,3),5>      | ((0,1),(0,1))              |              0
5164  <(1,2),3>      | ((2,0),(2,4),(0,0))        |              0
5165  <(1,2),3>      | ((3,1),(3,3),(1,0))        |              0
5166  <(1,2),3>      | ((1,2),(3,4),(5,6),(7,8))  |              0
5167  <(1,2),3>      | ((7,8),(5,6),(3,4),(1,2))  |              0
5168  <(1,2),3>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
5169  <(1,2),3>      | ((0,0))                    |              0
5170  <(1,2),3>      | ((0,1),(0,1))              |              0
5171  <(100,200),10> | ((2,0),(2,4),(0,0))        |  209.134661795
5172  <(100,200),10> | ((3,1),(3,3),(1,0))        |  209.585974051
5173  <(100,200),10> | ((1,2),(3,4),(5,6),(7,8))  |  203.337760371
5174  <(100,200),10> | ((7,8),(5,6),(3,4),(1,2))  |  203.337760371
5175  <(100,200),10> | ((1,2),(7,8),(5,6),(3,-4)) |  203.337760371
5176  <(100,200),10> | ((0,0))                    |   213.60679775
5177  <(100,200),10> | ((0,1),(0,1))              |  212.712819568
5178  <(100,1),115>  | ((2,0),(2,4),(0,0))        |              0
5179  <(100,1),115>  | ((3,1),(3,3),(1,0))        |              0
5180  <(100,1),115>  | ((1,2),(3,4),(5,6),(7,8))  |              0
5181  <(100,1),115>  | ((7,8),(5,6),(3,4),(1,2))  |              0
5182  <(100,1),115>  | ((1,2),(7,8),(5,6),(3,-4)) |              0
5183  <(100,1),115>  | ((0,0))                    |              0
5184  <(100,1),115>  | ((0,1),(0,1))              |              0
5185  <(3,5),0>      | ((2,0),(2,4),(0,0))        |  1.41421356237
5186  <(3,5),0>      | ((3,1),(3,3),(1,0))        |              2
5187  <(3,5),0>      | ((1,2),(3,4),(5,6),(7,8))  | 0.707106781187
5188  <(3,5),0>      | ((7,8),(5,6),(3,4),(1,2))  | 0.707106781187
5189  <(3,5),0>      | ((1,2),(7,8),(5,6),(3,-4)) | 0.707106781187
5190  <(3,5),0>      | ((0,0))                    |  5.83095189485
5191  <(3,5),0>      | ((0,1),(0,1))              |              5
5192  <(3,5),NaN>    | ((2,0),(2,4),(0,0))        |            NaN
5193  <(3,5),NaN>    | ((3,1),(3,3),(1,0))        |            NaN
5194  <(3,5),NaN>    | ((1,2),(3,4),(5,6),(7,8))  |            NaN
5195  <(3,5),NaN>    | ((7,8),(5,6),(3,4),(1,2))  |            NaN
5196  <(3,5),NaN>    | ((1,2),(7,8),(5,6),(3,-4)) |            NaN
5197  <(3,5),NaN>    | ((0,0))                    |            NaN
5198  <(3,5),NaN>    | ((0,1),(0,1))              |            NaN
5199 (56 rows)