Fix a memory leak in dumping functions with TRANSFORMs
[pgsql.git] / src / test / regress / expected / geometry.out
blob8be694f46be1d796e69d11a451697034e39de6f4
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 -- Intersect with line
1471 SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?# l2.s;
1472                    s                   |                   s                   
1473 ---------------------------------------+---------------------------------------
1474  {0,-1,5}                              | {1,0,5}
1475  {0,-1,5}                              | {1,-1,0}
1476  {0,-1,5}                              | {-0.4,-1,-6}
1477  {0,-1,5}                              | {-0.000184615384615,-1,15.3846153846}
1478  {0,-1,5}                              | {3,NaN,5}
1479  {0,-1,5}                              | {NaN,NaN,NaN}
1480  {0,-1,5}                              | {-1,0,3}
1481  {1,0,5}                               | {0,-1,5}
1482  {1,0,5}                               | {0,3,0}
1483  {1,0,5}                               | {1,-1,0}
1484  {1,0,5}                               | {-0.4,-1,-6}
1485  {1,0,5}                               | {-0.000184615384615,-1,15.3846153846}
1486  {1,0,5}                               | {3,NaN,5}
1487  {1,0,5}                               | {NaN,NaN,NaN}
1488  {1,0,5}                               | {0,-1,3}
1489  {0,3,0}                               | {1,0,5}
1490  {0,3,0}                               | {1,-1,0}
1491  {0,3,0}                               | {-0.4,-1,-6}
1492  {0,3,0}                               | {-0.000184615384615,-1,15.3846153846}
1493  {0,3,0}                               | {3,NaN,5}
1494  {0,3,0}                               | {NaN,NaN,NaN}
1495  {0,3,0}                               | {-1,0,3}
1496  {1,-1,0}                              | {0,-1,5}
1497  {1,-1,0}                              | {1,0,5}
1498  {1,-1,0}                              | {0,3,0}
1499  {1,-1,0}                              | {-0.4,-1,-6}
1500  {1,-1,0}                              | {-0.000184615384615,-1,15.3846153846}
1501  {1,-1,0}                              | {3,NaN,5}
1502  {1,-1,0}                              | {NaN,NaN,NaN}
1503  {1,-1,0}                              | {0,-1,3}
1504  {1,-1,0}                              | {-1,0,3}
1505  {-0.4,-1,-6}                          | {0,-1,5}
1506  {-0.4,-1,-6}                          | {1,0,5}
1507  {-0.4,-1,-6}                          | {0,3,0}
1508  {-0.4,-1,-6}                          | {1,-1,0}
1509  {-0.4,-1,-6}                          | {-0.000184615384615,-1,15.3846153846}
1510  {-0.4,-1,-6}                          | {3,NaN,5}
1511  {-0.4,-1,-6}                          | {NaN,NaN,NaN}
1512  {-0.4,-1,-6}                          | {0,-1,3}
1513  {-0.4,-1,-6}                          | {-1,0,3}
1514  {-0.000184615384615,-1,15.3846153846} | {0,-1,5}
1515  {-0.000184615384615,-1,15.3846153846} | {1,0,5}
1516  {-0.000184615384615,-1,15.3846153846} | {0,3,0}
1517  {-0.000184615384615,-1,15.3846153846} | {1,-1,0}
1518  {-0.000184615384615,-1,15.3846153846} | {-0.4,-1,-6}
1519  {-0.000184615384615,-1,15.3846153846} | {3,NaN,5}
1520  {-0.000184615384615,-1,15.3846153846} | {NaN,NaN,NaN}
1521  {-0.000184615384615,-1,15.3846153846} | {0,-1,3}
1522  {-0.000184615384615,-1,15.3846153846} | {-1,0,3}
1523  {3,NaN,5}                             | {0,-1,5}
1524  {3,NaN,5}                             | {1,0,5}
1525  {3,NaN,5}                             | {0,3,0}
1526  {3,NaN,5}                             | {1,-1,0}
1527  {3,NaN,5}                             | {-0.4,-1,-6}
1528  {3,NaN,5}                             | {-0.000184615384615,-1,15.3846153846}
1529  {3,NaN,5}                             | {3,NaN,5}
1530  {3,NaN,5}                             | {NaN,NaN,NaN}
1531  {3,NaN,5}                             | {0,-1,3}
1532  {3,NaN,5}                             | {-1,0,3}
1533  {NaN,NaN,NaN}                         | {0,-1,5}
1534  {NaN,NaN,NaN}                         | {1,0,5}
1535  {NaN,NaN,NaN}                         | {0,3,0}
1536  {NaN,NaN,NaN}                         | {1,-1,0}
1537  {NaN,NaN,NaN}                         | {-0.4,-1,-6}
1538  {NaN,NaN,NaN}                         | {-0.000184615384615,-1,15.3846153846}
1539  {NaN,NaN,NaN}                         | {3,NaN,5}
1540  {NaN,NaN,NaN}                         | {NaN,NaN,NaN}
1541  {NaN,NaN,NaN}                         | {0,-1,3}
1542  {NaN,NaN,NaN}                         | {-1,0,3}
1543  {0,-1,3}                              | {1,0,5}
1544  {0,-1,3}                              | {1,-1,0}
1545  {0,-1,3}                              | {-0.4,-1,-6}
1546  {0,-1,3}                              | {-0.000184615384615,-1,15.3846153846}
1547  {0,-1,3}                              | {3,NaN,5}
1548  {0,-1,3}                              | {NaN,NaN,NaN}
1549  {0,-1,3}                              | {-1,0,3}
1550  {-1,0,3}                              | {0,-1,5}
1551  {-1,0,3}                              | {0,3,0}
1552  {-1,0,3}                              | {1,-1,0}
1553  {-1,0,3}                              | {-0.4,-1,-6}
1554  {-1,0,3}                              | {-0.000184615384615,-1,15.3846153846}
1555  {-1,0,3}                              | {3,NaN,5}
1556  {-1,0,3}                              | {NaN,NaN,NaN}
1557  {-1,0,3}                              | {0,-1,3}
1558 (84 rows)
1560 -- Intersect with box
1561 SELECT l.s, b.f1 FROM LINE_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
1562       s       |         f1          
1563 --------------+---------------------
1564  {1,0,5}      | (-2,2),(-8,-10)
1565  {0,3,0}      | (2,2),(0,0)
1566  {0,3,0}      | (-2,2),(-8,-10)
1567  {1,-1,0}     | (2,2),(0,0)
1568  {1,-1,0}     | (3,3),(1,1)
1569  {1,-1,0}     | (-2,2),(-8,-10)
1570  {1,-1,0}     | (2.5,3.5),(2.5,2.5)
1571  {1,-1,0}     | (3,3),(3,3)
1572  {-0.4,-1,-6} | (-2,2),(-8,-10)
1573  {0,-1,3}     | (3,3),(1,1)
1574  {0,-1,3}     | (2.5,3.5),(2.5,2.5)
1575  {0,-1,3}     | (3,3),(3,3)
1576  {-1,0,3}     | (3,3),(1,1)
1577 (13 rows)
1579 -- Intersection point with line
1580 SELECT l1.s, l2.s, l1.s # l2.s FROM LINE_TBL l1, LINE_TBL l2;
1581                    s                   |                   s                   |             ?column?              
1582 ---------------------------------------+---------------------------------------+-----------------------------------
1583  {0,-1,5}                              | {0,-1,5}                              | 
1584  {0,-1,5}                              | {1,0,5}                               | (-5,5)
1585  {0,-1,5}                              | {0,3,0}                               | 
1586  {0,-1,5}                              | {1,-1,0}                              | (5,5)
1587  {0,-1,5}                              | {-0.4,-1,-6}                          | (-27.5,5)
1588  {0,-1,5}                              | {-0.000184615384615,-1,15.3846153846} | (56250,5)
1589  {0,-1,5}                              | {3,NaN,5}                             | (NaN,NaN)
1590  {0,-1,5}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
1591  {0,-1,5}                              | {0,-1,3}                              | 
1592  {0,-1,5}                              | {-1,0,3}                              | (3,5)
1593  {1,0,5}                               | {0,-1,5}                              | (-5,5)
1594  {1,0,5}                               | {1,0,5}                               | 
1595  {1,0,5}                               | {0,3,0}                               | (-5,0)
1596  {1,0,5}                               | {1,-1,0}                              | (-5,-5)
1597  {1,0,5}                               | {-0.4,-1,-6}                          | (-5,-4)
1598  {1,0,5}                               | {-0.000184615384615,-1,15.3846153846} | (-5,15.3855384615)
1599  {1,0,5}                               | {3,NaN,5}                             | (NaN,NaN)
1600  {1,0,5}                               | {NaN,NaN,NaN}                         | (NaN,NaN)
1601  {1,0,5}                               | {0,-1,3}                              | (-5,3)
1602  {1,0,5}                               | {-1,0,3}                              | 
1603  {0,3,0}                               | {0,-1,5}                              | 
1604  {0,3,0}                               | {1,0,5}                               | (-5,0)
1605  {0,3,0}                               | {0,3,0}                               | 
1606  {0,3,0}                               | {1,-1,0}                              | (0,0)
1607  {0,3,0}                               | {-0.4,-1,-6}                          | (-15,0)
1608  {0,3,0}                               | {-0.000184615384615,-1,15.3846153846} | (83333.3333333,0)
1609  {0,3,0}                               | {3,NaN,5}                             | (NaN,NaN)
1610  {0,3,0}                               | {NaN,NaN,NaN}                         | (NaN,NaN)
1611  {0,3,0}                               | {0,-1,3}                              | 
1612  {0,3,0}                               | {-1,0,3}                              | (3,0)
1613  {1,-1,0}                              | {0,-1,5}                              | (5,5)
1614  {1,-1,0}                              | {1,0,5}                               | (-5,-5)
1615  {1,-1,0}                              | {0,3,0}                               | (0,0)
1616  {1,-1,0}                              | {1,-1,0}                              | 
1617  {1,-1,0}                              | {-0.4,-1,-6}                          | (-4.28571428571,-4.28571428571)
1618  {1,-1,0}                              | {-0.000184615384615,-1,15.3846153846} | (15.3817756722,15.3817756722)
1619  {1,-1,0}                              | {3,NaN,5}                             | (NaN,NaN)
1620  {1,-1,0}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
1621  {1,-1,0}                              | {0,-1,3}                              | (3,3)
1622  {1,-1,0}                              | {-1,0,3}                              | (3,3)
1623  {-0.4,-1,-6}                          | {0,-1,5}                              | (-27.5,5)
1624  {-0.4,-1,-6}                          | {1,0,5}                               | (-5,-4)
1625  {-0.4,-1,-6}                          | {0,3,0}                               | (-15,0)
1626  {-0.4,-1,-6}                          | {1,-1,0}                              | (-4.28571428571,-4.28571428571)
1627  {-0.4,-1,-6}                          | {-0.4,-1,-6}                          | 
1628  {-0.4,-1,-6}                          | {-0.000184615384615,-1,15.3846153846} | (-53.4862244113,15.3944897645)
1629  {-0.4,-1,-6}                          | {3,NaN,5}                             | (NaN,NaN)
1630  {-0.4,-1,-6}                          | {NaN,NaN,NaN}                         | (NaN,NaN)
1631  {-0.4,-1,-6}                          | {0,-1,3}                              | (-22.5,3)
1632  {-0.4,-1,-6}                          | {-1,0,3}                              | (3,-7.2)
1633  {-0.000184615384615,-1,15.3846153846} | {0,-1,5}                              | (56250,5)
1634  {-0.000184615384615,-1,15.3846153846} | {1,0,5}                               | (-5,15.3855384615)
1635  {-0.000184615384615,-1,15.3846153846} | {0,3,0}                               | (83333.3333333,-1.7763568394e-15)
1636  {-0.000184615384615,-1,15.3846153846} | {1,-1,0}                              | (15.3817756722,15.3817756722)
1637  {-0.000184615384615,-1,15.3846153846} | {-0.4,-1,-6}                          | (-53.4862244113,15.3944897645)
1638  {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846} | 
1639  {-0.000184615384615,-1,15.3846153846} | {3,NaN,5}                             | (NaN,NaN)
1640  {-0.000184615384615,-1,15.3846153846} | {NaN,NaN,NaN}                         | (NaN,NaN)
1641  {-0.000184615384615,-1,15.3846153846} | {0,-1,3}                              | (67083.3333333,3)
1642  {-0.000184615384615,-1,15.3846153846} | {-1,0,3}                              | (3,15.3840615385)
1643  {3,NaN,5}                             | {0,-1,5}                              | (NaN,NaN)
1644  {3,NaN,5}                             | {1,0,5}                               | (NaN,NaN)
1645  {3,NaN,5}                             | {0,3,0}                               | (NaN,NaN)
1646  {3,NaN,5}                             | {1,-1,0}                              | (NaN,NaN)
1647  {3,NaN,5}                             | {-0.4,-1,-6}                          | (NaN,NaN)
1648  {3,NaN,5}                             | {-0.000184615384615,-1,15.3846153846} | (NaN,NaN)
1649  {3,NaN,5}                             | {3,NaN,5}                             | (NaN,NaN)
1650  {3,NaN,5}                             | {NaN,NaN,NaN}                         | (NaN,NaN)
1651  {3,NaN,5}                             | {0,-1,3}                              | (NaN,NaN)
1652  {3,NaN,5}                             | {-1,0,3}                              | (NaN,NaN)
1653  {NaN,NaN,NaN}                         | {0,-1,5}                              | (NaN,NaN)
1654  {NaN,NaN,NaN}                         | {1,0,5}                               | (NaN,NaN)
1655  {NaN,NaN,NaN}                         | {0,3,0}                               | (NaN,NaN)
1656  {NaN,NaN,NaN}                         | {1,-1,0}                              | (NaN,NaN)
1657  {NaN,NaN,NaN}                         | {-0.4,-1,-6}                          | (NaN,NaN)
1658  {NaN,NaN,NaN}                         | {-0.000184615384615,-1,15.3846153846} | (NaN,NaN)
1659  {NaN,NaN,NaN}                         | {3,NaN,5}                             | (NaN,NaN)
1660  {NaN,NaN,NaN}                         | {NaN,NaN,NaN}                         | (NaN,NaN)
1661  {NaN,NaN,NaN}                         | {0,-1,3}                              | (NaN,NaN)
1662  {NaN,NaN,NaN}                         | {-1,0,3}                              | (NaN,NaN)
1663  {0,-1,3}                              | {0,-1,5}                              | 
1664  {0,-1,3}                              | {1,0,5}                               | (-5,3)
1665  {0,-1,3}                              | {0,3,0}                               | 
1666  {0,-1,3}                              | {1,-1,0}                              | (3,3)
1667  {0,-1,3}                              | {-0.4,-1,-6}                          | (-22.5,3)
1668  {0,-1,3}                              | {-0.000184615384615,-1,15.3846153846} | (67083.3333333,3)
1669  {0,-1,3}                              | {3,NaN,5}                             | (NaN,NaN)
1670  {0,-1,3}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
1671  {0,-1,3}                              | {0,-1,3}                              | 
1672  {0,-1,3}                              | {-1,0,3}                              | (3,3)
1673  {-1,0,3}                              | {0,-1,5}                              | (3,5)
1674  {-1,0,3}                              | {1,0,5}                               | 
1675  {-1,0,3}                              | {0,3,0}                               | (3,0)
1676  {-1,0,3}                              | {1,-1,0}                              | (3,3)
1677  {-1,0,3}                              | {-0.4,-1,-6}                          | (3,-7.2)
1678  {-1,0,3}                              | {-0.000184615384615,-1,15.3846153846} | (3,15.3840615385)
1679  {-1,0,3}                              | {3,NaN,5}                             | (NaN,NaN)
1680  {-1,0,3}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
1681  {-1,0,3}                              | {0,-1,3}                              | (3,3)
1682  {-1,0,3}                              | {-1,0,3}                              | 
1683 (100 rows)
1685 -- Closest point to line segment
1686 SELECT l.s, l1.s, l.s ## l1.s FROM LINE_TBL l, LSEG_TBL l1;
1687                    s                   |               s               |             ?column?              
1688 ---------------------------------------+-------------------------------+-----------------------------------
1689  {0,-1,5}                              | [(1,2),(3,4)]                 | (3,4)
1690  {0,-1,5}                              | [(0,0),(6,6)]                 | (5,5)
1691  {0,-1,5}                              | [(10,-10),(-3,-4)]            | (-3,-4)
1692  {0,-1,5}                              | [(-1000000,200),(300000,-40)] | (56250,5)
1693  {0,-1,5}                              | [(11,22),(33,44)]             | (11,22)
1694  {0,-1,5}                              | [(-10,2),(-10,3)]             | (-10,3)
1695  {0,-1,5}                              | [(0,-20),(30,-20)]            | 
1696  {0,-1,5}                              | [(NaN,1),(NaN,90)]            | 
1697  {1,0,5}                               | [(1,2),(3,4)]                 | (1,2)
1698  {1,0,5}                               | [(0,0),(6,6)]                 | (0,0)
1699  {1,0,5}                               | [(10,-10),(-3,-4)]            | (-3,-4)
1700  {1,0,5}                               | [(-1000000,200),(300000,-40)] | (-5,15.3855384615)
1701  {1,0,5}                               | [(11,22),(33,44)]             | (11,22)
1702  {1,0,5}                               | [(-10,2),(-10,3)]             | 
1703  {1,0,5}                               | [(0,-20),(30,-20)]            | (0,-20)
1704  {1,0,5}                               | [(NaN,1),(NaN,90)]            | 
1705  {0,3,0}                               | [(1,2),(3,4)]                 | (1,2)
1706  {0,3,0}                               | [(0,0),(6,6)]                 | (0,0)
1707  {0,3,0}                               | [(10,-10),(-3,-4)]            | (-3,-4)
1708  {0,3,0}                               | [(-1000000,200),(300000,-40)] | (83333.3333333,-1.7763568394e-15)
1709  {0,3,0}                               | [(11,22),(33,44)]             | (11,22)
1710  {0,3,0}                               | [(-10,2),(-10,3)]             | (-10,2)
1711  {0,3,0}                               | [(0,-20),(30,-20)]            | 
1712  {0,3,0}                               | [(NaN,1),(NaN,90)]            | 
1713  {1,-1,0}                              | [(1,2),(3,4)]                 | 
1714  {1,-1,0}                              | [(0,0),(6,6)]                 | 
1715  {1,-1,0}                              | [(10,-10),(-3,-4)]            | (-3,-4)
1716  {1,-1,0}                              | [(-1000000,200),(300000,-40)] | (15.3817756722,15.3817756722)
1717  {1,-1,0}                              | [(11,22),(33,44)]             | 
1718  {1,-1,0}                              | [(-10,2),(-10,3)]             | (-10,2)
1719  {1,-1,0}                              | [(0,-20),(30,-20)]            | (0,-20)
1720  {1,-1,0}                              | [(NaN,1),(NaN,90)]            | 
1721  {-0.4,-1,-6}                          | [(1,2),(3,4)]                 | (1,2)
1722  {-0.4,-1,-6}                          | [(0,0),(6,6)]                 | (0,0)
1723  {-0.4,-1,-6}                          | [(10,-10),(-3,-4)]            | (10,-10)
1724  {-0.4,-1,-6}                          | [(-1000000,200),(300000,-40)] | (-53.4862244113,15.3944897645)
1725  {-0.4,-1,-6}                          | [(11,22),(33,44)]             | (11,22)
1726  {-0.4,-1,-6}                          | [(-10,2),(-10,3)]             | (-10,2)
1727  {-0.4,-1,-6}                          | [(0,-20),(30,-20)]            | (30,-20)
1728  {-0.4,-1,-6}                          | [(NaN,1),(NaN,90)]            | 
1729  {-0.000184615384615,-1,15.3846153846} | [(1,2),(3,4)]                 | (3,4)
1730  {-0.000184615384615,-1,15.3846153846} | [(0,0),(6,6)]                 | (6,6)
1731  {-0.000184615384615,-1,15.3846153846} | [(10,-10),(-3,-4)]            | (-3,-4)
1732  {-0.000184615384615,-1,15.3846153846} | [(-1000000,200),(300000,-40)] | 
1733  {-0.000184615384615,-1,15.3846153846} | [(11,22),(33,44)]             | (11,22)
1734  {-0.000184615384615,-1,15.3846153846} | [(-10,2),(-10,3)]             | (-10,3)
1735  {-0.000184615384615,-1,15.3846153846} | [(0,-20),(30,-20)]            | (30,-20)
1736  {-0.000184615384615,-1,15.3846153846} | [(NaN,1),(NaN,90)]            | 
1737  {3,NaN,5}                             | [(1,2),(3,4)]                 | 
1738  {3,NaN,5}                             | [(0,0),(6,6)]                 | 
1739  {3,NaN,5}                             | [(10,-10),(-3,-4)]            | 
1740  {3,NaN,5}                             | [(-1000000,200),(300000,-40)] | 
1741  {3,NaN,5}                             | [(11,22),(33,44)]             | 
1742  {3,NaN,5}                             | [(-10,2),(-10,3)]             | 
1743  {3,NaN,5}                             | [(0,-20),(30,-20)]            | 
1744  {3,NaN,5}                             | [(NaN,1),(NaN,90)]            | 
1745  {NaN,NaN,NaN}                         | [(1,2),(3,4)]                 | 
1746  {NaN,NaN,NaN}                         | [(0,0),(6,6)]                 | 
1747  {NaN,NaN,NaN}                         | [(10,-10),(-3,-4)]            | 
1748  {NaN,NaN,NaN}                         | [(-1000000,200),(300000,-40)] | 
1749  {NaN,NaN,NaN}                         | [(11,22),(33,44)]             | 
1750  {NaN,NaN,NaN}                         | [(-10,2),(-10,3)]             | 
1751  {NaN,NaN,NaN}                         | [(0,-20),(30,-20)]            | 
1752  {NaN,NaN,NaN}                         | [(NaN,1),(NaN,90)]            | 
1753  {0,-1,3}                              | [(1,2),(3,4)]                 | (2,3)
1754  {0,-1,3}                              | [(0,0),(6,6)]                 | (3,3)
1755  {0,-1,3}                              | [(10,-10),(-3,-4)]            | (-3,-4)
1756  {0,-1,3}                              | [(-1000000,200),(300000,-40)] | (67083.3333333,3)
1757  {0,-1,3}                              | [(11,22),(33,44)]             | (11,22)
1758  {0,-1,3}                              | [(-10,2),(-10,3)]             | (-10,3)
1759  {0,-1,3}                              | [(0,-20),(30,-20)]            | 
1760  {0,-1,3}                              | [(NaN,1),(NaN,90)]            | 
1761  {-1,0,3}                              | [(1,2),(3,4)]                 | (3,4)
1762  {-1,0,3}                              | [(0,0),(6,6)]                 | (3,3)
1763  {-1,0,3}                              | [(10,-10),(-3,-4)]            | (3,-6.76923076923)
1764  {-1,0,3}                              | [(-1000000,200),(300000,-40)] | (3,15.3840615385)
1765  {-1,0,3}                              | [(11,22),(33,44)]             | (11,22)
1766  {-1,0,3}                              | [(-10,2),(-10,3)]             | 
1767  {-1,0,3}                              | [(0,-20),(30,-20)]            | (3,-20)
1768  {-1,0,3}                              | [(NaN,1),(NaN,90)]            | 
1769 (80 rows)
1772 -- Line segments
1774 -- intersection
1775 SELECT p.f1, l.s, l.s # p.f1 AS intersection
1776    FROM LSEG_TBL l, POINT_TBL p;
1777 ERROR:  operator does not exist: lseg # point
1778 LINE 1: SELECT p.f1, l.s, l.s # p.f1 AS intersection
1779                               ^
1780 HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
1781 -- Length
1782 SELECT s, @-@ s FROM LSEG_TBL;
1783                s               |   ?column?    
1784 -------------------------------+---------------
1785  [(1,2),(3,4)]                 | 2.82842712475
1786  [(0,0),(6,6)]                 | 8.48528137424
1787  [(10,-10),(-3,-4)]            | 14.3178210633
1788  [(-1000000,200),(300000,-40)] | 1300000.02215
1789  [(11,22),(33,44)]             | 31.1126983722
1790  [(-10,2),(-10,3)]             |             1
1791  [(0,-20),(30,-20)]            |            30
1792  [(NaN,1),(NaN,90)]            |           NaN
1793 (8 rows)
1795 -- Vertical
1796 SELECT s FROM LSEG_TBL WHERE ?| s;
1797          s         
1798 -------------------
1799  [(-10,2),(-10,3)]
1800 (1 row)
1802 -- Horizontal
1803 SELECT s FROM LSEG_TBL WHERE ?- s;
1804          s          
1805 --------------------
1806  [(0,-20),(30,-20)]
1807 (1 row)
1809 -- Center
1810 SELECT s, @@ s FROM LSEG_TBL;
1811                s               |   ?column?   
1812 -------------------------------+--------------
1813  [(1,2),(3,4)]                 | (2,3)
1814  [(0,0),(6,6)]                 | (3,3)
1815  [(10,-10),(-3,-4)]            | (3.5,-7)
1816  [(-1000000,200),(300000,-40)] | (-350000,80)
1817  [(11,22),(33,44)]             | (22,33)
1818  [(-10,2),(-10,3)]             | (-10,2.5)
1819  [(0,-20),(30,-20)]            | (15,-20)
1820  [(NaN,1),(NaN,90)]            | (NaN,45.5)
1821 (8 rows)
1823 -- To point
1824 SELECT s, s::point FROM LSEG_TBL;
1825                s               |      s       
1826 -------------------------------+--------------
1827  [(1,2),(3,4)]                 | (2,3)
1828  [(0,0),(6,6)]                 | (3,3)
1829  [(10,-10),(-3,-4)]            | (3.5,-7)
1830  [(-1000000,200),(300000,-40)] | (-350000,80)
1831  [(11,22),(33,44)]             | (22,33)
1832  [(-10,2),(-10,3)]             | (-10,2.5)
1833  [(0,-20),(30,-20)]            | (15,-20)
1834  [(NaN,1),(NaN,90)]            | (NaN,45.5)
1835 (8 rows)
1837 -- Has points less than line segment
1838 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s < l2.s;
1839          s          |               s               
1840 --------------------+-------------------------------
1841  [(1,2),(3,4)]      | [(0,0),(6,6)]
1842  [(1,2),(3,4)]      | [(10,-10),(-3,-4)]
1843  [(1,2),(3,4)]      | [(-1000000,200),(300000,-40)]
1844  [(1,2),(3,4)]      | [(11,22),(33,44)]
1845  [(1,2),(3,4)]      | [(0,-20),(30,-20)]
1846  [(0,0),(6,6)]      | [(10,-10),(-3,-4)]
1847  [(0,0),(6,6)]      | [(-1000000,200),(300000,-40)]
1848  [(0,0),(6,6)]      | [(11,22),(33,44)]
1849  [(0,0),(6,6)]      | [(0,-20),(30,-20)]
1850  [(10,-10),(-3,-4)] | [(-1000000,200),(300000,-40)]
1851  [(10,-10),(-3,-4)] | [(11,22),(33,44)]
1852  [(10,-10),(-3,-4)] | [(0,-20),(30,-20)]
1853  [(11,22),(33,44)]  | [(-1000000,200),(300000,-40)]
1854  [(-10,2),(-10,3)]  | [(1,2),(3,4)]
1855  [(-10,2),(-10,3)]  | [(0,0),(6,6)]
1856  [(-10,2),(-10,3)]  | [(10,-10),(-3,-4)]
1857  [(-10,2),(-10,3)]  | [(-1000000,200),(300000,-40)]
1858  [(-10,2),(-10,3)]  | [(11,22),(33,44)]
1859  [(-10,2),(-10,3)]  | [(0,-20),(30,-20)]
1860  [(0,-20),(30,-20)] | [(-1000000,200),(300000,-40)]
1861  [(0,-20),(30,-20)] | [(11,22),(33,44)]
1862 (21 rows)
1864 -- Has points less than or equal to line segment
1865 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s <= l2.s;
1866                s               |               s               
1867 -------------------------------+-------------------------------
1868  [(1,2),(3,4)]                 | [(1,2),(3,4)]
1869  [(1,2),(3,4)]                 | [(0,0),(6,6)]
1870  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]
1871  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)]
1872  [(1,2),(3,4)]                 | [(11,22),(33,44)]
1873  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]
1874  [(0,0),(6,6)]                 | [(0,0),(6,6)]
1875  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]
1876  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)]
1877  [(0,0),(6,6)]                 | [(11,22),(33,44)]
1878  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]
1879  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
1880  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)]
1881  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]
1882  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]
1883  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
1884  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)]
1885  [(11,22),(33,44)]             | [(11,22),(33,44)]
1886  [(-10,2),(-10,3)]             | [(1,2),(3,4)]
1887  [(-10,2),(-10,3)]             | [(0,0),(6,6)]
1888  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]
1889  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)]
1890  [(-10,2),(-10,3)]             | [(11,22),(33,44)]
1891  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
1892  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]
1893  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)]
1894  [(0,-20),(30,-20)]            | [(11,22),(33,44)]
1895  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
1896 (28 rows)
1898 -- Has points equal to line segment
1899 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s = l2.s;
1900                s               |               s               
1901 -------------------------------+-------------------------------
1902  [(1,2),(3,4)]                 | [(1,2),(3,4)]
1903  [(0,0),(6,6)]                 | [(0,0),(6,6)]
1904  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
1905  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
1906  [(11,22),(33,44)]             | [(11,22),(33,44)]
1907  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
1908  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
1909  [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]
1910 (8 rows)
1912 -- Has points greater than or equal to line segment
1913 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s >= l2.s;
1914                s               |               s               
1915 -------------------------------+-------------------------------
1916  [(1,2),(3,4)]                 | [(1,2),(3,4)]
1917  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
1918  [(0,0),(6,6)]                 | [(1,2),(3,4)]
1919  [(0,0),(6,6)]                 | [(0,0),(6,6)]
1920  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
1921  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
1922  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
1923  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
1924  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
1925  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
1926  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
1927  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
1928  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
1929  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
1930  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
1931  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
1932  [(11,22),(33,44)]             | [(1,2),(3,4)]
1933  [(11,22),(33,44)]             | [(0,0),(6,6)]
1934  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
1935  [(11,22),(33,44)]             | [(11,22),(33,44)]
1936  [(11,22),(33,44)]             | [(-10,2),(-10,3)]
1937  [(11,22),(33,44)]             | [(0,-20),(30,-20)]
1938  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
1939  [(0,-20),(30,-20)]            | [(1,2),(3,4)]
1940  [(0,-20),(30,-20)]            | [(0,0),(6,6)]
1941  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
1942  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
1943  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
1944 (28 rows)
1946 -- Has points greater than line segment
1947 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s > l2.s;
1948                s               |         s          
1949 -------------------------------+--------------------
1950  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
1951  [(0,0),(6,6)]                 | [(1,2),(3,4)]
1952  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
1953  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
1954  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
1955  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
1956  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
1957  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
1958  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
1959  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
1960  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
1961  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
1962  [(11,22),(33,44)]             | [(1,2),(3,4)]
1963  [(11,22),(33,44)]             | [(0,0),(6,6)]
1964  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
1965  [(11,22),(33,44)]             | [(-10,2),(-10,3)]
1966  [(11,22),(33,44)]             | [(0,-20),(30,-20)]
1967  [(0,-20),(30,-20)]            | [(1,2),(3,4)]
1968  [(0,-20),(30,-20)]            | [(0,0),(6,6)]
1969  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
1970  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
1971 (21 rows)
1973 -- Has points not equal to line segment
1974 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s != l2.s;
1975                s               |               s               
1976 -------------------------------+-------------------------------
1977  [(1,2),(3,4)]                 | [(0,0),(6,6)]
1978  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]
1979  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)]
1980  [(1,2),(3,4)]                 | [(11,22),(33,44)]
1981  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
1982  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]
1983  [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]
1984  [(0,0),(6,6)]                 | [(1,2),(3,4)]
1985  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]
1986  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)]
1987  [(0,0),(6,6)]                 | [(11,22),(33,44)]
1988  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
1989  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]
1990  [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]
1991  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
1992  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
1993  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)]
1994  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]
1995  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
1996  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]
1997  [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]
1998  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
1999  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
2000  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
2001  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
2002  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
2003  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
2004  [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]
2005  [(11,22),(33,44)]             | [(1,2),(3,4)]
2006  [(11,22),(33,44)]             | [(0,0),(6,6)]
2007  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
2008  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)]
2009  [(11,22),(33,44)]             | [(-10,2),(-10,3)]
2010  [(11,22),(33,44)]             | [(0,-20),(30,-20)]
2011  [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]
2012  [(-10,2),(-10,3)]             | [(1,2),(3,4)]
2013  [(-10,2),(-10,3)]             | [(0,0),(6,6)]
2014  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]
2015  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)]
2016  [(-10,2),(-10,3)]             | [(11,22),(33,44)]
2017  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]
2018  [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]
2019  [(0,-20),(30,-20)]            | [(1,2),(3,4)]
2020  [(0,-20),(30,-20)]            | [(0,0),(6,6)]
2021  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
2022  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)]
2023  [(0,-20),(30,-20)]            | [(11,22),(33,44)]
2024  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
2025  [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]
2026  [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]
2027  [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]
2028  [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]
2029  [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)]
2030  [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]
2031  [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]
2032  [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]
2033 (56 rows)
2035 -- Parallel with line segment
2036 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?|| l2.s;
2037                s               |               s               
2038 -------------------------------+-------------------------------
2039  [(1,2),(3,4)]                 | [(1,2),(3,4)]
2040  [(1,2),(3,4)]                 | [(0,0),(6,6)]
2041  [(1,2),(3,4)]                 | [(11,22),(33,44)]
2042  [(0,0),(6,6)]                 | [(1,2),(3,4)]
2043  [(0,0),(6,6)]                 | [(0,0),(6,6)]
2044  [(0,0),(6,6)]                 | [(11,22),(33,44)]
2045  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
2046  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
2047  [(11,22),(33,44)]             | [(1,2),(3,4)]
2048  [(11,22),(33,44)]             | [(0,0),(6,6)]
2049  [(11,22),(33,44)]             | [(11,22),(33,44)]
2050  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
2051  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
2052 (13 rows)
2054 -- Perpendicular with line segment
2055 SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?-| l2.s;
2056          s          |         s          
2057 --------------------+--------------------
2058  [(-10,2),(-10,3)]  | [(0,-20),(30,-20)]
2059  [(0,-20),(30,-20)] | [(-10,2),(-10,3)]
2060 (2 rows)
2062 -- Distance to line
2063 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;
2064                s               |                   s                   |    dist_sl     |    dist_ls     
2065 -------------------------------+---------------------------------------+----------------+----------------
2066  [(1,2),(3,4)]                 | {0,-1,5}                              |              1 |              1
2067  [(0,0),(6,6)]                 | {0,-1,5}                              |              0 |              0
2068  [(10,-10),(-3,-4)]            | {0,-1,5}                              |              9 |              9
2069  [(-1000000,200),(300000,-40)] | {0,-1,5}                              |              0 |              0
2070  [(11,22),(33,44)]             | {0,-1,5}                              |             17 |             17
2071  [(-10,2),(-10,3)]             | {0,-1,5}                              |              2 |              2
2072  [(0,-20),(30,-20)]            | {0,-1,5}                              |             25 |             25
2073  [(NaN,1),(NaN,90)]            | {0,-1,5}                              |            NaN |            NaN
2074  [(1,2),(3,4)]                 | {1,0,5}                               |              6 |              6
2075  [(0,0),(6,6)]                 | {1,0,5}                               |              5 |              5
2076  [(10,-10),(-3,-4)]            | {1,0,5}                               |              2 |              2
2077  [(-1000000,200),(300000,-40)] | {1,0,5}                               |              0 |              0
2078  [(11,22),(33,44)]             | {1,0,5}                               |             16 |             16
2079  [(-10,2),(-10,3)]             | {1,0,5}                               |              5 |              5
2080  [(0,-20),(30,-20)]            | {1,0,5}                               |              5 |              5
2081  [(NaN,1),(NaN,90)]            | {1,0,5}                               |            NaN |            NaN
2082  [(1,2),(3,4)]                 | {0,3,0}                               |              2 |              2
2083  [(0,0),(6,6)]                 | {0,3,0}                               |              0 |              0
2084  [(10,-10),(-3,-4)]            | {0,3,0}                               |              4 |              4
2085  [(-1000000,200),(300000,-40)] | {0,3,0}                               |              0 |              0
2086  [(11,22),(33,44)]             | {0,3,0}                               |             22 |             22
2087  [(-10,2),(-10,3)]             | {0,3,0}                               |              2 |              2
2088  [(0,-20),(30,-20)]            | {0,3,0}                               |             20 |             20
2089  [(NaN,1),(NaN,90)]            | {0,3,0}                               |            NaN |            NaN
2090  [(1,2),(3,4)]                 | {1,-1,0}                              | 0.707106781187 | 0.707106781187
2091  [(0,0),(6,6)]                 | {1,-1,0}                              |              0 |              0
2092  [(10,-10),(-3,-4)]            | {1,-1,0}                              | 0.707106781187 | 0.707106781187
2093  [(-1000000,200),(300000,-40)] | {1,-1,0}                              |              0 |              0
2094  [(11,22),(33,44)]             | {1,-1,0}                              |  7.77817459305 |  7.77817459305
2095  [(-10,2),(-10,3)]             | {1,-1,0}                              |  8.48528137424 |  8.48528137424
2096  [(0,-20),(30,-20)]            | {1,-1,0}                              |  14.1421356237 |  14.1421356237
2097  [(NaN,1),(NaN,90)]            | {1,-1,0}                              |            NaN |            NaN
2098  [(1,2),(3,4)]                 | {-0.4,-1,-6}                          |  7.79920420344 |  7.79920420344
2099  [(0,0),(6,6)]                 | {-0.4,-1,-6}                          |  5.57086014531 |  5.57086014531
2100  [(10,-10),(-3,-4)]            | {-0.4,-1,-6}                          |              0 |              0
2101  [(-1000000,200),(300000,-40)] | {-0.4,-1,-6}                          |              0 |              0
2102  [(11,22),(33,44)]             | {-0.4,-1,-6}                          |  30.0826447847 |  30.0826447847
2103  [(-10,2),(-10,3)]             | {-0.4,-1,-6}                          |  3.71390676354 |  3.71390676354
2104  [(0,-20),(30,-20)]            | {-0.4,-1,-6}                          |  1.85695338177 |  1.85695338177
2105  [(NaN,1),(NaN,90)]            | {-0.4,-1,-6}                          |            NaN |            NaN
2106  [(1,2),(3,4)]                 | {-0.000184615384615,-1,15.3846153846} |  11.3840613445 |  11.3840613445
2107  [(0,0),(6,6)]                 | {-0.000184615384615,-1,15.3846153846} |   9.3835075324 |   9.3835075324
2108  [(10,-10),(-3,-4)]            | {-0.000184615384615,-1,15.3846153846} |  19.3851689004 |  19.3851689004
2109  [(-1000000,200),(300000,-40)] | {-0.000184615384615,-1,15.3846153846} |              0 |              0
2110  [(11,22),(33,44)]             | {-0.000184615384615,-1,15.3846153846} |  6.61741527185 |  6.61741527185
2111  [(-10,2),(-10,3)]             | {-0.000184615384615,-1,15.3846153846} |  12.3864613274 |  12.3864613274
2112  [(0,-20),(30,-20)]            | {-0.000184615384615,-1,15.3846153846} |  35.3790763202 |  35.3790763202
2113  [(NaN,1),(NaN,90)]            | {-0.000184615384615,-1,15.3846153846} |            NaN |            NaN
2114  [(1,2),(3,4)]                 | {3,NaN,5}                             |            NaN |            NaN
2115  [(0,0),(6,6)]                 | {3,NaN,5}                             |            NaN |            NaN
2116  [(10,-10),(-3,-4)]            | {3,NaN,5}                             |            NaN |            NaN
2117  [(-1000000,200),(300000,-40)] | {3,NaN,5}                             |            NaN |            NaN
2118  [(11,22),(33,44)]             | {3,NaN,5}                             |            NaN |            NaN
2119  [(-10,2),(-10,3)]             | {3,NaN,5}                             |            NaN |            NaN
2120  [(0,-20),(30,-20)]            | {3,NaN,5}                             |            NaN |            NaN
2121  [(NaN,1),(NaN,90)]            | {3,NaN,5}                             |            NaN |            NaN
2122  [(1,2),(3,4)]                 | {NaN,NaN,NaN}                         |            NaN |            NaN
2123  [(0,0),(6,6)]                 | {NaN,NaN,NaN}                         |            NaN |            NaN
2124  [(10,-10),(-3,-4)]            | {NaN,NaN,NaN}                         |            NaN |            NaN
2125  [(-1000000,200),(300000,-40)] | {NaN,NaN,NaN}                         |            NaN |            NaN
2126  [(11,22),(33,44)]             | {NaN,NaN,NaN}                         |            NaN |            NaN
2127  [(-10,2),(-10,3)]             | {NaN,NaN,NaN}                         |            NaN |            NaN
2128  [(0,-20),(30,-20)]            | {NaN,NaN,NaN}                         |            NaN |            NaN
2129  [(NaN,1),(NaN,90)]            | {NaN,NaN,NaN}                         |            NaN |            NaN
2130  [(1,2),(3,4)]                 | {0,-1,3}                              |              0 |              0
2131  [(0,0),(6,6)]                 | {0,-1,3}                              |              0 |              0
2132  [(10,-10),(-3,-4)]            | {0,-1,3}                              |              7 |              7
2133  [(-1000000,200),(300000,-40)] | {0,-1,3}                              |              0 |              0
2134  [(11,22),(33,44)]             | {0,-1,3}                              |             19 |             19
2135  [(-10,2),(-10,3)]             | {0,-1,3}                              |              0 |              0
2136  [(0,-20),(30,-20)]            | {0,-1,3}                              |             23 |             23
2137  [(NaN,1),(NaN,90)]            | {0,-1,3}                              |            NaN |            NaN
2138  [(1,2),(3,4)]                 | {-1,0,3}                              |              0 |              0
2139  [(0,0),(6,6)]                 | {-1,0,3}                              |              0 |              0
2140  [(10,-10),(-3,-4)]            | {-1,0,3}                              |              0 |              0
2141  [(-1000000,200),(300000,-40)] | {-1,0,3}                              |              0 |              0
2142  [(11,22),(33,44)]             | {-1,0,3}                              |              8 |              8
2143  [(-10,2),(-10,3)]             | {-1,0,3}                              |             13 |             13
2144  [(0,-20),(30,-20)]            | {-1,0,3}                              |              0 |              0
2145  [(NaN,1),(NaN,90)]            | {-1,0,3}                              |            NaN |            NaN
2146 (80 rows)
2148 -- Distance to line segment
2149 SELECT l1.s, l2.s, l1.s <-> l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
2150                s               |               s               |    ?column?    
2151 -------------------------------+-------------------------------+----------------
2152  [(1,2),(3,4)]                 | [(1,2),(3,4)]                 |              0
2153  [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 0.707106781187
2154  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            |  7.12398901685
2155  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] |  11.3840613445
2156  [(1,2),(3,4)]                 | [(11,22),(33,44)]             |  19.6977156036
2157  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             |             11
2158  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            |             22
2159  [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            |            NaN
2160  [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 0.707106781187
2161  [(0,0),(6,6)]                 | [(0,0),(6,6)]                 |              0
2162  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            |  4.88901207039
2163  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] |   9.3835075324
2164  [(0,0),(6,6)]                 | [(11,22),(33,44)]             |  16.7630546142
2165  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             |  10.1980390272
2166  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            |             20
2167  [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            |            NaN
2168  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 |  7.12398901685
2169  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 |  4.88901207039
2170  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            |              0
2171  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] |  19.3851689004
2172  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             |  29.4737584815
2173  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             |  9.21954445729
2174  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            |             10
2175  [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            |            NaN
2176  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 |  11.3840613445
2177  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 |   9.3835075324
2178  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            |  19.3851689004
2179  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] |              0
2180  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             |  6.61741527185
2181  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             |  12.3864613274
2182  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            |  35.3790763202
2183  [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            |            NaN
2184  [(11,22),(33,44)]             | [(1,2),(3,4)]                 |  19.6977156036
2185  [(11,22),(33,44)]             | [(0,0),(6,6)]                 |  16.7630546142
2186  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            |  29.4737584815
2187  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] |  6.61741527185
2188  [(11,22),(33,44)]             | [(11,22),(33,44)]             |              0
2189  [(11,22),(33,44)]             | [(-10,2),(-10,3)]             |   28.319604517
2190  [(11,22),(33,44)]             | [(0,-20),(30,-20)]            |             42
2191  [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            |            NaN
2192  [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 |             11
2193  [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 |  10.1980390272
2194  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            |  9.21954445729
2195  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] |  12.3864613274
2196  [(-10,2),(-10,3)]             | [(11,22),(33,44)]             |   28.319604517
2197  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             |              0
2198  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            |  24.1660919472
2199  [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            |            NaN
2200  [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 |             22
2201  [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 |             20
2202  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            |             10
2203  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] |  35.3790763202
2204  [(0,-20),(30,-20)]            | [(11,22),(33,44)]             |             42
2205  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             |  24.1660919472
2206  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            |              0
2207  [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            |            NaN
2208  [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 |            NaN
2209  [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 |            NaN
2210  [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            |            NaN
2211  [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] |            NaN
2212  [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             |            NaN
2213  [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             |            NaN
2214  [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            |            NaN
2215  [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            |            NaN
2216 (64 rows)
2218 -- Distance to box
2219 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;
2220                s               |         f1          |    dist_sb     |    dist_bs     
2221 -------------------------------+---------------------+----------------+----------------
2222  [(1,2),(3,4)]                 | (2,2),(0,0)         |              0 |              0
2223  [(1,2),(3,4)]                 | (3,3),(1,1)         |              0 |              0
2224  [(1,2),(3,4)]                 | (-2,2),(-8,-10)     |              3 |              3
2225  [(1,2),(3,4)]                 | (2.5,3.5),(2.5,2.5) |              0 |              0
2226  [(1,2),(3,4)]                 | (3,3),(3,3)         | 0.707106781187 | 0.707106781187
2227  [(0,0),(6,6)]                 | (2,2),(0,0)         |              0 |              0
2228  [(0,0),(6,6)]                 | (3,3),(1,1)         |              0 |              0
2229  [(0,0),(6,6)]                 | (-2,2),(-8,-10)     |              2 |              2
2230  [(0,0),(6,6)]                 | (2.5,3.5),(2.5,2.5) |              0 |              0
2231  [(0,0),(6,6)]                 | (3,3),(3,3)         |              0 |              0
2232  [(10,-10),(-3,-4)]            | (2,2),(0,0)         |  4.88901207039 |  4.88901207039
2233  [(10,-10),(-3,-4)]            | (3,3),(1,1)         |  6.21602963235 |  6.21602963235
2234  [(10,-10),(-3,-4)]            | (-2,2),(-8,-10)     |              0 |              0
2235  [(10,-10),(-3,-4)]            | (2.5,3.5),(2.5,2.5) |  8.20655597529 |  8.20655597529
2236  [(10,-10),(-3,-4)]            | (3,3),(3,3)         |  8.87006475627 |  8.87006475627
2237  [(-1000000,200),(300000,-40)] | (2,2),(0,0)         |  13.3842459258 |  13.3842459258
2238  [(-1000000,200),(300000,-40)] | (3,3),(1,1)         |  12.3840613274 |  12.3840613274
2239  [(-1000000,200),(300000,-40)] | (-2,2),(-8,-10)     |  13.3849843873 |  13.3849843873
2240  [(-1000000,200),(300000,-40)] | (2.5,3.5),(2.5,2.5) |  11.8841536436 |  11.8841536436
2241  [(-1000000,200),(300000,-40)] | (3,3),(3,3)         |  12.3840613274 |  12.3840613274
2242  [(11,22),(33,44)]             | (2,2),(0,0)         |  21.9317121995 |  21.9317121995
2243  [(11,22),(33,44)]             | (3,3),(1,1)         |  20.6155281281 |  20.6155281281
2244  [(11,22),(33,44)]             | (-2,2),(-8,-10)     |  23.8537208838 |  23.8537208838
2245  [(11,22),(33,44)]             | (2.5,3.5),(2.5,2.5) |  20.3592730715 |  20.3592730715
2246  [(11,22),(33,44)]             | (3,3),(3,3)         |  20.6155281281 |  20.6155281281
2247  [(-10,2),(-10,3)]             | (2,2),(0,0)         |             10 |             10
2248  [(-10,2),(-10,3)]             | (3,3),(1,1)         |             11 |             11
2249  [(-10,2),(-10,3)]             | (-2,2),(-8,-10)     |              2 |              2
2250  [(-10,2),(-10,3)]             | (2.5,3.5),(2.5,2.5) |           12.5 |           12.5
2251  [(-10,2),(-10,3)]             | (3,3),(3,3)         |             13 |             13
2252  [(0,-20),(30,-20)]            | (2,2),(0,0)         |             20 |             20
2253  [(0,-20),(30,-20)]            | (3,3),(1,1)         |             21 |             21
2254  [(0,-20),(30,-20)]            | (-2,2),(-8,-10)     |  10.1980390272 |  10.1980390272
2255  [(0,-20),(30,-20)]            | (2.5,3.5),(2.5,2.5) |           22.5 |           22.5
2256  [(0,-20),(30,-20)]            | (3,3),(3,3)         |             23 |             23
2257  [(NaN,1),(NaN,90)]            | (2,2),(0,0)         |            NaN |            NaN
2258  [(NaN,1),(NaN,90)]            | (3,3),(1,1)         |            NaN |            NaN
2259  [(NaN,1),(NaN,90)]            | (-2,2),(-8,-10)     |            NaN |            NaN
2260  [(NaN,1),(NaN,90)]            | (2.5,3.5),(2.5,2.5) |            NaN |            NaN
2261  [(NaN,1),(NaN,90)]            | (3,3),(3,3)         |            NaN |            NaN
2262 (40 rows)
2264 -- Intersect with line segment
2265 SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s ?# l1.s;
2266                s               |      s       
2267 -------------------------------+--------------
2268  [(0,0),(6,6)]                 | {0,-1,5}
2269  [(-1000000,200),(300000,-40)] | {0,-1,5}
2270  [(-1000000,200),(300000,-40)] | {1,0,5}
2271  [(0,0),(6,6)]                 | {0,3,0}
2272  [(-1000000,200),(300000,-40)] | {0,3,0}
2273  [(-1000000,200),(300000,-40)] | {1,-1,0}
2274  [(10,-10),(-3,-4)]            | {-0.4,-1,-6}
2275  [(-1000000,200),(300000,-40)] | {-0.4,-1,-6}
2276  [(1,2),(3,4)]                 | {0,-1,3}
2277  [(0,0),(6,6)]                 | {0,-1,3}
2278  [(-1000000,200),(300000,-40)] | {0,-1,3}
2279  [(-10,2),(-10,3)]             | {0,-1,3}
2280  [(1,2),(3,4)]                 | {-1,0,3}
2281  [(0,0),(6,6)]                 | {-1,0,3}
2282  [(10,-10),(-3,-4)]            | {-1,0,3}
2283  [(-1000000,200),(300000,-40)] | {-1,0,3}
2284  [(0,-20),(30,-20)]            | {-1,0,3}
2285 (17 rows)
2287 -- Intersect with box
2288 SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
2289          s          |         f1          
2290 --------------------+---------------------
2291  [(1,2),(3,4)]      | (2,2),(0,0)
2292  [(1,2),(3,4)]      | (3,3),(1,1)
2293  [(1,2),(3,4)]      | (2.5,3.5),(2.5,2.5)
2294  [(0,0),(6,6)]      | (2,2),(0,0)
2295  [(0,0),(6,6)]      | (3,3),(1,1)
2296  [(0,0),(6,6)]      | (2.5,3.5),(2.5,2.5)
2297  [(0,0),(6,6)]      | (3,3),(3,3)
2298  [(10,-10),(-3,-4)] | (-2,2),(-8,-10)
2299 (8 rows)
2301 -- Intersection point with line segment
2302 SELECT l1.s, l2.s, l1.s # l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
2303                s               |               s               | ?column? 
2304 -------------------------------+-------------------------------+----------
2305  [(1,2),(3,4)]                 | [(1,2),(3,4)]                 | 
2306  [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 
2307  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            | 
2308  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] | 
2309  [(1,2),(3,4)]                 | [(11,22),(33,44)]             | 
2310  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             | 
2311  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            | 
2312  [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            | 
2313  [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 
2314  [(0,0),(6,6)]                 | [(0,0),(6,6)]                 | 
2315  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            | 
2316  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] | 
2317  [(0,0),(6,6)]                 | [(11,22),(33,44)]             | 
2318  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             | 
2319  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            | 
2320  [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            | 
2321  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 | 
2322  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 | 
2323  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            | 
2324  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] | 
2325  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             | 
2326  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             | 
2327  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            | 
2328  [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            | 
2329  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 | 
2330  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 | 
2331  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            | 
2332  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] | 
2333  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             | 
2334  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             | 
2335  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            | 
2336  [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            | 
2337  [(11,22),(33,44)]             | [(1,2),(3,4)]                 | 
2338  [(11,22),(33,44)]             | [(0,0),(6,6)]                 | 
2339  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            | 
2340  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] | 
2341  [(11,22),(33,44)]             | [(11,22),(33,44)]             | 
2342  [(11,22),(33,44)]             | [(-10,2),(-10,3)]             | 
2343  [(11,22),(33,44)]             | [(0,-20),(30,-20)]            | 
2344  [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            | 
2345  [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 | 
2346  [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 | 
2347  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            | 
2348  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] | 
2349  [(-10,2),(-10,3)]             | [(11,22),(33,44)]             | 
2350  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             | 
2351  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            | 
2352  [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            | 
2353  [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 | 
2354  [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 | 
2355  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            | 
2356  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] | 
2357  [(0,-20),(30,-20)]            | [(11,22),(33,44)]             | 
2358  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             | 
2359  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            | 
2360  [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            | 
2361  [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 | 
2362  [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 | 
2363  [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            | 
2364  [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] | 
2365  [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             | 
2366  [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             | 
2367  [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            | 
2368  [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            | 
2369 (64 rows)
2371 -- Closest point to line segment
2372 SELECT l1.s, l2.s, l1.s ## l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
2373                s               |               s               |            ?column?             
2374 -------------------------------+-------------------------------+---------------------------------
2375  [(1,2),(3,4)]                 | [(1,2),(3,4)]                 | 
2376  [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 
2377  [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            | (-1.98536585366,-4.46829268293)
2378  [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] | (3.00210167283,15.3840611505)
2379  [(1,2),(3,4)]                 | [(11,22),(33,44)]             | 
2380  [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             | (-10,2)
2381  [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            | (1,-20)
2382  [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            | 
2383  [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 
2384  [(0,0),(6,6)]                 | [(0,0),(6,6)]                 | 
2385  [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
2386  [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] | (6.00173233982,15.3835073725)
2387  [(0,0),(6,6)]                 | [(11,22),(33,44)]             | 
2388  [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             | (-10,2)
2389  [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            | (0,-20)
2390  [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            | 
2391  [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 | (1,2)
2392  [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 | (0,0)
2393  [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            | 
2394  [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] | (-2.99642119965,15.3851685701)
2395  [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             | (11,22)
2396  [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             | (-10,2)
2397  [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            | (10,-20)
2398  [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            | 
2399  [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 | (3,4)
2400  [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 | (6,6)
2401  [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            | (-3,-4)
2402  [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] | 
2403  [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             | (11,22)
2404  [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             | (-10,3)
2405  [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            | (30,-20)
2406  [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            | 
2407  [(11,22),(33,44)]             | [(1,2),(3,4)]                 | 
2408  [(11,22),(33,44)]             | [(0,0),(6,6)]                 | 
2409  [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            | (-1.3512195122,-4.76097560976)
2410  [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] | (10.9987783234,15.3825848409)
2411  [(11,22),(33,44)]             | [(11,22),(33,44)]             | 
2412  [(11,22),(33,44)]             | [(-10,2),(-10,3)]             | (-10,3)
2413  [(11,22),(33,44)]             | [(0,-20),(30,-20)]            | (11,-20)
2414  [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            | 
2415  [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 | (1,2)
2416  [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 | (0,0)
2417  [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            | (-3,-4)
2418  [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] | (-9.99771326872,15.3864611163)
2419  [(-10,2),(-10,3)]             | [(11,22),(33,44)]             | (11,22)
2420  [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             | 
2421  [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            | (0,-20)
2422  [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            | 
2423  [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 | (1,2)
2424  [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 | (0,0)
2425  [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            | (10,-10)
2426  [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] | (30.0065315217,15.3790757173)
2427  [(0,-20),(30,-20)]            | [(11,22),(33,44)]             | (11,22)
2428  [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             | (-10,2)
2429  [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            | 
2430  [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            | 
2431  [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 | 
2432  [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 | 
2433  [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            | 
2434  [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] | 
2435  [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             | 
2436  [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             | 
2437  [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            | 
2438  [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            | 
2439 (64 rows)
2441 -- Closest point to box
2442 SELECT l.s, b.f1, l.s ## b.f1 FROM LSEG_TBL l, BOX_TBL b;
2443                s               |         f1          |  ?column?   
2444 -------------------------------+---------------------+-------------
2445  [(1,2),(3,4)]                 | (2,2),(0,0)         | (1,2)
2446  [(1,2),(3,4)]                 | (3,3),(1,1)         | (1.5,2.5)
2447  [(1,2),(3,4)]                 | (-2,2),(-8,-10)     | (-2,2)
2448  [(1,2),(3,4)]                 | (2.5,3.5),(2.5,2.5) | (2.25,3.25)
2449  [(1,2),(3,4)]                 | (3,3),(3,3)         | (3,3)
2450  [(0,0),(6,6)]                 | (2,2),(0,0)         | (1,1)
2451  [(0,0),(6,6)]                 | (3,3),(1,1)         | (2,2)
2452  [(0,0),(6,6)]                 | (-2,2),(-8,-10)     | (-2,0)
2453  [(0,0),(6,6)]                 | (2.5,3.5),(2.5,2.5) | (2.75,2.75)
2454  [(0,0),(6,6)]                 | (3,3),(3,3)         | (3,3)
2455  [(10,-10),(-3,-4)]            | (2,2),(0,0)         | (0,0)
2456  [(10,-10),(-3,-4)]            | (3,3),(1,1)         | (1,1)
2457  [(10,-10),(-3,-4)]            | (-2,2),(-8,-10)     | (-3,-4)
2458  [(10,-10),(-3,-4)]            | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
2459  [(10,-10),(-3,-4)]            | (3,3),(3,3)         | (3,3)
2460  [(-1000000,200),(300000,-40)] | (2,2),(0,0)         | (2,2)
2461  [(-1000000,200),(300000,-40)] | (3,3),(1,1)         | (3,3)
2462  [(-1000000,200),(300000,-40)] | (-2,2),(-8,-10)     | (-2,2)
2463  [(-1000000,200),(300000,-40)] | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
2464  [(-1000000,200),(300000,-40)] | (3,3),(3,3)         | (3,3)
2465  [(11,22),(33,44)]             | (2,2),(0,0)         | (2,2)
2466  [(11,22),(33,44)]             | (3,3),(1,1)         | (3,3)
2467  [(11,22),(33,44)]             | (-2,2),(-8,-10)     | (-2,2)
2468  [(11,22),(33,44)]             | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
2469  [(11,22),(33,44)]             | (3,3),(3,3)         | (3,3)
2470  [(-10,2),(-10,3)]             | (2,2),(0,0)         | (0,2)
2471  [(-10,2),(-10,3)]             | (3,3),(1,1)         | (1,2)
2472  [(-10,2),(-10,3)]             | (-2,2),(-8,-10)     | (-8,2)
2473  [(-10,2),(-10,3)]             | (2.5,3.5),(2.5,2.5) | (2.5,3)
2474  [(-10,2),(-10,3)]             | (3,3),(3,3)         | (3,3)
2475  [(0,-20),(30,-20)]            | (2,2),(0,0)         | (0,0)
2476  [(0,-20),(30,-20)]            | (3,3),(1,1)         | (1,1)
2477  [(0,-20),(30,-20)]            | (-2,2),(-8,-10)     | (-2,-10)
2478  [(0,-20),(30,-20)]            | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
2479  [(0,-20),(30,-20)]            | (3,3),(3,3)         | (3,3)
2480  [(NaN,1),(NaN,90)]            | (2,2),(0,0)         | 
2481  [(NaN,1),(NaN,90)]            | (3,3),(1,1)         | 
2482  [(NaN,1),(NaN,90)]            | (-2,2),(-8,-10)     | 
2483  [(NaN,1),(NaN,90)]            | (2.5,3.5),(2.5,2.5) | 
2484  [(NaN,1),(NaN,90)]            | (3,3),(3,3)         | 
2485 (40 rows)
2487 -- On line
2488 SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s <@ l1.s;
2489                s               |                   s                   
2490 -------------------------------+---------------------------------------
2491  [(0,0),(6,6)]                 | {1,-1,0}
2492  [(-1000000,200),(300000,-40)] | {-0.000184615384615,-1,15.3846153846}
2493 (2 rows)
2495 -- On box
2496 SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s <@ b.f1;
2497  s | f1 
2498 ---+----
2499 (0 rows)
2502 -- Boxes
2504 SELECT box(f1) AS box FROM CIRCLE_TBL;
2505                               box                               
2506 ----------------------------------------------------------------
2507  (7.12132034356,3.12132034356),(2.87867965644,-1.12132034356)
2508  (71.7106781187,72.7106781187),(-69.7106781187,-68.7106781187)
2509  (4.53553390593,6.53553390593),(-2.53553390593,-0.535533905933)
2510  (3.12132034356,4.12132034356),(-1.12132034356,-0.12132034356)
2511  (107.071067812,207.071067812),(92.9289321881,192.928932188)
2512  (181.317279836,82.3172798365),(18.6827201635,-80.3172798365)
2513  (3,5),(3,5)
2514  (NaN,NaN),(NaN,NaN)
2515 (8 rows)
2517 -- translation
2518 SELECT b.f1 + p.f1 AS translation
2519    FROM BOX_TBL b, POINT_TBL p;
2520              translation             
2521 -------------------------------------
2522  (2,2),(0,0)
2523  (3,3),(1,1)
2524  (-2,2),(-8,-10)
2525  (2.5,3.5),(2.5,2.5)
2526  (3,3),(3,3)
2527  (-8,2),(-10,0)
2528  (-7,3),(-9,1)
2529  (-12,2),(-18,-10)
2530  (-7.5,3.5),(-7.5,2.5)
2531  (-7,3),(-7,3)
2532  (-1,6),(-3,4)
2533  (0,7),(-2,5)
2534  (-5,6),(-11,-6)
2535  (-0.5,7.5),(-0.5,6.5)
2536  (0,7),(0,7)
2537  (7.1,36.5),(5.1,34.5)
2538  (8.1,37.5),(6.1,35.5)
2539  (3.1,36.5),(-2.9,24.5)
2540  (7.6,38),(7.6,37)
2541  (8.1,37.5),(8.1,37.5)
2542  (-3,-10),(-5,-12)
2543  (-2,-9),(-4,-11)
2544  (-7,-10),(-13,-22)
2545  (-2.5,-8.5),(-2.5,-9.5)
2546  (-2,-9),(-2,-9)
2547  (2,2),(1e-300,-1e-300)
2548  (3,3),(1,1)
2549  (-2,2),(-8,-10)
2550  (2.5,3.5),(2.5,2.5)
2551  (3,3),(3,3)
2552  (1e+300,Infinity),(1e+300,Infinity)
2553  (1e+300,Infinity),(1e+300,Infinity)
2554  (1e+300,Infinity),(1e+300,Infinity)
2555  (1e+300,Infinity),(1e+300,Infinity)
2556  (1e+300,Infinity),(1e+300,Infinity)
2557  (Infinity,1e+300),(Infinity,1e+300)
2558  (Infinity,1e+300),(Infinity,1e+300)
2559  (Infinity,1e+300),(Infinity,1e+300)
2560  (Infinity,1e+300),(Infinity,1e+300)
2561  (Infinity,1e+300),(Infinity,1e+300)
2562  (NaN,NaN),(NaN,NaN)
2563  (NaN,NaN),(NaN,NaN)
2564  (NaN,NaN),(NaN,NaN)
2565  (NaN,NaN),(NaN,NaN)
2566  (NaN,NaN),(NaN,NaN)
2567  (12,12),(10,10)
2568  (13,13),(11,11)
2569  (8,12),(2,0)
2570  (12.5,13.5),(12.5,12.5)
2571  (13,13),(13,13)
2572 (50 rows)
2574 SELECT b.f1 - p.f1 AS translation
2575    FROM BOX_TBL b, POINT_TBL p;
2576                translation               
2577 -----------------------------------------
2578  (2,2),(0,0)
2579  (3,3),(1,1)
2580  (-2,2),(-8,-10)
2581  (2.5,3.5),(2.5,2.5)
2582  (3,3),(3,3)
2583  (12,2),(10,0)
2584  (13,3),(11,1)
2585  (8,2),(2,-10)
2586  (12.5,3.5),(12.5,2.5)
2587  (13,3),(13,3)
2588  (5,-2),(3,-4)
2589  (6,-1),(4,-3)
2590  (1,-2),(-5,-14)
2591  (5.5,-0.5),(5.5,-1.5)
2592  (6,-1),(6,-1)
2593  (-3.1,-32.5),(-5.1,-34.5)
2594  (-2.1,-31.5),(-4.1,-33.5)
2595  (-7.1,-32.5),(-13.1,-44.5)
2596  (-2.6,-31),(-2.6,-32)
2597  (-2.1,-31.5),(-2.1,-31.5)
2598  (7,14),(5,12)
2599  (8,15),(6,13)
2600  (3,14),(-3,2)
2601  (7.5,15.5),(7.5,14.5)
2602  (8,15),(8,15)
2603  (2,2),(-1e-300,1e-300)
2604  (3,3),(1,1)
2605  (-2,2),(-8,-10)
2606  (2.5,3.5),(2.5,2.5)
2607  (3,3),(3,3)
2608  (-1e+300,-Infinity),(-1e+300,-Infinity)
2609  (-1e+300,-Infinity),(-1e+300,-Infinity)
2610  (-1e+300,-Infinity),(-1e+300,-Infinity)
2611  (-1e+300,-Infinity),(-1e+300,-Infinity)
2612  (-1e+300,-Infinity),(-1e+300,-Infinity)
2613  (-Infinity,-1e+300),(-Infinity,-1e+300)
2614  (-Infinity,-1e+300),(-Infinity,-1e+300)
2615  (-Infinity,-1e+300),(-Infinity,-1e+300)
2616  (-Infinity,-1e+300),(-Infinity,-1e+300)
2617  (-Infinity,-1e+300),(-Infinity,-1e+300)
2618  (NaN,NaN),(NaN,NaN)
2619  (NaN,NaN),(NaN,NaN)
2620  (NaN,NaN),(NaN,NaN)
2621  (NaN,NaN),(NaN,NaN)
2622  (NaN,NaN),(NaN,NaN)
2623  (-8,-8),(-10,-10)
2624  (-7,-7),(-9,-9)
2625  (-12,-8),(-18,-20)
2626  (-7.5,-6.5),(-7.5,-7.5)
2627  (-7,-7),(-7,-7)
2628 (50 rows)
2630 -- Multiply with point
2631 SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
2632          f1          |     f1     |          ?column?           
2633 ---------------------+------------+-----------------------------
2634  (2,2),(0,0)         | (5.1,34.5) | (0,79.2),(-58.8,0)
2635  (2,2),(0,0)         | (10,10)    | (0,40),(0,0)
2636  (3,3),(1,1)         | (5.1,34.5) | (-29.4,118.8),(-88.2,39.6)
2637  (3,3),(1,1)         | (10,10)    | (0,60),(0,20)
2638  (-2,2),(-8,-10)     | (5.1,34.5) | (304.2,-58.8),(-79.2,-327)
2639  (-2,2),(-8,-10)     | (10,10)    | (20,0),(-40,-180)
2640  (2.5,3.5),(2.5,2.5) | (5.1,34.5) | (-73.5,104.1),(-108,99)
2641  (2.5,3.5),(2.5,2.5) | (10,10)    | (0,60),(-10,50)
2642  (3,3),(3,3)         | (5.1,34.5) | (-88.2,118.8),(-88.2,118.8)
2643  (3,3),(3,3)         | (10,10)    | (0,60),(0,60)
2644 (10 rows)
2646 -- Overflow error
2647 SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] > 1000;
2648          f1          |        f1         |                  ?column?                  
2649 ---------------------+-------------------+--------------------------------------------
2650  (2,2),(0,0)         | (1e+300,Infinity) | (NaN,NaN),(-Infinity,Infinity)
2651  (2,2),(0,0)         | (Infinity,1e+300) | (NaN,NaN),(Infinity,Infinity)
2652  (2,2),(0,0)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2653  (3,3),(1,1)         | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
2654  (3,3),(1,1)         | (Infinity,1e+300) | (Infinity,Infinity),(Infinity,Infinity)
2655  (3,3),(1,1)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2656  (-2,2),(-8,-10)     | (1e+300,Infinity) | (Infinity,-Infinity),(-Infinity,-Infinity)
2657  (-2,2),(-8,-10)     | (Infinity,1e+300) | (-Infinity,Infinity),(-Infinity,-Infinity)
2658  (-2,2),(-8,-10)     | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2659  (2.5,3.5),(2.5,2.5) | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
2660  (2.5,3.5),(2.5,2.5) | (Infinity,1e+300) | (Infinity,Infinity),(Infinity,Infinity)
2661  (2.5,3.5),(2.5,2.5) | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2662  (3,3),(3,3)         | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
2663  (3,3),(3,3)         | (Infinity,1e+300) | (Infinity,Infinity),(Infinity,Infinity)
2664  (3,3),(3,3)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
2665 (15 rows)
2667 -- Divide by point
2668 SELECT b.f1, p.f1, b.f1 / p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
2669          f1          |     f1     |                               ?column?                               
2670 ---------------------+------------+----------------------------------------------------------------------
2671  (2,2),(0,0)         | (5.1,34.5) | (0.0651176557644,0),(0,-0.0483449262493)
2672  (2,2),(0,0)         | (10,10)    | (0.2,0),(0,0)
2673  (3,3),(1,1)         | (5.1,34.5) | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374)
2674  (3,3),(1,1)         | (10,10)    | (0.3,0),(0.1,0)
2675  (-2,2),(-8,-10)     | (5.1,34.5) | (0.0483449262493,0.18499334024),(-0.317201914064,0.0651176557644)
2676  (-2,2),(-8,-10)     | (10,10)    | (0,0.2),(-0.9,-0.1)
2677  (2.5,3.5),(2.5,2.5) | (5.1,34.5) | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117)
2678  (2.5,3.5),(2.5,2.5) | (10,10)    | (0.3,0.05),(0.25,0)
2679  (3,3),(3,3)         | (5.1,34.5) | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374)
2680  (3,3),(3,3)         | (10,10)    | (0.3,0),(0.3,0)
2681 (10 rows)
2683 -- To box
2684 SELECT f1::box
2685         FROM POINT_TBL;
2686                  f1                  
2687 -------------------------------------
2688  (0,0),(0,0)
2689  (-10,0),(-10,0)
2690  (-3,4),(-3,4)
2691  (5.1,34.5),(5.1,34.5)
2692  (-5,-12),(-5,-12)
2693  (1e-300,-1e-300),(1e-300,-1e-300)
2694  (1e+300,Infinity),(1e+300,Infinity)
2695  (Infinity,1e+300),(Infinity,1e+300)
2696  (NaN,NaN),(NaN,NaN)
2697  (10,10),(10,10)
2698 (10 rows)
2700 SELECT bound_box(a.f1, b.f1)
2701         FROM BOX_TBL a, BOX_TBL b;
2702       bound_box      
2703 ---------------------
2704  (2,2),(0,0)
2705  (3,3),(0,0)
2706  (2,2),(-8,-10)
2707  (2.5,3.5),(0,0)
2708  (3,3),(0,0)
2709  (3,3),(0,0)
2710  (3,3),(1,1)
2711  (3,3),(-8,-10)
2712  (3,3.5),(1,1)
2713  (3,3),(1,1)
2714  (2,2),(-8,-10)
2715  (3,3),(-8,-10)
2716  (-2,2),(-8,-10)
2717  (2.5,3.5),(-8,-10)
2718  (3,3),(-8,-10)
2719  (2.5,3.5),(0,0)
2720  (3,3.5),(1,1)
2721  (2.5,3.5),(-8,-10)
2722  (2.5,3.5),(2.5,2.5)
2723  (3,3.5),(2.5,2.5)
2724  (3,3),(0,0)
2725  (3,3),(1,1)
2726  (3,3),(-8,-10)
2727  (3,3.5),(2.5,2.5)
2728  (3,3),(3,3)
2729 (25 rows)
2731 -- Below box
2732 SELECT b1.f1, b2.f1, b1.f1 <^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
2733          f1          |         f1          | ?column? 
2734 ---------------------+---------------------+----------
2735  (2,2),(0,0)         | (2,2),(0,0)         | f
2736  (2,2),(0,0)         | (3,3),(1,1)         | f
2737  (2,2),(0,0)         | (-2,2),(-8,-10)     | f
2738  (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | t
2739  (2,2),(0,0)         | (3,3),(3,3)         | t
2740  (3,3),(1,1)         | (2,2),(0,0)         | f
2741  (3,3),(1,1)         | (3,3),(1,1)         | f
2742  (3,3),(1,1)         | (-2,2),(-8,-10)     | f
2743  (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | f
2744  (3,3),(1,1)         | (3,3),(3,3)         | t
2745  (-2,2),(-8,-10)     | (2,2),(0,0)         | f
2746  (-2,2),(-8,-10)     | (3,3),(1,1)         | f
2747  (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | f
2748  (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | t
2749  (-2,2),(-8,-10)     | (3,3),(3,3)         | t
2750  (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | f
2751  (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | f
2752  (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | f
2753  (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | f
2754  (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | f
2755  (3,3),(3,3)         | (2,2),(0,0)         | f
2756  (3,3),(3,3)         | (3,3),(1,1)         | f
2757  (3,3),(3,3)         | (-2,2),(-8,-10)     | f
2758  (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | f
2759  (3,3),(3,3)         | (3,3),(3,3)         | t
2760 (25 rows)
2762 -- Above box
2763 SELECT b1.f1, b2.f1, b1.f1 >^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
2764          f1          |         f1          | ?column? 
2765 ---------------------+---------------------+----------
2766  (2,2),(0,0)         | (2,2),(0,0)         | f
2767  (2,2),(0,0)         | (3,3),(1,1)         | f
2768  (2,2),(0,0)         | (-2,2),(-8,-10)     | f
2769  (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | f
2770  (2,2),(0,0)         | (3,3),(3,3)         | f
2771  (3,3),(1,1)         | (2,2),(0,0)         | f
2772  (3,3),(1,1)         | (3,3),(1,1)         | f
2773  (3,3),(1,1)         | (-2,2),(-8,-10)     | f
2774  (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | f
2775  (3,3),(1,1)         | (3,3),(3,3)         | f
2776  (-2,2),(-8,-10)     | (2,2),(0,0)         | f
2777  (-2,2),(-8,-10)     | (3,3),(1,1)         | f
2778  (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | f
2779  (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | f
2780  (-2,2),(-8,-10)     | (3,3),(3,3)         | f
2781  (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | t
2782  (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | f
2783  (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | t
2784  (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | f
2785  (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | f
2786  (3,3),(3,3)         | (2,2),(0,0)         | t
2787  (3,3),(3,3)         | (3,3),(1,1)         | t
2788  (3,3),(3,3)         | (-2,2),(-8,-10)     | t
2789  (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | f
2790  (3,3),(3,3)         | (3,3),(3,3)         | t
2791 (25 rows)
2793 -- Intersection point with box
2794 SELECT b1.f1, b2.f1, b1.f1 # b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
2795          f1          |         f1          |      ?column?       
2796 ---------------------+---------------------+---------------------
2797  (2,2),(0,0)         | (2,2),(0,0)         | (2,2),(0,0)
2798  (2,2),(0,0)         | (3,3),(1,1)         | (2,2),(1,1)
2799  (2,2),(0,0)         | (-2,2),(-8,-10)     | 
2800  (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | 
2801  (2,2),(0,0)         | (3,3),(3,3)         | 
2802  (3,3),(1,1)         | (2,2),(0,0)         | (2,2),(1,1)
2803  (3,3),(1,1)         | (3,3),(1,1)         | (3,3),(1,1)
2804  (3,3),(1,1)         | (-2,2),(-8,-10)     | 
2805  (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | (2.5,3),(2.5,2.5)
2806  (3,3),(1,1)         | (3,3),(3,3)         | (3,3),(3,3)
2807  (-2,2),(-8,-10)     | (2,2),(0,0)         | 
2808  (-2,2),(-8,-10)     | (3,3),(1,1)         | 
2809  (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | (-2,2),(-8,-10)
2810  (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | 
2811  (-2,2),(-8,-10)     | (3,3),(3,3)         | 
2812  (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | 
2813  (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | (2.5,3),(2.5,2.5)
2814  (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | 
2815  (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
2816  (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | 
2817  (3,3),(3,3)         | (2,2),(0,0)         | 
2818  (3,3),(3,3)         | (3,3),(1,1)         | (3,3),(3,3)
2819  (3,3),(3,3)         | (-2,2),(-8,-10)     | 
2820  (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | 
2821  (3,3),(3,3)         | (3,3),(3,3)         | (3,3),(3,3)
2822 (25 rows)
2824 -- Diagonal
2825 SELECT f1, diagonal(f1) FROM BOX_TBL;
2826          f1          |       diagonal        
2827 ---------------------+-----------------------
2828  (2,2),(0,0)         | [(2,2),(0,0)]
2829  (3,3),(1,1)         | [(3,3),(1,1)]
2830  (-2,2),(-8,-10)     | [(-2,2),(-8,-10)]
2831  (2.5,3.5),(2.5,2.5) | [(2.5,3.5),(2.5,2.5)]
2832  (3,3),(3,3)         | [(3,3),(3,3)]
2833 (5 rows)
2835 -- Distance to box
2836 SELECT b1.f1, b2.f1, b1.f1 <-> b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
2837          f1          |         f1          |   ?column?    
2838 ---------------------+---------------------+---------------
2839  (2,2),(0,0)         | (2,2),(0,0)         |             0
2840  (2,2),(0,0)         | (3,3),(1,1)         | 1.41421356237
2841  (2,2),(0,0)         | (-2,2),(-8,-10)     | 7.81024967591
2842  (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) |           2.5
2843  (2,2),(0,0)         | (3,3),(3,3)         | 2.82842712475
2844  (3,3),(1,1)         | (2,2),(0,0)         | 1.41421356237
2845  (3,3),(1,1)         | (3,3),(1,1)         |             0
2846  (3,3),(1,1)         | (-2,2),(-8,-10)     | 9.21954445729
2847  (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | 1.11803398875
2848  (3,3),(1,1)         | (3,3),(3,3)         | 1.41421356237
2849  (-2,2),(-8,-10)     | (2,2),(0,0)         | 7.81024967591
2850  (-2,2),(-8,-10)     | (3,3),(1,1)         | 9.21954445729
2851  (-2,2),(-8,-10)     | (-2,2),(-8,-10)     |             0
2852  (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | 10.2591422643
2853  (-2,2),(-8,-10)     | (3,3),(3,3)         | 10.6301458127
2854  (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         |           2.5
2855  (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | 1.11803398875
2856  (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | 10.2591422643
2857  (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) |             0
2858  (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         |           0.5
2859  (3,3),(3,3)         | (2,2),(0,0)         | 2.82842712475
2860  (3,3),(3,3)         | (3,3),(1,1)         | 1.41421356237
2861  (3,3),(3,3)         | (-2,2),(-8,-10)     | 10.6301458127
2862  (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) |           0.5
2863  (3,3),(3,3)         | (3,3),(3,3)         |             0
2864 (25 rows)
2867 -- Paths
2869 -- Points
2870 SELECT f1, npoints(f1) FROM PATH_TBL;
2871             f1             | npoints 
2872 ---------------------------+---------
2873  [(1,2),(3,4)]             |       2
2874  ((1,2),(3,4))             |       2
2875  [(0,0),(3,0),(4,5),(1,6)] |       4
2876  ((1,2),(3,4))             |       2
2877  ((1,2),(3,4))             |       2
2878  [(1,2),(3,4)]             |       2
2879  ((10,20))                 |       1
2880  [(11,12),(13,14)]         |       2
2881  ((11,12),(13,14))         |       2
2882 (9 rows)
2884 -- Area
2885 SELECT f1, area(f1) FROM PATH_TBL;
2886             f1             | area 
2887 ---------------------------+------
2888  [(1,2),(3,4)]             |     
2889  ((1,2),(3,4))             |    0
2890  [(0,0),(3,0),(4,5),(1,6)] |     
2891  ((1,2),(3,4))             |    0
2892  ((1,2),(3,4))             |    0
2893  [(1,2),(3,4)]             |     
2894  ((10,20))                 |    0
2895  [(11,12),(13,14)]         |     
2896  ((11,12),(13,14))         |    0
2897 (9 rows)
2899 -- Length
2900 SELECT f1, @-@ f1 FROM PATH_TBL;
2901             f1             |   ?column?    
2902 ---------------------------+---------------
2903  [(1,2),(3,4)]             | 2.82842712475
2904  ((1,2),(3,4))             | 5.65685424949
2905  [(0,0),(3,0),(4,5),(1,6)] | 11.2612971738
2906  ((1,2),(3,4))             | 5.65685424949
2907  ((1,2),(3,4))             | 5.65685424949
2908  [(1,2),(3,4)]             | 2.82842712475
2909  ((10,20))                 |             0
2910  [(11,12),(13,14)]         | 2.82842712475
2911  ((11,12),(13,14))         | 5.65685424949
2912 (9 rows)
2914 -- To polygon
2915 SELECT f1, f1::polygon FROM PATH_TBL WHERE isclosed(f1);
2916         f1         |        f1         
2917 -------------------+-------------------
2918  ((1,2),(3,4))     | ((1,2),(3,4))
2919  ((1,2),(3,4))     | ((1,2),(3,4))
2920  ((1,2),(3,4))     | ((1,2),(3,4))
2921  ((10,20))         | ((10,20))
2922  ((11,12),(13,14)) | ((11,12),(13,14))
2923 (5 rows)
2925 -- Open path cannot be converted to polygon error
2926 SELECT f1, f1::polygon FROM PATH_TBL WHERE isopen(f1);
2927 ERROR:  open path cannot be converted to polygon
2928 -- Has points less than path
2929 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 < p2.f1;
2930         f1         |            f1             
2931 -------------------+---------------------------
2932  [(1,2),(3,4)]     | [(0,0),(3,0),(4,5),(1,6)]
2933  ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
2934  ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
2935  ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
2936  [(1,2),(3,4)]     | [(0,0),(3,0),(4,5),(1,6)]
2937  ((10,20))         | [(1,2),(3,4)]
2938  ((10,20))         | ((1,2),(3,4))
2939  ((10,20))         | [(0,0),(3,0),(4,5),(1,6)]
2940  ((10,20))         | ((1,2),(3,4))
2941  ((10,20))         | ((1,2),(3,4))
2942  ((10,20))         | [(1,2),(3,4)]
2943  ((10,20))         | [(11,12),(13,14)]
2944  ((10,20))         | ((11,12),(13,14))
2945  [(11,12),(13,14)] | [(0,0),(3,0),(4,5),(1,6)]
2946  ((11,12),(13,14)) | [(0,0),(3,0),(4,5),(1,6)]
2947 (15 rows)
2949 -- Has points less than or equal to path
2950 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 <= p2.f1;
2951             f1             |            f1             
2952 ---------------------------+---------------------------
2953  [(1,2),(3,4)]             | [(1,2),(3,4)]
2954  [(1,2),(3,4)]             | ((1,2),(3,4))
2955  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)]
2956  [(1,2),(3,4)]             | ((1,2),(3,4))
2957  [(1,2),(3,4)]             | ((1,2),(3,4))
2958  [(1,2),(3,4)]             | [(1,2),(3,4)]
2959  [(1,2),(3,4)]             | [(11,12),(13,14)]
2960  [(1,2),(3,4)]             | ((11,12),(13,14))
2961  ((1,2),(3,4))             | [(1,2),(3,4)]
2962  ((1,2),(3,4))             | ((1,2),(3,4))
2963  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)]
2964  ((1,2),(3,4))             | ((1,2),(3,4))
2965  ((1,2),(3,4))             | ((1,2),(3,4))
2966  ((1,2),(3,4))             | [(1,2),(3,4)]
2967  ((1,2),(3,4))             | [(11,12),(13,14)]
2968  ((1,2),(3,4))             | ((11,12),(13,14))
2969  [(0,0),(3,0),(4,5),(1,6)] | [(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))             | [(0,0),(3,0),(4,5),(1,6)]
2973  ((1,2),(3,4))             | ((1,2),(3,4))
2974  ((1,2),(3,4))             | ((1,2),(3,4))
2975  ((1,2),(3,4))             | [(1,2),(3,4)]
2976  ((1,2),(3,4))             | [(11,12),(13,14)]
2977  ((1,2),(3,4))             | ((11,12),(13,14))
2978  ((1,2),(3,4))             | [(1,2),(3,4)]
2979  ((1,2),(3,4))             | ((1,2),(3,4))
2980  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)]
2981  ((1,2),(3,4))             | ((1,2),(3,4))
2982  ((1,2),(3,4))             | ((1,2),(3,4))
2983  ((1,2),(3,4))             | [(1,2),(3,4)]
2984  ((1,2),(3,4))             | [(11,12),(13,14)]
2985  ((1,2),(3,4))             | ((11,12),(13,14))
2986  [(1,2),(3,4)]             | [(1,2),(3,4)]
2987  [(1,2),(3,4)]             | ((1,2),(3,4))
2988  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)]
2989  [(1,2),(3,4)]             | ((1,2),(3,4))
2990  [(1,2),(3,4)]             | ((1,2),(3,4))
2991  [(1,2),(3,4)]             | [(1,2),(3,4)]
2992  [(1,2),(3,4)]             | [(11,12),(13,14)]
2993  [(1,2),(3,4)]             | ((11,12),(13,14))
2994  ((10,20))                 | [(1,2),(3,4)]
2995  ((10,20))                 | ((1,2),(3,4))
2996  ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)]
2997  ((10,20))                 | ((1,2),(3,4))
2998  ((10,20))                 | ((1,2),(3,4))
2999  ((10,20))                 | [(1,2),(3,4)]
3000  ((10,20))                 | ((10,20))
3001  ((10,20))                 | [(11,12),(13,14)]
3002  ((10,20))                 | ((11,12),(13,14))
3003  [(11,12),(13,14)]         | [(1,2),(3,4)]
3004  [(11,12),(13,14)]         | ((1,2),(3,4))
3005  [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)]
3006  [(11,12),(13,14)]         | ((1,2),(3,4))
3007  [(11,12),(13,14)]         | ((1,2),(3,4))
3008  [(11,12),(13,14)]         | [(1,2),(3,4)]
3009  [(11,12),(13,14)]         | [(11,12),(13,14)]
3010  [(11,12),(13,14)]         | ((11,12),(13,14))
3011  ((11,12),(13,14))         | [(1,2),(3,4)]
3012  ((11,12),(13,14))         | ((1,2),(3,4))
3013  ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)]
3014  ((11,12),(13,14))         | ((1,2),(3,4))
3015  ((11,12),(13,14))         | ((1,2),(3,4))
3016  ((11,12),(13,14))         | [(1,2),(3,4)]
3017  ((11,12),(13,14))         | [(11,12),(13,14)]
3018  ((11,12),(13,14))         | ((11,12),(13,14))
3019 (66 rows)
3021 -- Has points equal to path
3022 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 = p2.f1;
3023             f1             |            f1             
3024 ---------------------------+---------------------------
3025  [(1,2),(3,4)]             | [(1,2),(3,4)]
3026  [(1,2),(3,4)]             | ((1,2),(3,4))
3027  [(1,2),(3,4)]             | ((1,2),(3,4))
3028  [(1,2),(3,4)]             | ((1,2),(3,4))
3029  [(1,2),(3,4)]             | [(1,2),(3,4)]
3030  [(1,2),(3,4)]             | [(11,12),(13,14)]
3031  [(1,2),(3,4)]             | ((11,12),(13,14))
3032  ((1,2),(3,4))             | [(1,2),(3,4)]
3033  ((1,2),(3,4))             | ((1,2),(3,4))
3034  ((1,2),(3,4))             | ((1,2),(3,4))
3035  ((1,2),(3,4))             | ((1,2),(3,4))
3036  ((1,2),(3,4))             | [(1,2),(3,4)]
3037  ((1,2),(3,4))             | [(11,12),(13,14)]
3038  ((1,2),(3,4))             | ((11,12),(13,14))
3039  [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
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))             | [(1,2),(3,4)]
3045  ((1,2),(3,4))             | [(11,12),(13,14)]
3046  ((1,2),(3,4))             | ((11,12),(13,14))
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))             | [(1,2),(3,4)]
3052  ((1,2),(3,4))             | [(11,12),(13,14)]
3053  ((1,2),(3,4))             | ((11,12),(13,14))
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  ((10,20))                 | ((10,20))
3062  [(11,12),(13,14)]         | [(1,2),(3,4)]
3063  [(11,12),(13,14)]         | ((1,2),(3,4))
3064  [(11,12),(13,14)]         | ((1,2),(3,4))
3065  [(11,12),(13,14)]         | ((1,2),(3,4))
3066  [(11,12),(13,14)]         | [(1,2),(3,4)]
3067  [(11,12),(13,14)]         | [(11,12),(13,14)]
3068  [(11,12),(13,14)]         | ((11,12),(13,14))
3069  ((11,12),(13,14))         | [(1,2),(3,4)]
3070  ((11,12),(13,14))         | ((1,2),(3,4))
3071  ((11,12),(13,14))         | ((1,2),(3,4))
3072  ((11,12),(13,14))         | ((1,2),(3,4))
3073  ((11,12),(13,14))         | [(1,2),(3,4)]
3074  ((11,12),(13,14))         | [(11,12),(13,14)]
3075  ((11,12),(13,14))         | ((11,12),(13,14))
3076 (51 rows)
3078 -- Has points greater than or equal to path
3079 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 >= p2.f1;
3080             f1             |            f1             
3081 ---------------------------+---------------------------
3082  [(1,2),(3,4)]             | [(1,2),(3,4)]
3083  [(1,2),(3,4)]             | ((1,2),(3,4))
3084  [(1,2),(3,4)]             | ((1,2),(3,4))
3085  [(1,2),(3,4)]             | ((1,2),(3,4))
3086  [(1,2),(3,4)]             | [(1,2),(3,4)]
3087  [(1,2),(3,4)]             | ((10,20))
3088  [(1,2),(3,4)]             | [(11,12),(13,14)]
3089  [(1,2),(3,4)]             | ((11,12),(13,14))
3090  ((1,2),(3,4))             | [(1,2),(3,4)]
3091  ((1,2),(3,4))             | ((1,2),(3,4))
3092  ((1,2),(3,4))             | ((1,2),(3,4))
3093  ((1,2),(3,4))             | ((1,2),(3,4))
3094  ((1,2),(3,4))             | [(1,2),(3,4)]
3095  ((1,2),(3,4))             | ((10,20))
3096  ((1,2),(3,4))             | [(11,12),(13,14)]
3097  ((1,2),(3,4))             | ((11,12),(13,14))
3098  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
3099  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3100  [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
3101  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3102  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3103  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
3104  [(0,0),(3,0),(4,5),(1,6)] | ((10,20))
3105  [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]
3106  [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))
3107  ((1,2),(3,4))             | [(1,2),(3,4)]
3108  ((1,2),(3,4))             | ((1,2),(3,4))
3109  ((1,2),(3,4))             | ((1,2),(3,4))
3110  ((1,2),(3,4))             | ((1,2),(3,4))
3111  ((1,2),(3,4))             | [(1,2),(3,4)]
3112  ((1,2),(3,4))             | ((10,20))
3113  ((1,2),(3,4))             | [(11,12),(13,14)]
3114  ((1,2),(3,4))             | ((11,12),(13,14))
3115  ((1,2),(3,4))             | [(1,2),(3,4)]
3116  ((1,2),(3,4))             | ((1,2),(3,4))
3117  ((1,2),(3,4))             | ((1,2),(3,4))
3118  ((1,2),(3,4))             | ((1,2),(3,4))
3119  ((1,2),(3,4))             | [(1,2),(3,4)]
3120  ((1,2),(3,4))             | ((10,20))
3121  ((1,2),(3,4))             | [(11,12),(13,14)]
3122  ((1,2),(3,4))             | ((11,12),(13,14))
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)]             | ((1,2),(3,4))
3127  [(1,2),(3,4)]             | [(1,2),(3,4)]
3128  [(1,2),(3,4)]             | ((10,20))
3129  [(1,2),(3,4)]             | [(11,12),(13,14)]
3130  [(1,2),(3,4)]             | ((11,12),(13,14))
3131  ((10,20))                 | ((10,20))
3132  [(11,12),(13,14)]         | [(1,2),(3,4)]
3133  [(11,12),(13,14)]         | ((1,2),(3,4))
3134  [(11,12),(13,14)]         | ((1,2),(3,4))
3135  [(11,12),(13,14)]         | ((1,2),(3,4))
3136  [(11,12),(13,14)]         | [(1,2),(3,4)]
3137  [(11,12),(13,14)]         | ((10,20))
3138  [(11,12),(13,14)]         | [(11,12),(13,14)]
3139  [(11,12),(13,14)]         | ((11,12),(13,14))
3140  ((11,12),(13,14))         | [(1,2),(3,4)]
3141  ((11,12),(13,14))         | ((1,2),(3,4))
3142  ((11,12),(13,14))         | ((1,2),(3,4))
3143  ((11,12),(13,14))         | ((1,2),(3,4))
3144  ((11,12),(13,14))         | [(1,2),(3,4)]
3145  ((11,12),(13,14))         | ((10,20))
3146  ((11,12),(13,14))         | [(11,12),(13,14)]
3147  ((11,12),(13,14))         | ((11,12),(13,14))
3148 (66 rows)
3150 -- Has points greater than path
3151 SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 > p2.f1;
3152             f1             |        f1         
3153 ---------------------------+-------------------
3154  [(1,2),(3,4)]             | ((10,20))
3155  ((1,2),(3,4))             | ((10,20))
3156  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
3157  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3158  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3159  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
3160  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
3161  [(0,0),(3,0),(4,5),(1,6)] | ((10,20))
3162  [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]
3163  [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))
3164  ((1,2),(3,4))             | ((10,20))
3165  ((1,2),(3,4))             | ((10,20))
3166  [(1,2),(3,4)]             | ((10,20))
3167  [(11,12),(13,14)]         | ((10,20))
3168  ((11,12),(13,14))         | ((10,20))
3169 (15 rows)
3171 -- Add path
3172 SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM PATH_TBL p1, PATH_TBL p2;
3173             f1             |            f1             |                     ?column?                      
3174 ---------------------------+---------------------------+---------------------------------------------------
3175  [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
3176  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3177  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4),(0,0),(3,0),(4,5),(1,6)]
3178  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3179  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3180  [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
3181  [(1,2),(3,4)]             | ((10,20))                 | 
3182  [(1,2),(3,4)]             | [(11,12),(13,14)]         | [(1,2),(3,4),(11,12),(13,14)]
3183  [(1,2),(3,4)]             | ((11,12),(13,14))         | 
3184  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3185  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3186  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
3187  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3188  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3189  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3190  ((1,2),(3,4))             | ((10,20))                 | 
3191  ((1,2),(3,4))             | [(11,12),(13,14)]         | 
3192  ((1,2),(3,4))             | ((11,12),(13,14))         | 
3193  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6),(1,2),(3,4)]
3194  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
3195  [(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)]
3196  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
3197  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
3198  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6),(1,2),(3,4)]
3199  [(0,0),(3,0),(4,5),(1,6)] | ((10,20))                 | 
3200  [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6),(11,12),(13,14)]
3201  [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))         | 
3202  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3203  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3204  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
3205  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3206  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3207  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3208  ((1,2),(3,4))             | ((10,20))                 | 
3209  ((1,2),(3,4))             | [(11,12),(13,14)]         | 
3210  ((1,2),(3,4))             | ((11,12),(13,14))         | 
3211  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3212  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3213  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
3214  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3215  ((1,2),(3,4))             | ((1,2),(3,4))             | 
3216  ((1,2),(3,4))             | [(1,2),(3,4)]             | 
3217  ((1,2),(3,4))             | ((10,20))                 | 
3218  ((1,2),(3,4))             | [(11,12),(13,14)]         | 
3219  ((1,2),(3,4))             | ((11,12),(13,14))         | 
3220  [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
3221  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3222  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4),(0,0),(3,0),(4,5),(1,6)]
3223  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3224  [(1,2),(3,4)]             | ((1,2),(3,4))             | 
3225  [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
3226  [(1,2),(3,4)]             | ((10,20))                 | 
3227  [(1,2),(3,4)]             | [(11,12),(13,14)]         | [(1,2),(3,4),(11,12),(13,14)]
3228  [(1,2),(3,4)]             | ((11,12),(13,14))         | 
3229  ((10,20))                 | [(1,2),(3,4)]             | 
3230  ((10,20))                 | ((1,2),(3,4))             | 
3231  ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)] | 
3232  ((10,20))                 | ((1,2),(3,4))             | 
3233  ((10,20))                 | ((1,2),(3,4))             | 
3234  ((10,20))                 | [(1,2),(3,4)]             | 
3235  ((10,20))                 | ((10,20))                 | 
3236  ((10,20))                 | [(11,12),(13,14)]         | 
3237  ((10,20))                 | ((11,12),(13,14))         | 
3238  [(11,12),(13,14)]         | [(1,2),(3,4)]             | [(11,12),(13,14),(1,2),(3,4)]
3239  [(11,12),(13,14)]         | ((1,2),(3,4))             | 
3240  [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14),(0,0),(3,0),(4,5),(1,6)]
3241  [(11,12),(13,14)]         | ((1,2),(3,4))             | 
3242  [(11,12),(13,14)]         | ((1,2),(3,4))             | 
3243  [(11,12),(13,14)]         | [(1,2),(3,4)]             | [(11,12),(13,14),(1,2),(3,4)]
3244  [(11,12),(13,14)]         | ((10,20))                 | 
3245  [(11,12),(13,14)]         | [(11,12),(13,14)]         | [(11,12),(13,14),(11,12),(13,14)]
3246  [(11,12),(13,14)]         | ((11,12),(13,14))         | 
3247  ((11,12),(13,14))         | [(1,2),(3,4)]             | 
3248  ((11,12),(13,14))         | ((1,2),(3,4))             | 
3249  ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)] | 
3250  ((11,12),(13,14))         | ((1,2),(3,4))             | 
3251  ((11,12),(13,14))         | ((1,2),(3,4))             | 
3252  ((11,12),(13,14))         | [(1,2),(3,4)]             | 
3253  ((11,12),(13,14))         | ((10,20))                 | 
3254  ((11,12),(13,14))         | [(11,12),(13,14)]         | 
3255  ((11,12),(13,14))         | ((11,12),(13,14))         | 
3256 (81 rows)
3258 -- Add point
3259 SELECT p.f1, p1.f1, p.f1 + p1.f1 FROM PATH_TBL p, POINT_TBL p1;
3260             f1             |        f1         |                                 ?column?                                  
3261 ---------------------------+-------------------+---------------------------------------------------------------------------
3262  [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
3263  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3264  [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(3,0),(4,5),(1,6)]
3265  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3266  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3267  [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
3268  ((10,20))                 | (0,0)             | ((10,20))
3269  [(11,12),(13,14)]         | (0,0)             | [(11,12),(13,14)]
3270  ((11,12),(13,14))         | (0,0)             | ((11,12),(13,14))
3271  [(1,2),(3,4)]             | (-10,0)           | [(-9,2),(-7,4)]
3272  ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
3273  [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(-10,0),(-7,0),(-6,5),(-9,6)]
3274  ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
3275  ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
3276  [(1,2),(3,4)]             | (-10,0)           | [(-9,2),(-7,4)]
3277  ((10,20))                 | (-10,0)           | ((0,20))
3278  [(11,12),(13,14)]         | (-10,0)           | [(1,12),(3,14)]
3279  ((11,12),(13,14))         | (-10,0)           | ((1,12),(3,14))
3280  [(1,2),(3,4)]             | (-3,4)            | [(-2,6),(0,8)]
3281  ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
3282  [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(-3,4),(0,4),(1,9),(-2,10)]
3283  ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
3284  ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
3285  [(1,2),(3,4)]             | (-3,4)            | [(-2,6),(0,8)]
3286  ((10,20))                 | (-3,4)            | ((7,24))
3287  [(11,12),(13,14)]         | (-3,4)            | [(8,16),(10,18)]
3288  ((11,12),(13,14))         | (-3,4)            | ((8,16),(10,18))
3289  [(1,2),(3,4)]             | (5.1,34.5)        | [(6.1,36.5),(8.1,38.5)]
3290  ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
3291  [(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)]
3292  ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
3293  ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
3294  [(1,2),(3,4)]             | (5.1,34.5)        | [(6.1,36.5),(8.1,38.5)]
3295  ((10,20))                 | (5.1,34.5)        | ((15.1,54.5))
3296  [(11,12),(13,14)]         | (5.1,34.5)        | [(16.1,46.5),(18.1,48.5)]
3297  ((11,12),(13,14))         | (5.1,34.5)        | ((16.1,46.5),(18.1,48.5))
3298  [(1,2),(3,4)]             | (-5,-12)          | [(-4,-10),(-2,-8)]
3299  ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
3300  [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(-5,-12),(-2,-12),(-1,-7),(-4,-6)]
3301  ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
3302  ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
3303  [(1,2),(3,4)]             | (-5,-12)          | [(-4,-10),(-2,-8)]
3304  ((10,20))                 | (-5,-12)          | ((5,8))
3305  [(11,12),(13,14)]         | (-5,-12)          | [(6,0),(8,2)]
3306  ((11,12),(13,14))         | (-5,-12)          | ((6,0),(8,2))
3307  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
3308  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3309  [(0,0),(3,0),(4,5),(1,6)] | (1e-300,-1e-300)  | [(1e-300,-1e-300),(3,-1e-300),(4,5),(1,6)]
3310  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3311  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3312  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
3313  ((10,20))                 | (1e-300,-1e-300)  | ((10,20))
3314  [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(11,12),(13,14)]
3315  ((11,12),(13,14))         | (1e-300,-1e-300)  | ((11,12),(13,14))
3316  [(1,2),(3,4)]             | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
3317  ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
3318  [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity),(1e+300,Infinity),(1e+300,Infinity)]
3319  ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
3320  ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
3321  [(1,2),(3,4)]             | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
3322  ((10,20))                 | (1e+300,Infinity) | ((1e+300,Infinity))
3323  [(11,12),(13,14)]         | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
3324  ((11,12),(13,14))         | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
3325  [(1,2),(3,4)]             | (Infinity,1e+300) | [(Infinity,1e+300),(Infinity,1e+300)]
3326  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,1e+300),(Infinity,1e+300))
3327  [(0,0),(3,0),(4,5),(1,6)] | (Infinity,1e+300) | [(Infinity,1e+300),(Infinity,1e+300),(Infinity,1e+300),(Infinity,1e+300)]
3328  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,1e+300),(Infinity,1e+300))
3329  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,1e+300),(Infinity,1e+300))
3330  [(1,2),(3,4)]             | (Infinity,1e+300) | [(Infinity,1e+300),(Infinity,1e+300)]
3331  ((10,20))                 | (Infinity,1e+300) | ((Infinity,1e+300))
3332  [(11,12),(13,14)]         | (Infinity,1e+300) | [(Infinity,1e+300),(Infinity,1e+300)]
3333  ((11,12),(13,14))         | (Infinity,1e+300) | ((Infinity,1e+300),(Infinity,1e+300))
3334  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3335  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3336  [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
3337  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3338  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3339  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3340  ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
3341  [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3342  ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3343  [(1,2),(3,4)]             | (10,10)           | [(11,12),(13,14)]
3344  ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
3345  [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(10,10),(13,10),(14,15),(11,16)]
3346  ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
3347  ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
3348  [(1,2),(3,4)]             | (10,10)           | [(11,12),(13,14)]
3349  ((10,20))                 | (10,10)           | ((20,30))
3350  [(11,12),(13,14)]         | (10,10)           | [(21,22),(23,24)]
3351  ((11,12),(13,14))         | (10,10)           | ((21,22),(23,24))
3352 (90 rows)
3354 -- Subtract point
3355 SELECT p.f1, p1.f1, p.f1 - p1.f1 FROM PATH_TBL p, POINT_TBL p1;
3356             f1             |        f1         |                                     ?column?                                      
3357 ---------------------------+-------------------+-----------------------------------------------------------------------------------
3358  [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
3359  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3360  [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(3,0),(4,5),(1,6)]
3361  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3362  ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
3363  [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
3364  ((10,20))                 | (0,0)             | ((10,20))
3365  [(11,12),(13,14)]         | (0,0)             | [(11,12),(13,14)]
3366  ((11,12),(13,14))         | (0,0)             | ((11,12),(13,14))
3367  [(1,2),(3,4)]             | (-10,0)           | [(11,2),(13,4)]
3368  ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
3369  [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(10,0),(13,0),(14,5),(11,6)]
3370  ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
3371  ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
3372  [(1,2),(3,4)]             | (-10,0)           | [(11,2),(13,4)]
3373  ((10,20))                 | (-10,0)           | ((20,20))
3374  [(11,12),(13,14)]         | (-10,0)           | [(21,12),(23,14)]
3375  ((11,12),(13,14))         | (-10,0)           | ((21,12),(23,14))
3376  [(1,2),(3,4)]             | (-3,4)            | [(4,-2),(6,0)]
3377  ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
3378  [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(3,-4),(6,-4),(7,1),(4,2)]
3379  ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
3380  ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
3381  [(1,2),(3,4)]             | (-3,4)            | [(4,-2),(6,0)]
3382  ((10,20))                 | (-3,4)            | ((13,16))
3383  [(11,12),(13,14)]         | (-3,4)            | [(14,8),(16,10)]
3384  ((11,12),(13,14))         | (-3,4)            | ((14,8),(16,10))
3385  [(1,2),(3,4)]             | (5.1,34.5)        | [(-4.1,-32.5),(-2.1,-30.5)]
3386  ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
3387  [(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)]
3388  ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
3389  ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
3390  [(1,2),(3,4)]             | (5.1,34.5)        | [(-4.1,-32.5),(-2.1,-30.5)]
3391  ((10,20))                 | (5.1,34.5)        | ((4.9,-14.5))
3392  [(11,12),(13,14)]         | (5.1,34.5)        | [(5.9,-22.5),(7.9,-20.5)]
3393  ((11,12),(13,14))         | (5.1,34.5)        | ((5.9,-22.5),(7.9,-20.5))
3394  [(1,2),(3,4)]             | (-5,-12)          | [(6,14),(8,16)]
3395  ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
3396  [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(5,12),(8,12),(9,17),(6,18)]
3397  ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
3398  ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
3399  [(1,2),(3,4)]             | (-5,-12)          | [(6,14),(8,16)]
3400  ((10,20))                 | (-5,-12)          | ((15,32))
3401  [(11,12),(13,14)]         | (-5,-12)          | [(16,24),(18,26)]
3402  ((11,12),(13,14))         | (-5,-12)          | ((16,24),(18,26))
3403  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
3404  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3405  [(0,0),(3,0),(4,5),(1,6)] | (1e-300,-1e-300)  | [(-1e-300,1e-300),(3,1e-300),(4,5),(1,6)]
3406  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3407  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
3408  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
3409  ((10,20))                 | (1e-300,-1e-300)  | ((10,20))
3410  [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(11,12),(13,14)]
3411  ((11,12),(13,14))         | (1e-300,-1e-300)  | ((11,12),(13,14))
3412  [(1,2),(3,4)]             | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
3413  ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
3414  [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity),(-1e+300,-Infinity),(-1e+300,-Infinity)]
3415  ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
3416  ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
3417  [(1,2),(3,4)]             | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
3418  ((10,20))                 | (1e+300,Infinity) | ((-1e+300,-Infinity))
3419  [(11,12),(13,14)]         | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
3420  ((11,12),(13,14))         | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
3421  [(1,2),(3,4)]             | (Infinity,1e+300) | [(-Infinity,-1e+300),(-Infinity,-1e+300)]
3422  ((1,2),(3,4))             | (Infinity,1e+300) | ((-Infinity,-1e+300),(-Infinity,-1e+300))
3423  [(0,0),(3,0),(4,5),(1,6)] | (Infinity,1e+300) | [(-Infinity,-1e+300),(-Infinity,-1e+300),(-Infinity,-1e+300),(-Infinity,-1e+300)]
3424  ((1,2),(3,4))             | (Infinity,1e+300) | ((-Infinity,-1e+300),(-Infinity,-1e+300))
3425  ((1,2),(3,4))             | (Infinity,1e+300) | ((-Infinity,-1e+300),(-Infinity,-1e+300))
3426  [(1,2),(3,4)]             | (Infinity,1e+300) | [(-Infinity,-1e+300),(-Infinity,-1e+300)]
3427  ((10,20))                 | (Infinity,1e+300) | ((-Infinity,-1e+300))
3428  [(11,12),(13,14)]         | (Infinity,1e+300) | [(-Infinity,-1e+300),(-Infinity,-1e+300)]
3429  ((11,12),(13,14))         | (Infinity,1e+300) | ((-Infinity,-1e+300),(-Infinity,-1e+300))
3430  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3431  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3432  [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
3433  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3434  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3435  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3436  ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
3437  [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3438  ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3439  [(1,2),(3,4)]             | (10,10)           | [(-9,-8),(-7,-6)]
3440  ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
3441  [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(-10,-10),(-7,-10),(-6,-5),(-9,-4)]
3442  ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
3443  ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
3444  [(1,2),(3,4)]             | (10,10)           | [(-9,-8),(-7,-6)]
3445  ((10,20))                 | (10,10)           | ((0,10))
3446  [(11,12),(13,14)]         | (10,10)           | [(1,2),(3,4)]
3447  ((11,12),(13,14))         | (10,10)           | ((1,2),(3,4))
3448 (90 rows)
3450 -- Multiply with point
3451 SELECT p.f1, p1.f1, p.f1 * p1.f1 FROM PATH_TBL p, POINT_TBL p1;
3452             f1             |        f1         |                               ?column?                               
3453 ---------------------------+-------------------+----------------------------------------------------------------------
3454  [(1,2),(3,4)]             | (0,0)             | [(0,0),(0,0)]
3455  ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
3456  [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(0,0),(0,0),(0,0)]
3457  ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
3458  ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
3459  [(1,2),(3,4)]             | (0,0)             | [(0,0),(0,0)]
3460  ((10,20))                 | (0,0)             | ((0,0))
3461  [(11,12),(13,14)]         | (0,0)             | [(0,0),(0,0)]
3462  ((11,12),(13,14))         | (0,0)             | ((0,0),(0,0))
3463  [(1,2),(3,4)]             | (-10,0)           | [(-10,-20),(-30,-40)]
3464  ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
3465  [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(-0,0),(-30,0),(-40,-50),(-10,-60)]
3466  ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
3467  ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
3468  [(1,2),(3,4)]             | (-10,0)           | [(-10,-20),(-30,-40)]
3469  ((10,20))                 | (-10,0)           | ((-100,-200))
3470  [(11,12),(13,14)]         | (-10,0)           | [(-110,-120),(-130,-140)]
3471  ((11,12),(13,14))         | (-10,0)           | ((-110,-120),(-130,-140))
3472  [(1,2),(3,4)]             | (-3,4)            | [(-11,-2),(-25,0)]
3473  ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
3474  [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(-0,0),(-9,12),(-32,1),(-27,-14)]
3475  ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
3476  ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
3477  [(1,2),(3,4)]             | (-3,4)            | [(-11,-2),(-25,0)]
3478  ((10,20))                 | (-3,4)            | ((-110,-20))
3479  [(11,12),(13,14)]         | (-3,4)            | [(-81,8),(-95,10)]
3480  ((11,12),(13,14))         | (-3,4)            | ((-81,8),(-95,10))
3481  [(1,2),(3,4)]             | (5.1,34.5)        | [(-63.9,44.7),(-122.7,123.9)]
3482  ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
3483  [(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)]
3484  ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
3485  ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
3486  [(1,2),(3,4)]             | (5.1,34.5)        | [(-63.9,44.7),(-122.7,123.9)]
3487  ((10,20))                 | (5.1,34.5)        | ((-639,447))
3488  [(11,12),(13,14)]         | (5.1,34.5)        | [(-357.9,440.7),(-416.7,519.9)]
3489  ((11,12),(13,14))         | (5.1,34.5)        | ((-357.9,440.7),(-416.7,519.9))
3490  [(1,2),(3,4)]             | (-5,-12)          | [(19,-22),(33,-56)]
3491  ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
3492  [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(0,-0),(-15,-36),(40,-73),(67,-42)]
3493  ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
3494  ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
3495  [(1,2),(3,4)]             | (-5,-12)          | [(19,-22),(33,-56)]
3496  ((10,20))                 | (-5,-12)          | ((190,-220))
3497  [(11,12),(13,14)]         | (-5,-12)          | [(89,-192),(103,-226)]
3498  ((11,12),(13,14))         | (-5,-12)          | ((89,-192),(103,-226))
3499  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(3e-300,1e-300),(7e-300,1e-300)]
3500  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
3501  [(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)]
3502  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
3503  ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
3504  [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(3e-300,1e-300),(7e-300,1e-300)]
3505  ((10,20))                 | (1e-300,-1e-300)  | ((3e-299,1e-299))
3506  [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(2.3e-299,1e-300),(2.7e-299,1e-300)]
3507  ((11,12),(13,14))         | (1e-300,-1e-300)  | ((2.3e-299,1e-300),(2.7e-299,1e-300))
3508  [(1,2),(3,4)]             | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
3509  ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
3510  [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(NaN,NaN),(NaN,Infinity),(-Infinity,Infinity),(-Infinity,Infinity)]
3511  ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
3512  ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
3513  [(1,2),(3,4)]             | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
3514  ((10,20))                 | (1e+300,Infinity) | ((-Infinity,Infinity))
3515  [(11,12),(13,14)]         | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
3516  ((11,12),(13,14))         | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
3517  [(1,2),(3,4)]             | (Infinity,1e+300) | [(Infinity,Infinity),(Infinity,Infinity)]
3518  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,Infinity),(Infinity,Infinity))
3519  [(0,0),(3,0),(4,5),(1,6)] | (Infinity,1e+300) | [(NaN,NaN),(Infinity,NaN),(Infinity,Infinity),(Infinity,Infinity)]
3520  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,Infinity),(Infinity,Infinity))
3521  ((1,2),(3,4))             | (Infinity,1e+300) | ((Infinity,Infinity),(Infinity,Infinity))
3522  [(1,2),(3,4)]             | (Infinity,1e+300) | [(Infinity,Infinity),(Infinity,Infinity)]
3523  ((10,20))                 | (Infinity,1e+300) | ((Infinity,Infinity))
3524  [(11,12),(13,14)]         | (Infinity,1e+300) | [(Infinity,Infinity),(Infinity,Infinity)]
3525  ((11,12),(13,14))         | (Infinity,1e+300) | ((Infinity,Infinity),(Infinity,Infinity))
3526  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3527  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3528  [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
3529  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3530  ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3531  [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3532  ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
3533  [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
3534  ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
3535  [(1,2),(3,4)]             | (10,10)           | [(-10,30),(-10,70)]
3536  ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
3537  [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(0,0),(30,30),(-10,90),(-50,70)]
3538  ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
3539  ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
3540  [(1,2),(3,4)]             | (10,10)           | [(-10,30),(-10,70)]
3541  ((10,20))                 | (10,10)           | ((-100,300))
3542  [(11,12),(13,14)]         | (10,10)           | [(-10,230),(-10,270)]
3543  ((11,12),(13,14))         | (10,10)           | ((-10,230),(-10,270))
3544 (90 rows)
3546 -- Divide by point
3547 SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1[0] BETWEEN 1 AND 1000;
3548             f1             |     f1     |                                                    ?column?                                                     
3549 ---------------------------+------------+-----------------------------------------------------------------------------------------------------------------
3550  [(1,2),(3,4)]             | (5.1,34.5) | [(0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952)]
3551  [(1,2),(3,4)]             | (10,10)    | [(0.15,0.05),(0.35,0.05)]
3552  ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
3553  ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
3554  [(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)]
3555  [(0,0),(3,0),(4,5),(1,6)] | (10,10)    | [(0,0),(0.15,-0.15),(0.45,0.05),(0.35,0.25)]
3556  ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
3557  ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
3558  ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
3559  ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
3560  [(1,2),(3,4)]             | (5.1,34.5) | [(0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952)]
3561  [(1,2),(3,4)]             | (10,10)    | [(0.15,0.05),(0.35,0.05)]
3562  ((10,20))                 | (5.1,34.5) | ((0.609244733856,-0.199792807459))
3563  ((10,20))                 | (10,10)    | ((1.5,0.5))
3564  [(11,12),(13,14)]         | (5.1,34.5) | [(0.386512752208,-0.261703911993),(0.451630407972,-0.310048838242)]
3565  [(11,12),(13,14)]         | (10,10)    | [(1.15,0.05),(1.35,0.05)]
3566  ((11,12),(13,14))         | (5.1,34.5) | ((0.386512752208,-0.261703911993),(0.451630407972,-0.310048838242))
3567  ((11,12),(13,14))         | (10,10)    | ((1.15,0.05),(1.35,0.05))
3568 (18 rows)
3570 -- Division by 0 error
3571 SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1 ~= '(0,0)'::point;
3572 ERROR:  division by zero
3573 -- Distance to path
3574 SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM PATH_TBL p1, PATH_TBL p2;
3575             f1             |            f1             |    ?column?    
3576 ---------------------------+---------------------------+----------------
3577  [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
3578  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3579  [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3580  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3581  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3582  [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
3583  [(1,2),(3,4)]             | ((10,20))                 |  17.4642491966
3584  [(1,2),(3,4)]             | [(11,12),(13,14)]         |   11.313708499
3585  [(1,2),(3,4)]             | ((11,12),(13,14))         |   11.313708499
3586  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3587  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3588  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3589  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3590  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3591  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3592  ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
3593  ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
3594  ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
3595  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | 0.784464540553
3596  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
3597  [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)] |              0
3598  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
3599  [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
3600  [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | 0.784464540553
3601  [(0,0),(3,0),(4,5),(1,6)] | ((10,20))                 |  16.1554944214
3602  [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]         |  9.89949493661
3603  [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))         |  9.89949493661
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))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3607  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3608  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3609  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3610  ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
3611  ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
3612  ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
3613  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3614  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3615  ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3616  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3617  ((1,2),(3,4))             | ((1,2),(3,4))             |              0
3618  ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
3619  ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
3620  ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
3621  ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
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)]             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
3625  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3626  [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
3627  [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
3628  [(1,2),(3,4)]             | ((10,20))                 |  17.4642491966
3629  [(1,2),(3,4)]             | [(11,12),(13,14)]         |   11.313708499
3630  [(1,2),(3,4)]             | ((11,12),(13,14))         |   11.313708499
3631  ((10,20))                 | [(1,2),(3,4)]             |  17.4642491966
3632  ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
3633  ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)] |  16.1554944214
3634  ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
3635  ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
3636  ((10,20))                 | [(1,2),(3,4)]             |  17.4642491966
3637  ((10,20))                 | ((10,20))                 |              0
3638  ((10,20))                 | [(11,12),(13,14)]         |   6.7082039325
3639  ((10,20))                 | ((11,12),(13,14))         |   6.7082039325
3640  [(11,12),(13,14)]         | [(1,2),(3,4)]             |   11.313708499
3641  [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
3642  [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)] |  9.89949493661
3643  [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
3644  [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
3645  [(11,12),(13,14)]         | [(1,2),(3,4)]             |   11.313708499
3646  [(11,12),(13,14)]         | ((10,20))                 |   6.7082039325
3647  [(11,12),(13,14)]         | [(11,12),(13,14)]         |              0
3648  [(11,12),(13,14)]         | ((11,12),(13,14))         |              0
3649  ((11,12),(13,14))         | [(1,2),(3,4)]             |   11.313708499
3650  ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
3651  ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)] |  9.89949493661
3652  ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
3653  ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
3654  ((11,12),(13,14))         | [(1,2),(3,4)]             |   11.313708499
3655  ((11,12),(13,14))         | ((10,20))                 |   6.7082039325
3656  ((11,12),(13,14))         | [(11,12),(13,14)]         |              0
3657  ((11,12),(13,14))         | ((11,12),(13,14))         |              0
3658 (81 rows)
3661 -- Polygons
3663 -- containment
3664 SELECT p.f1, poly.f1, poly.f1 @> p.f1 AS contains
3665    FROM POLYGON_TBL poly, POINT_TBL p;
3666         f1         |             f1             | contains 
3667 -------------------+----------------------------+----------
3668  (0,0)             | ((2,0),(2,4),(0,0))        | t
3669  (0,0)             | ((3,1),(3,3),(1,0))        | f
3670  (0,0)             | ((1,2),(3,4),(5,6),(7,8))  | f
3671  (0,0)             | ((7,8),(5,6),(3,4),(1,2))  | f
3672  (0,0)             | ((1,2),(7,8),(5,6),(3,-4)) | f
3673  (0,0)             | ((0,0))                    | t
3674  (0,0)             | ((0,1),(0,1))              | f
3675  (-10,0)           | ((2,0),(2,4),(0,0))        | f
3676  (-10,0)           | ((3,1),(3,3),(1,0))        | f
3677  (-10,0)           | ((1,2),(3,4),(5,6),(7,8))  | f
3678  (-10,0)           | ((7,8),(5,6),(3,4),(1,2))  | f
3679  (-10,0)           | ((1,2),(7,8),(5,6),(3,-4)) | f
3680  (-10,0)           | ((0,0))                    | f
3681  (-10,0)           | ((0,1),(0,1))              | f
3682  (-3,4)            | ((2,0),(2,4),(0,0))        | f
3683  (-3,4)            | ((3,1),(3,3),(1,0))        | f
3684  (-3,4)            | ((1,2),(3,4),(5,6),(7,8))  | f
3685  (-3,4)            | ((7,8),(5,6),(3,4),(1,2))  | f
3686  (-3,4)            | ((1,2),(7,8),(5,6),(3,-4)) | f
3687  (-3,4)            | ((0,0))                    | f
3688  (-3,4)            | ((0,1),(0,1))              | f
3689  (5.1,34.5)        | ((2,0),(2,4),(0,0))        | f
3690  (5.1,34.5)        | ((3,1),(3,3),(1,0))        | f
3691  (5.1,34.5)        | ((1,2),(3,4),(5,6),(7,8))  | f
3692  (5.1,34.5)        | ((7,8),(5,6),(3,4),(1,2))  | f
3693  (5.1,34.5)        | ((1,2),(7,8),(5,6),(3,-4)) | f
3694  (5.1,34.5)        | ((0,0))                    | f
3695  (5.1,34.5)        | ((0,1),(0,1))              | f
3696  (-5,-12)          | ((2,0),(2,4),(0,0))        | f
3697  (-5,-12)          | ((3,1),(3,3),(1,0))        | f
3698  (-5,-12)          | ((1,2),(3,4),(5,6),(7,8))  | f
3699  (-5,-12)          | ((7,8),(5,6),(3,4),(1,2))  | f
3700  (-5,-12)          | ((1,2),(7,8),(5,6),(3,-4)) | f
3701  (-5,-12)          | ((0,0))                    | f
3702  (-5,-12)          | ((0,1),(0,1))              | f
3703  (1e-300,-1e-300)  | ((2,0),(2,4),(0,0))        | t
3704  (1e-300,-1e-300)  | ((3,1),(3,3),(1,0))        | f
3705  (1e-300,-1e-300)  | ((1,2),(3,4),(5,6),(7,8))  | f
3706  (1e-300,-1e-300)  | ((7,8),(5,6),(3,4),(1,2))  | f
3707  (1e-300,-1e-300)  | ((1,2),(7,8),(5,6),(3,-4)) | f
3708  (1e-300,-1e-300)  | ((0,0))                    | t
3709  (1e-300,-1e-300)  | ((0,1),(0,1))              | f
3710  (1e+300,Infinity) | ((2,0),(2,4),(0,0))        | f
3711  (1e+300,Infinity) | ((3,1),(3,3),(1,0))        | f
3712  (1e+300,Infinity) | ((1,2),(3,4),(5,6),(7,8))  | f
3713  (1e+300,Infinity) | ((7,8),(5,6),(3,4),(1,2))  | f
3714  (1e+300,Infinity) | ((1,2),(7,8),(5,6),(3,-4)) | f
3715  (1e+300,Infinity) | ((0,0))                    | f
3716  (1e+300,Infinity) | ((0,1),(0,1))              | f
3717  (Infinity,1e+300) | ((2,0),(2,4),(0,0))        | f
3718  (Infinity,1e+300) | ((3,1),(3,3),(1,0))        | f
3719  (Infinity,1e+300) | ((1,2),(3,4),(5,6),(7,8))  | f
3720  (Infinity,1e+300) | ((7,8),(5,6),(3,4),(1,2))  | f
3721  (Infinity,1e+300) | ((1,2),(7,8),(5,6),(3,-4)) | f
3722  (Infinity,1e+300) | ((0,0))                    | f
3723  (Infinity,1e+300) | ((0,1),(0,1))              | f
3724  (NaN,NaN)         | ((2,0),(2,4),(0,0))        | t
3725  (NaN,NaN)         | ((3,1),(3,3),(1,0))        | t
3726  (NaN,NaN)         | ((1,2),(3,4),(5,6),(7,8))  | t
3727  (NaN,NaN)         | ((7,8),(5,6),(3,4),(1,2))  | t
3728  (NaN,NaN)         | ((1,2),(7,8),(5,6),(3,-4)) | t
3729  (NaN,NaN)         | ((0,0))                    | t
3730  (NaN,NaN)         | ((0,1),(0,1))              | t
3731  (10,10)           | ((2,0),(2,4),(0,0))        | f
3732  (10,10)           | ((3,1),(3,3),(1,0))        | f
3733  (10,10)           | ((1,2),(3,4),(5,6),(7,8))  | f
3734  (10,10)           | ((7,8),(5,6),(3,4),(1,2))  | f
3735  (10,10)           | ((1,2),(7,8),(5,6),(3,-4)) | f
3736  (10,10)           | ((0,0))                    | f
3737  (10,10)           | ((0,1),(0,1))              | f
3738 (70 rows)
3740 SELECT p.f1, poly.f1, p.f1 <@ poly.f1 AS contained
3741    FROM POLYGON_TBL poly, POINT_TBL p;
3742         f1         |             f1             | contained 
3743 -------------------+----------------------------+-----------
3744  (0,0)             | ((2,0),(2,4),(0,0))        | t
3745  (0,0)             | ((3,1),(3,3),(1,0))        | f
3746  (0,0)             | ((1,2),(3,4),(5,6),(7,8))  | f
3747  (0,0)             | ((7,8),(5,6),(3,4),(1,2))  | f
3748  (0,0)             | ((1,2),(7,8),(5,6),(3,-4)) | f
3749  (0,0)             | ((0,0))                    | t
3750  (0,0)             | ((0,1),(0,1))              | f
3751  (-10,0)           | ((2,0),(2,4),(0,0))        | f
3752  (-10,0)           | ((3,1),(3,3),(1,0))        | f
3753  (-10,0)           | ((1,2),(3,4),(5,6),(7,8))  | f
3754  (-10,0)           | ((7,8),(5,6),(3,4),(1,2))  | f
3755  (-10,0)           | ((1,2),(7,8),(5,6),(3,-4)) | f
3756  (-10,0)           | ((0,0))                    | f
3757  (-10,0)           | ((0,1),(0,1))              | f
3758  (-3,4)            | ((2,0),(2,4),(0,0))        | f
3759  (-3,4)            | ((3,1),(3,3),(1,0))        | f
3760  (-3,4)            | ((1,2),(3,4),(5,6),(7,8))  | f
3761  (-3,4)            | ((7,8),(5,6),(3,4),(1,2))  | f
3762  (-3,4)            | ((1,2),(7,8),(5,6),(3,-4)) | f
3763  (-3,4)            | ((0,0))                    | f
3764  (-3,4)            | ((0,1),(0,1))              | f
3765  (5.1,34.5)        | ((2,0),(2,4),(0,0))        | f
3766  (5.1,34.5)        | ((3,1),(3,3),(1,0))        | f
3767  (5.1,34.5)        | ((1,2),(3,4),(5,6),(7,8))  | f
3768  (5.1,34.5)        | ((7,8),(5,6),(3,4),(1,2))  | f
3769  (5.1,34.5)        | ((1,2),(7,8),(5,6),(3,-4)) | f
3770  (5.1,34.5)        | ((0,0))                    | f
3771  (5.1,34.5)        | ((0,1),(0,1))              | f
3772  (-5,-12)          | ((2,0),(2,4),(0,0))        | f
3773  (-5,-12)          | ((3,1),(3,3),(1,0))        | f
3774  (-5,-12)          | ((1,2),(3,4),(5,6),(7,8))  | f
3775  (-5,-12)          | ((7,8),(5,6),(3,4),(1,2))  | f
3776  (-5,-12)          | ((1,2),(7,8),(5,6),(3,-4)) | f
3777  (-5,-12)          | ((0,0))                    | f
3778  (-5,-12)          | ((0,1),(0,1))              | f
3779  (1e-300,-1e-300)  | ((2,0),(2,4),(0,0))        | t
3780  (1e-300,-1e-300)  | ((3,1),(3,3),(1,0))        | f
3781  (1e-300,-1e-300)  | ((1,2),(3,4),(5,6),(7,8))  | f
3782  (1e-300,-1e-300)  | ((7,8),(5,6),(3,4),(1,2))  | f
3783  (1e-300,-1e-300)  | ((1,2),(7,8),(5,6),(3,-4)) | f
3784  (1e-300,-1e-300)  | ((0,0))                    | t
3785  (1e-300,-1e-300)  | ((0,1),(0,1))              | f
3786  (1e+300,Infinity) | ((2,0),(2,4),(0,0))        | f
3787  (1e+300,Infinity) | ((3,1),(3,3),(1,0))        | f
3788  (1e+300,Infinity) | ((1,2),(3,4),(5,6),(7,8))  | f
3789  (1e+300,Infinity) | ((7,8),(5,6),(3,4),(1,2))  | f
3790  (1e+300,Infinity) | ((1,2),(7,8),(5,6),(3,-4)) | f
3791  (1e+300,Infinity) | ((0,0))                    | f
3792  (1e+300,Infinity) | ((0,1),(0,1))              | f
3793  (Infinity,1e+300) | ((2,0),(2,4),(0,0))        | f
3794  (Infinity,1e+300) | ((3,1),(3,3),(1,0))        | f
3795  (Infinity,1e+300) | ((1,2),(3,4),(5,6),(7,8))  | f
3796  (Infinity,1e+300) | ((7,8),(5,6),(3,4),(1,2))  | f
3797  (Infinity,1e+300) | ((1,2),(7,8),(5,6),(3,-4)) | f
3798  (Infinity,1e+300) | ((0,0))                    | f
3799  (Infinity,1e+300) | ((0,1),(0,1))              | f
3800  (NaN,NaN)         | ((2,0),(2,4),(0,0))        | t
3801  (NaN,NaN)         | ((3,1),(3,3),(1,0))        | t
3802  (NaN,NaN)         | ((1,2),(3,4),(5,6),(7,8))  | t
3803  (NaN,NaN)         | ((7,8),(5,6),(3,4),(1,2))  | t
3804  (NaN,NaN)         | ((1,2),(7,8),(5,6),(3,-4)) | t
3805  (NaN,NaN)         | ((0,0))                    | t
3806  (NaN,NaN)         | ((0,1),(0,1))              | t
3807  (10,10)           | ((2,0),(2,4),(0,0))        | f
3808  (10,10)           | ((3,1),(3,3),(1,0))        | f
3809  (10,10)           | ((1,2),(3,4),(5,6),(7,8))  | f
3810  (10,10)           | ((7,8),(5,6),(3,4),(1,2))  | f
3811  (10,10)           | ((1,2),(7,8),(5,6),(3,-4)) | f
3812  (10,10)           | ((0,0))                    | f
3813  (10,10)           | ((0,1),(0,1))              | f
3814 (70 rows)
3816 SELECT npoints(f1) AS npoints, f1 AS polygon
3817    FROM POLYGON_TBL;
3818  npoints |          polygon           
3819 ---------+----------------------------
3820        3 | ((2,0),(2,4),(0,0))
3821        3 | ((3,1),(3,3),(1,0))
3822        4 | ((1,2),(3,4),(5,6),(7,8))
3823        4 | ((7,8),(5,6),(3,4),(1,2))
3824        4 | ((1,2),(7,8),(5,6),(3,-4))
3825        1 | ((0,0))
3826        2 | ((0,1),(0,1))
3827 (7 rows)
3829 SELECT polygon(f1)
3830    FROM BOX_TBL;
3831                   polygon                  
3832 -------------------------------------------
3833  ((0,0),(0,2),(2,2),(2,0))
3834  ((1,1),(1,3),(3,3),(3,1))
3835  ((-8,-10),(-8,2),(-2,2),(-2,-10))
3836  ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5))
3837  ((3,3),(3,3),(3,3),(3,3))
3838 (5 rows)
3840 SELECT polygon(f1)
3841    FROM PATH_TBL WHERE isclosed(f1);
3842       polygon      
3843 -------------------
3844  ((1,2),(3,4))
3845  ((1,2),(3,4))
3846  ((1,2),(3,4))
3847  ((10,20))
3848  ((11,12),(13,14))
3849 (5 rows)
3851 SELECT f1 AS open_path, polygon( pclose(f1)) AS polygon
3852    FROM PATH_TBL
3853    WHERE isopen(f1);
3854          open_path         |          polygon          
3855 ---------------------------+---------------------------
3856  [(1,2),(3,4)]             | ((1,2),(3,4))
3857  [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6))
3858  [(1,2),(3,4)]             | ((1,2),(3,4))
3859  [(11,12),(13,14)]         | ((11,12),(13,14))
3860 (4 rows)
3862 -- To box
3863 SELECT f1, f1::box FROM POLYGON_TBL;
3864              f1             |      f1      
3865 ----------------------------+--------------
3866  ((2,0),(2,4),(0,0))        | (2,4),(0,0)
3867  ((3,1),(3,3),(1,0))        | (3,3),(1,0)
3868  ((1,2),(3,4),(5,6),(7,8))  | (7,8),(1,2)
3869  ((7,8),(5,6),(3,4),(1,2))  | (7,8),(1,2)
3870  ((1,2),(7,8),(5,6),(3,-4)) | (7,8),(1,-4)
3871  ((0,0))                    | (0,0),(0,0)
3872  ((0,1),(0,1))              | (0,1),(0,1)
3873 (7 rows)
3875 -- To path
3876 SELECT f1, f1::path FROM POLYGON_TBL;
3877              f1             |             f1             
3878 ----------------------------+----------------------------
3879  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3880  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3881  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3882  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3883  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3884  ((0,0))                    | ((0,0))
3885  ((0,1),(0,1))              | ((0,1),(0,1))
3886 (7 rows)
3888 -- Same as polygon
3889 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 ~= p2.f1;
3890              f1             |             f1             
3891 ----------------------------+----------------------------
3892  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3893  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3894  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3895  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3896  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
3897  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3898  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3899  ((0,0))                    | ((0,0))
3900  ((0,1),(0,1))              | ((0,1),(0,1))
3901 (9 rows)
3903 -- Contained by polygon
3904 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <@ p2.f1;
3905              f1             |             f1             
3906 ----------------------------+----------------------------
3907  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3908  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3909  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3910  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3911  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
3912  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
3913  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3914  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
3915  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3916  ((0,0))                    | ((2,0),(2,4),(0,0))
3917  ((0,0))                    | ((0,0))
3918  ((0,1),(0,1))              | ((0,1),(0,1))
3919 (12 rows)
3921 -- Contains polygon
3922 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 @> p2.f1;
3923              f1             |             f1             
3924 ----------------------------+----------------------------
3925  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3926  ((2,0),(2,4),(0,0))        | ((0,0))
3927  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3928  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3929  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3930  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
3931  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3932  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
3933  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
3934  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3935  ((0,0))                    | ((0,0))
3936  ((0,1),(0,1))              | ((0,1),(0,1))
3937 (12 rows)
3939 -- Overlap with polygon
3940 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 && p2.f1;
3941              f1             |             f1             
3942 ----------------------------+----------------------------
3943  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3944  ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
3945  ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
3946  ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
3947  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
3948  ((2,0),(2,4),(0,0))        | ((0,0))
3949  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
3950  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3951  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
3952  ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
3953  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3954  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3955  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
3956  ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
3957  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
3958  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
3959  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
3960  ((1,2),(7,8),(5,6),(3,-4)) | ((2,0),(2,4),(0,0))
3961  ((1,2),(7,8),(5,6),(3,-4)) | ((3,1),(3,3),(1,0))
3962  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
3963  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
3964  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
3965  ((0,0))                    | ((2,0),(2,4),(0,0))
3966  ((0,0))                    | ((0,0))
3967  ((0,1),(0,1))              | ((0,1),(0,1))
3968 (25 rows)
3970 -- Left of polygon
3971 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 << p2.f1;
3972       f1       |             f1             
3973 ---------------+----------------------------
3974  ((0,0))       | ((3,1),(3,3),(1,0))
3975  ((0,0))       | ((1,2),(3,4),(5,6),(7,8))
3976  ((0,0))       | ((7,8),(5,6),(3,4),(1,2))
3977  ((0,0))       | ((1,2),(7,8),(5,6),(3,-4))
3978  ((0,1),(0,1)) | ((3,1),(3,3),(1,0))
3979  ((0,1),(0,1)) | ((1,2),(3,4),(5,6),(7,8))
3980  ((0,1),(0,1)) | ((7,8),(5,6),(3,4),(1,2))
3981  ((0,1),(0,1)) | ((1,2),(7,8),(5,6),(3,-4))
3982 (8 rows)
3984 -- Overlap of 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  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
3989  ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
3990  ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
3991  ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
3992  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
3993  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
3994  ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
3995  ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
3996  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
3997  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
3998  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
3999  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
4000  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
4001  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
4002  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
4003  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
4004  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
4005  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
4006  ((0,0))                    | ((2,0),(2,4),(0,0))
4007  ((0,0))                    | ((3,1),(3,3),(1,0))
4008  ((0,0))                    | ((1,2),(3,4),(5,6),(7,8))
4009  ((0,0))                    | ((7,8),(5,6),(3,4),(1,2))
4010  ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
4011  ((0,0))                    | ((0,0))
4012  ((0,0))                    | ((0,1),(0,1))
4013  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
4014  ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
4015  ((0,1),(0,1))              | ((1,2),(3,4),(5,6),(7,8))
4016  ((0,1),(0,1))              | ((7,8),(5,6),(3,4),(1,2))
4017  ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
4018  ((0,1),(0,1))              | ((0,0))
4019  ((0,1),(0,1))              | ((0,1),(0,1))
4020 (32 rows)
4022 -- Right of polygon
4023 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 >> p2.f1;
4024              f1             |      f1       
4025 ----------------------------+---------------
4026  ((3,1),(3,3),(1,0))        | ((0,0))
4027  ((3,1),(3,3),(1,0))        | ((0,1),(0,1))
4028  ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
4029  ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
4030  ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
4031  ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
4032  ((1,2),(7,8),(5,6),(3,-4)) | ((0,0))
4033  ((1,2),(7,8),(5,6),(3,-4)) | ((0,1),(0,1))
4034 (8 rows)
4036 -- Overlap of 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  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
4041  ((2,0),(2,4),(0,0))        | ((0,0))
4042  ((2,0),(2,4),(0,0))        | ((0,1),(0,1))
4043  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
4044  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
4045  ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
4046  ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
4047  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
4048  ((3,1),(3,3),(1,0))        | ((0,0))
4049  ((3,1),(3,3),(1,0))        | ((0,1),(0,1))
4050  ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
4051  ((1,2),(3,4),(5,6),(7,8))  | ((3,1),(3,3),(1,0))
4052  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
4053  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
4054  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
4055  ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
4056  ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
4057  ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
4058  ((7,8),(5,6),(3,4),(1,2))  | ((3,1),(3,3),(1,0))
4059  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
4060  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
4061  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
4062  ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
4063  ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
4064  ((1,2),(7,8),(5,6),(3,-4)) | ((2,0),(2,4),(0,0))
4065  ((1,2),(7,8),(5,6),(3,-4)) | ((3,1),(3,3),(1,0))
4066  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
4067  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
4068  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
4069  ((1,2),(7,8),(5,6),(3,-4)) | ((0,0))
4070  ((1,2),(7,8),(5,6),(3,-4)) | ((0,1),(0,1))
4071  ((0,0))                    | ((2,0),(2,4),(0,0))
4072  ((0,0))                    | ((0,0))
4073  ((0,0))                    | ((0,1),(0,1))
4074  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
4075  ((0,1),(0,1))              | ((0,0))
4076  ((0,1),(0,1))              | ((0,1),(0,1))
4077 (37 rows)
4079 -- Below polygon
4080 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <<| p2.f1;
4081       f1       |            f1             
4082 ---------------+---------------------------
4083  ((0,0))       | ((1,2),(3,4),(5,6),(7,8))
4084  ((0,0))       | ((7,8),(5,6),(3,4),(1,2))
4085  ((0,0))       | ((0,1),(0,1))
4086  ((0,1),(0,1)) | ((1,2),(3,4),(5,6),(7,8))
4087  ((0,1),(0,1)) | ((7,8),(5,6),(3,4),(1,2))
4088 (5 rows)
4090 -- Overlap or below polygon
4091 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &<| p2.f1;
4092              f1             |             f1             
4093 ----------------------------+----------------------------
4094  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
4095  ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
4096  ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
4097  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
4098  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
4099  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
4100  ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
4101  ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
4102  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
4103  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
4104  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
4105  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
4106  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
4107  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
4108  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
4109  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
4110  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
4111  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
4112  ((0,0))                    | ((2,0),(2,4),(0,0))
4113  ((0,0))                    | ((3,1),(3,3),(1,0))
4114  ((0,0))                    | ((1,2),(3,4),(5,6),(7,8))
4115  ((0,0))                    | ((7,8),(5,6),(3,4),(1,2))
4116  ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
4117  ((0,0))                    | ((0,0))
4118  ((0,0))                    | ((0,1),(0,1))
4119  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
4120  ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
4121  ((0,1),(0,1))              | ((1,2),(3,4),(5,6),(7,8))
4122  ((0,1),(0,1))              | ((7,8),(5,6),(3,4),(1,2))
4123  ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
4124  ((0,1),(0,1))              | ((0,1),(0,1))
4125 (31 rows)
4127 -- Above polygon
4128 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |>> p2.f1;
4129             f1             |      f1       
4130 ---------------------------+---------------
4131  ((1,2),(3,4),(5,6),(7,8)) | ((0,0))
4132  ((1,2),(3,4),(5,6),(7,8)) | ((0,1),(0,1))
4133  ((7,8),(5,6),(3,4),(1,2)) | ((0,0))
4134  ((7,8),(5,6),(3,4),(1,2)) | ((0,1),(0,1))
4135  ((0,1),(0,1))             | ((0,0))
4136 (5 rows)
4138 -- Overlap or above polygon
4139 SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |&> p2.f1;
4140              f1             |             f1             
4141 ----------------------------+----------------------------
4142  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
4143  ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
4144  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
4145  ((2,0),(2,4),(0,0))        | ((0,0))
4146  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
4147  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
4148  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
4149  ((3,1),(3,3),(1,0))        | ((0,0))
4150  ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
4151  ((1,2),(3,4),(5,6),(7,8))  | ((3,1),(3,3),(1,0))
4152  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
4153  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
4154  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
4155  ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
4156  ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
4157  ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
4158  ((7,8),(5,6),(3,4),(1,2))  | ((3,1),(3,3),(1,0))
4159  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
4160  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
4161  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
4162  ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
4163  ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
4164  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
4165  ((0,0))                    | ((2,0),(2,4),(0,0))
4166  ((0,0))                    | ((3,1),(3,3),(1,0))
4167  ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
4168  ((0,0))                    | ((0,0))
4169  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
4170  ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
4171  ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
4172  ((0,1),(0,1))              | ((0,0))
4173  ((0,1),(0,1))              | ((0,1),(0,1))
4174 (32 rows)
4176 -- Distance to polygon
4177 SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2;
4178              f1             |             f1             |    ?column?    
4179 ----------------------------+----------------------------+----------------
4180  ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))        |              0
4181  ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))        |              0
4182  ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))  |              0
4183  ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))  |              0
4184  ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4)) |              0
4185  ((2,0),(2,4),(0,0))        | ((0,0))                    |              0
4186  ((2,0),(2,4),(0,0))        | ((0,1),(0,1))              |   0.4472135955
4187  ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))        |              0
4188  ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))        |              0
4189  ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))  | 0.707106781187
4190  ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))  | 0.707106781187
4191  ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4)) |              0
4192  ((3,1),(3,3),(1,0))        | ((0,0))                    |              1
4193  ((3,1),(3,3),(1,0))        | ((0,1),(0,1))              |  1.38675049056
4194  ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))        |              0
4195  ((1,2),(3,4),(5,6),(7,8))  | ((3,1),(3,3),(1,0))        | 0.707106781187
4196  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))  |              0
4197  ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))  |              0
4198  ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4)) |              0
4199  ((1,2),(3,4),(5,6),(7,8))  | ((0,0))                    |   2.2360679775
4200  ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))              |  1.41421356237
4201  ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))        |              0
4202  ((7,8),(5,6),(3,4),(1,2))  | ((3,1),(3,3),(1,0))        | 0.707106781187
4203  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))  |              0
4204  ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))  |              0
4205  ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4)) |              0
4206  ((7,8),(5,6),(3,4),(1,2))  | ((0,0))                    |   2.2360679775
4207  ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))              |  1.41421356237
4208  ((1,2),(7,8),(5,6),(3,-4)) | ((2,0),(2,4),(0,0))        |              0
4209  ((1,2),(7,8),(5,6),(3,-4)) | ((3,1),(3,3),(1,0))        |              0
4210  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))  |              0
4211  ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))  |              0
4212  ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4)) |              0
4213  ((1,2),(7,8),(5,6),(3,-4)) | ((0,0))                    |  1.58113883008
4214  ((1,2),(7,8),(5,6),(3,-4)) | ((0,1),(0,1))              |  1.26491106407
4215  ((0,0))                    | ((2,0),(2,4),(0,0))        |              0
4216  ((0,0))                    | ((3,1),(3,3),(1,0))        |              1
4217  ((0,0))                    | ((1,2),(3,4),(5,6),(7,8))  |   2.2360679775
4218  ((0,0))                    | ((7,8),(5,6),(3,4),(1,2))  |   2.2360679775
4219  ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4)) |  1.58113883008
4220  ((0,0))                    | ((0,0))                    |              0
4221  ((0,0))                    | ((0,1),(0,1))              |              1
4222  ((0,1),(0,1))              | ((2,0),(2,4),(0,0))        |   0.4472135955
4223  ((0,1),(0,1))              | ((3,1),(3,3),(1,0))        |  1.38675049056
4224  ((0,1),(0,1))              | ((1,2),(3,4),(5,6),(7,8))  |  1.41421356237
4225  ((0,1),(0,1))              | ((7,8),(5,6),(3,4),(1,2))  |  1.41421356237
4226  ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4)) |  1.26491106407
4227  ((0,1),(0,1))              | ((0,0))                    |              1
4228  ((0,1),(0,1))              | ((0,1),(0,1))              |              0
4229 (49 rows)
4232 -- Circles
4234 SELECT circle(f1, 50.0)
4235    FROM POINT_TBL;
4236          circle         
4237 ------------------------
4238  <(0,0),50>
4239  <(-10,0),50>
4240  <(-3,4),50>
4241  <(5.1,34.5),50>
4242  <(-5,-12),50>
4243  <(1e-300,-1e-300),50>
4244  <(1e+300,Infinity),50>
4245  <(Infinity,1e+300),50>
4246  <(NaN,NaN),50>
4247  <(10,10),50>
4248 (10 rows)
4250 SELECT circle(f1)
4251    FROM BOX_TBL;
4252          circle         
4253 ------------------------
4254  <(1,1),1.41421356237>
4255  <(2,2),1.41421356237>
4256  <(-5,-4),6.7082039325>
4257  <(2.5,3),0.5>
4258  <(3,3),0>
4259 (5 rows)
4261 SELECT circle(f1)
4262    FROM POLYGON_TBL
4263    WHERE (# f1) >= 3;
4264                     circle                     
4265 -----------------------------------------------
4266  <(1.33333333333,1.33333333333),2.04168905064>
4267  <(2.33333333333,1.33333333333),1.47534300379>
4268  <(4,5),2.82842712475>
4269  <(4,5),2.82842712475>
4270  <(4,3),4.80664375676>
4271 (5 rows)
4273 SELECT c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
4274    FROM CIRCLE_TBL c1, POINT_TBL p1
4275    WHERE (p1.f1 <-> c1.f1) > 0
4276    ORDER BY distance, area(c1.f1), p1.f1[0];
4277      circle     |       point       |   distance    
4278 ----------------+-------------------+---------------
4279  <(1,2),3>      | (-3,4)            |   1.472135955
4280  <(5,1),3>      | (0,0)             | 2.09901951359
4281  <(5,1),3>      | (1e-300,-1e-300)  | 2.09901951359
4282  <(5,1),3>      | (-3,4)            | 5.54400374532
4283  <(3,5),0>      | (0,0)             | 5.83095189485
4284  <(3,5),0>      | (1e-300,-1e-300)  | 5.83095189485
4285  <(3,5),0>      | (-3,4)            |  6.0827625303
4286  <(1,3),5>      | (-10,0)           | 6.40175425099
4287  <(1,3),5>      | (10,10)           | 6.40175425099
4288  <(5,1),3>      | (10,10)           | 7.29563014099
4289  <(1,2),3>      | (-10,0)           |  8.1803398875
4290  <(3,5),0>      | (10,10)           | 8.60232526704
4291  <(1,2),3>      | (10,10)           | 9.04159457879
4292  <(1,3),5>      | (-5,-12)          | 11.1554944214
4293  <(5,1),3>      | (-10,0)           | 12.0332963784
4294  <(1,2),3>      | (-5,-12)          | 12.2315462117
4295  <(5,1),3>      | (-5,-12)          | 13.4012194669
4296  <(3,5),0>      | (-10,0)           | 13.9283882772
4297  <(3,5),0>      | (-5,-12)          | 18.7882942281
4298  <(1,3),5>      | (5.1,34.5)        | 26.7657047773
4299  <(3,5),0>      | (5.1,34.5)        | 29.5746513082
4300  <(1,2),3>      | (5.1,34.5)        | 29.7575945393
4301  <(5,1),3>      | (5.1,34.5)        | 30.5001492534
4302  <(100,200),10> | (5.1,34.5)        | 180.778038568
4303  <(100,200),10> | (10,10)           | 200.237960416
4304  <(100,200),10> | (-3,4)            | 211.415898255
4305  <(100,200),10> | (0,0)             |  213.60679775
4306  <(100,200),10> | (1e-300,-1e-300)  |  213.60679775
4307  <(100,200),10> | (-10,0)           |  218.25424421
4308  <(100,200),10> | (-5,-12)          | 226.577682802
4309  <(3,5),0>      | (1e+300,Infinity) |      Infinity
4310  <(3,5),0>      | (Infinity,1e+300) |      Infinity
4311  <(1,2),3>      | (1e+300,Infinity) |      Infinity
4312  <(5,1),3>      | (1e+300,Infinity) |      Infinity
4313  <(5,1),3>      | (Infinity,1e+300) |      Infinity
4314  <(1,2),3>      | (Infinity,1e+300) |      Infinity
4315  <(1,3),5>      | (1e+300,Infinity) |      Infinity
4316  <(1,3),5>      | (Infinity,1e+300) |      Infinity
4317  <(100,200),10> | (1e+300,Infinity) |      Infinity
4318  <(100,200),10> | (Infinity,1e+300) |      Infinity
4319  <(1,2),100>    | (1e+300,Infinity) |      Infinity
4320  <(1,2),100>    | (Infinity,1e+300) |      Infinity
4321  <(100,1),115>  | (1e+300,Infinity) |      Infinity
4322  <(100,1),115>  | (Infinity,1e+300) |      Infinity
4323  <(3,5),0>      | (NaN,NaN)         |           NaN
4324  <(1,2),3>      | (NaN,NaN)         |           NaN
4325  <(5,1),3>      | (NaN,NaN)         |           NaN
4326  <(1,3),5>      | (NaN,NaN)         |           NaN
4327  <(100,200),10> | (NaN,NaN)         |           NaN
4328  <(1,2),100>    | (NaN,NaN)         |           NaN
4329  <(100,1),115>  | (NaN,NaN)         |           NaN
4330  <(3,5),NaN>    | (-10,0)           |           NaN
4331  <(3,5),NaN>    | (-5,-12)          |           NaN
4332  <(3,5),NaN>    | (-3,4)            |           NaN
4333  <(3,5),NaN>    | (0,0)             |           NaN
4334  <(3,5),NaN>    | (1e-300,-1e-300)  |           NaN
4335  <(3,5),NaN>    | (5.1,34.5)        |           NaN
4336  <(3,5),NaN>    | (10,10)           |           NaN
4337  <(3,5),NaN>    | (1e+300,Infinity) |           NaN
4338  <(3,5),NaN>    | (Infinity,1e+300) |           NaN
4339  <(3,5),NaN>    | (NaN,NaN)         |           NaN
4340 (61 rows)
4342 -- To polygon
4343 SELECT f1, f1::polygon FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
4344        f1       |                                                                                                          f1                                                                                                          
4345 ----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
4346  <(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))
4347  <(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))
4348  <(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))
4349  <(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))
4350  <(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))
4351  <(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))
4352 (6 rows)
4354 -- To polygon with less points
4355 SELECT f1, polygon(8, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
4356        f1       |                                                                             polygon                                                                              
4357 ----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------
4358  <(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))
4359  <(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))
4360  <(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))
4361  <(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))
4362  <(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))
4363  <(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))
4364 (6 rows)
4366 -- Error for insufficient number of points
4367 SELECT f1, polygon(1, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
4368 ERROR:  must request at least 2 points
4369 -- Zero radius error
4370 SELECT f1, polygon(10, f1) FROM CIRCLE_TBL WHERE f1 < '<(0,0),1>';
4371 ERROR:  cannot convert circle with radius zero to polygon
4372 -- Same as circle
4373 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 ~= c2.f1;
4374        f1       |       f1       
4375 ----------------+----------------
4376  <(5,1),3>      | <(5,1),3>
4377  <(1,2),100>    | <(1,2),100>
4378  <(1,3),5>      | <(1,3),5>
4379  <(1,2),3>      | <(1,2),3>
4380  <(100,200),10> | <(100,200),10>
4381  <(100,1),115>  | <(100,1),115>
4382  <(3,5),0>      | <(3,5),0>
4383  <(3,5),NaN>    | <(3,5),NaN>
4384 (8 rows)
4386 -- Overlap with circle
4387 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 && c2.f1;
4388        f1       |       f1       
4389 ----------------+----------------
4390  <(5,1),3>      | <(5,1),3>
4391  <(5,1),3>      | <(1,2),100>
4392  <(5,1),3>      | <(1,3),5>
4393  <(5,1),3>      | <(1,2),3>
4394  <(5,1),3>      | <(100,1),115>
4395  <(1,2),100>    | <(5,1),3>
4396  <(1,2),100>    | <(1,2),100>
4397  <(1,2),100>    | <(1,3),5>
4398  <(1,2),100>    | <(1,2),3>
4399  <(1,2),100>    | <(100,1),115>
4400  <(1,2),100>    | <(3,5),0>
4401  <(1,3),5>      | <(5,1),3>
4402  <(1,3),5>      | <(1,2),100>
4403  <(1,3),5>      | <(1,3),5>
4404  <(1,3),5>      | <(1,2),3>
4405  <(1,3),5>      | <(100,1),115>
4406  <(1,3),5>      | <(3,5),0>
4407  <(1,2),3>      | <(5,1),3>
4408  <(1,2),3>      | <(1,2),100>
4409  <(1,2),3>      | <(1,3),5>
4410  <(1,2),3>      | <(1,2),3>
4411  <(1,2),3>      | <(100,1),115>
4412  <(100,200),10> | <(100,200),10>
4413  <(100,1),115>  | <(5,1),3>
4414  <(100,1),115>  | <(1,2),100>
4415  <(100,1),115>  | <(1,3),5>
4416  <(100,1),115>  | <(1,2),3>
4417  <(100,1),115>  | <(100,1),115>
4418  <(100,1),115>  | <(3,5),0>
4419  <(3,5),0>      | <(1,2),100>
4420  <(3,5),0>      | <(1,3),5>
4421  <(3,5),0>      | <(100,1),115>
4422  <(3,5),0>      | <(3,5),0>
4423 (33 rows)
4425 -- Overlap or left of circle
4426 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &< c2.f1;
4427        f1       |       f1       
4428 ----------------+----------------
4429  <(5,1),3>      | <(5,1),3>
4430  <(5,1),3>      | <(1,2),100>
4431  <(5,1),3>      | <(100,200),10>
4432  <(5,1),3>      | <(100,1),115>
4433  <(1,2),100>    | <(1,2),100>
4434  <(1,2),100>    | <(100,200),10>
4435  <(1,2),100>    | <(100,1),115>
4436  <(1,3),5>      | <(5,1),3>
4437  <(1,3),5>      | <(1,2),100>
4438  <(1,3),5>      | <(1,3),5>
4439  <(1,3),5>      | <(100,200),10>
4440  <(1,3),5>      | <(100,1),115>
4441  <(1,2),3>      | <(5,1),3>
4442  <(1,2),3>      | <(1,2),100>
4443  <(1,2),3>      | <(1,3),5>
4444  <(1,2),3>      | <(1,2),3>
4445  <(1,2),3>      | <(100,200),10>
4446  <(1,2),3>      | <(100,1),115>
4447  <(100,200),10> | <(100,200),10>
4448  <(100,200),10> | <(100,1),115>
4449  <(100,1),115>  | <(100,1),115>
4450  <(3,5),0>      | <(5,1),3>
4451  <(3,5),0>      | <(1,2),100>
4452  <(3,5),0>      | <(1,3),5>
4453  <(3,5),0>      | <(1,2),3>
4454  <(3,5),0>      | <(100,200),10>
4455  <(3,5),0>      | <(100,1),115>
4456  <(3,5),0>      | <(3,5),0>
4457 (28 rows)
4459 -- Left of circle
4460 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 << c2.f1;
4461     f1     |       f1       
4462 -----------+----------------
4463  <(5,1),3> | <(100,200),10>
4464  <(1,3),5> | <(100,200),10>
4465  <(1,2),3> | <(100,200),10>
4466  <(3,5),0> | <(100,200),10>
4467 (4 rows)
4469 -- Right of circle
4470 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >> c2.f1;
4471        f1       |    f1     
4472 ----------------+-----------
4473  <(100,200),10> | <(5,1),3>
4474  <(100,200),10> | <(1,3),5>
4475  <(100,200),10> | <(1,2),3>
4476  <(100,200),10> | <(3,5),0>
4477 (4 rows)
4479 -- Overlap or right of circle
4480 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &> c2.f1;
4481        f1       |       f1       
4482 ----------------+----------------
4483  <(5,1),3>      | <(5,1),3>
4484  <(5,1),3>      | <(1,2),100>
4485  <(5,1),3>      | <(1,3),5>
4486  <(5,1),3>      | <(1,2),3>
4487  <(5,1),3>      | <(100,1),115>
4488  <(1,2),100>    | <(1,2),100>
4489  <(1,3),5>      | <(1,2),100>
4490  <(1,3),5>      | <(1,3),5>
4491  <(1,3),5>      | <(100,1),115>
4492  <(1,2),3>      | <(1,2),100>
4493  <(1,2),3>      | <(1,3),5>
4494  <(1,2),3>      | <(1,2),3>
4495  <(1,2),3>      | <(100,1),115>
4496  <(100,200),10> | <(5,1),3>
4497  <(100,200),10> | <(1,2),100>
4498  <(100,200),10> | <(1,3),5>
4499  <(100,200),10> | <(1,2),3>
4500  <(100,200),10> | <(100,200),10>
4501  <(100,200),10> | <(100,1),115>
4502  <(100,200),10> | <(3,5),0>
4503  <(100,1),115>  | <(1,2),100>
4504  <(100,1),115>  | <(100,1),115>
4505  <(3,5),0>      | <(5,1),3>
4506  <(3,5),0>      | <(1,2),100>
4507  <(3,5),0>      | <(1,3),5>
4508  <(3,5),0>      | <(1,2),3>
4509  <(3,5),0>      | <(100,1),115>
4510  <(3,5),0>      | <(3,5),0>
4511 (28 rows)
4513 -- Contained by circle
4514 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <@ c2.f1;
4515        f1       |       f1       
4516 ----------------+----------------
4517  <(5,1),3>      | <(5,1),3>
4518  <(5,1),3>      | <(1,2),100>
4519  <(5,1),3>      | <(100,1),115>
4520  <(1,2),100>    | <(1,2),100>
4521  <(1,3),5>      | <(1,2),100>
4522  <(1,3),5>      | <(1,3),5>
4523  <(1,3),5>      | <(100,1),115>
4524  <(1,2),3>      | <(1,2),100>
4525  <(1,2),3>      | <(1,3),5>
4526  <(1,2),3>      | <(1,2),3>
4527  <(1,2),3>      | <(100,1),115>
4528  <(100,200),10> | <(100,200),10>
4529  <(100,1),115>  | <(100,1),115>
4530  <(3,5),0>      | <(1,2),100>
4531  <(3,5),0>      | <(1,3),5>
4532  <(3,5),0>      | <(100,1),115>
4533  <(3,5),0>      | <(3,5),0>
4534 (17 rows)
4536 -- Contain by circle
4537 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 @> c2.f1;
4538        f1       |       f1       
4539 ----------------+----------------
4540  <(5,1),3>      | <(5,1),3>
4541  <(1,2),100>    | <(5,1),3>
4542  <(1,2),100>    | <(1,2),100>
4543  <(1,2),100>    | <(1,3),5>
4544  <(1,2),100>    | <(1,2),3>
4545  <(1,2),100>    | <(3,5),0>
4546  <(1,3),5>      | <(1,3),5>
4547  <(1,3),5>      | <(1,2),3>
4548  <(1,3),5>      | <(3,5),0>
4549  <(1,2),3>      | <(1,2),3>
4550  <(100,200),10> | <(100,200),10>
4551  <(100,1),115>  | <(5,1),3>
4552  <(100,1),115>  | <(1,3),5>
4553  <(100,1),115>  | <(1,2),3>
4554  <(100,1),115>  | <(100,1),115>
4555  <(100,1),115>  | <(3,5),0>
4556  <(3,5),0>      | <(3,5),0>
4557 (17 rows)
4559 -- Below circle
4560 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <<| c2.f1;
4561       f1       |       f1       
4562 ---------------+----------------
4563  <(5,1),3>     | <(100,200),10>
4564  <(5,1),3>     | <(3,5),0>
4565  <(1,2),100>   | <(100,200),10>
4566  <(1,3),5>     | <(100,200),10>
4567  <(1,2),3>     | <(100,200),10>
4568  <(100,1),115> | <(100,200),10>
4569  <(3,5),0>     | <(100,200),10>
4570 (7 rows)
4572 -- Above circle
4573 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |>> c2.f1;
4574        f1       |      f1       
4575 ----------------+---------------
4576  <(100,200),10> | <(5,1),3>
4577  <(100,200),10> | <(1,2),100>
4578  <(100,200),10> | <(1,3),5>
4579  <(100,200),10> | <(1,2),3>
4580  <(100,200),10> | <(100,1),115>
4581  <(100,200),10> | <(3,5),0>
4582  <(3,5),0>      | <(5,1),3>
4583 (7 rows)
4585 -- Overlap or below circle
4586 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &<| c2.f1;
4587        f1       |       f1       
4588 ----------------+----------------
4589  <(5,1),3>      | <(5,1),3>
4590  <(5,1),3>      | <(1,2),100>
4591  <(5,1),3>      | <(1,3),5>
4592  <(5,1),3>      | <(1,2),3>
4593  <(5,1),3>      | <(100,200),10>
4594  <(5,1),3>      | <(100,1),115>
4595  <(5,1),3>      | <(3,5),0>
4596  <(1,2),100>    | <(1,2),100>
4597  <(1,2),100>    | <(100,200),10>
4598  <(1,2),100>    | <(100,1),115>
4599  <(1,3),5>      | <(1,2),100>
4600  <(1,3),5>      | <(1,3),5>
4601  <(1,3),5>      | <(100,200),10>
4602  <(1,3),5>      | <(100,1),115>
4603  <(1,2),3>      | <(1,2),100>
4604  <(1,2),3>      | <(1,3),5>
4605  <(1,2),3>      | <(1,2),3>
4606  <(1,2),3>      | <(100,200),10>
4607  <(1,2),3>      | <(100,1),115>
4608  <(1,2),3>      | <(3,5),0>
4609  <(100,200),10> | <(100,200),10>
4610  <(100,1),115>  | <(100,200),10>
4611  <(100,1),115>  | <(100,1),115>
4612  <(3,5),0>      | <(1,2),100>
4613  <(3,5),0>      | <(1,3),5>
4614  <(3,5),0>      | <(1,2),3>
4615  <(3,5),0>      | <(100,200),10>
4616  <(3,5),0>      | <(100,1),115>
4617  <(3,5),0>      | <(3,5),0>
4618 (29 rows)
4620 -- Overlap or above circle
4621 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |&> c2.f1;
4622        f1       |       f1       
4623 ----------------+----------------
4624  <(5,1),3>      | <(5,1),3>
4625  <(5,1),3>      | <(1,2),100>
4626  <(5,1),3>      | <(1,3),5>
4627  <(5,1),3>      | <(100,1),115>
4628  <(1,2),100>    | <(1,2),100>
4629  <(1,2),100>    | <(100,1),115>
4630  <(1,3),5>      | <(5,1),3>
4631  <(1,3),5>      | <(1,2),100>
4632  <(1,3),5>      | <(1,3),5>
4633  <(1,3),5>      | <(100,1),115>
4634  <(1,2),3>      | <(5,1),3>
4635  <(1,2),3>      | <(1,2),100>
4636  <(1,2),3>      | <(1,3),5>
4637  <(1,2),3>      | <(1,2),3>
4638  <(1,2),3>      | <(100,1),115>
4639  <(100,200),10> | <(5,1),3>
4640  <(100,200),10> | <(1,2),100>
4641  <(100,200),10> | <(1,3),5>
4642  <(100,200),10> | <(1,2),3>
4643  <(100,200),10> | <(100,200),10>
4644  <(100,200),10> | <(100,1),115>
4645  <(100,200),10> | <(3,5),0>
4646  <(100,1),115>  | <(100,1),115>
4647  <(3,5),0>      | <(5,1),3>
4648  <(3,5),0>      | <(1,2),100>
4649  <(3,5),0>      | <(1,3),5>
4650  <(3,5),0>      | <(1,2),3>
4651  <(3,5),0>      | <(100,1),115>
4652  <(3,5),0>      | <(3,5),0>
4653 (29 rows)
4655 -- Area equal with circle
4656 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 = c2.f1;
4657        f1       |       f1       
4658 ----------------+----------------
4659  <(5,1),3>      | <(5,1),3>
4660  <(5,1),3>      | <(1,2),3>
4661  <(1,2),100>    | <(1,2),100>
4662  <(1,3),5>      | <(1,3),5>
4663  <(1,2),3>      | <(5,1),3>
4664  <(1,2),3>      | <(1,2),3>
4665  <(100,200),10> | <(100,200),10>
4666  <(100,1),115>  | <(100,1),115>
4667  <(3,5),0>      | <(3,5),0>
4668 (9 rows)
4670 -- Area not equal with circle
4671 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 != c2.f1;
4672        f1       |       f1       
4673 ----------------+----------------
4674  <(5,1),3>      | <(1,2),100>
4675  <(5,1),3>      | <(1,3),5>
4676  <(5,1),3>      | <(100,200),10>
4677  <(5,1),3>      | <(100,1),115>
4678  <(5,1),3>      | <(3,5),0>
4679  <(1,2),100>    | <(5,1),3>
4680  <(1,2),100>    | <(1,3),5>
4681  <(1,2),100>    | <(1,2),3>
4682  <(1,2),100>    | <(100,200),10>
4683  <(1,2),100>    | <(100,1),115>
4684  <(1,2),100>    | <(3,5),0>
4685  <(1,3),5>      | <(5,1),3>
4686  <(1,3),5>      | <(1,2),100>
4687  <(1,3),5>      | <(1,2),3>
4688  <(1,3),5>      | <(100,200),10>
4689  <(1,3),5>      | <(100,1),115>
4690  <(1,3),5>      | <(3,5),0>
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  <(1,2),3>      | <(3,5),0>
4696  <(100,200),10> | <(5,1),3>
4697  <(100,200),10> | <(1,2),100>
4698  <(100,200),10> | <(1,3),5>
4699  <(100,200),10> | <(1,2),3>
4700  <(100,200),10> | <(100,1),115>
4701  <(100,200),10> | <(3,5),0>
4702  <(100,1),115>  | <(5,1),3>
4703  <(100,1),115>  | <(1,2),100>
4704  <(100,1),115>  | <(1,3),5>
4705  <(100,1),115>  | <(1,2),3>
4706  <(100,1),115>  | <(100,200),10>
4707  <(100,1),115>  | <(3,5),0>
4708  <(3,5),0>      | <(5,1),3>
4709  <(3,5),0>      | <(1,2),100>
4710  <(3,5),0>      | <(1,3),5>
4711  <(3,5),0>      | <(1,2),3>
4712  <(3,5),0>      | <(100,200),10>
4713  <(3,5),0>      | <(100,1),115>
4714 (40 rows)
4716 -- Area less than circle
4717 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
4718        f1       |       f1       
4719 ----------------+----------------
4720  <(5,1),3>      | <(1,2),100>
4721  <(5,1),3>      | <(1,3),5>
4722  <(5,1),3>      | <(100,200),10>
4723  <(5,1),3>      | <(100,1),115>
4724  <(1,2),100>    | <(100,1),115>
4725  <(1,3),5>      | <(1,2),100>
4726  <(1,3),5>      | <(100,200),10>
4727  <(1,3),5>      | <(100,1),115>
4728  <(1,2),3>      | <(1,2),100>
4729  <(1,2),3>      | <(1,3),5>
4730  <(1,2),3>      | <(100,200),10>
4731  <(1,2),3>      | <(100,1),115>
4732  <(100,200),10> | <(1,2),100>
4733  <(100,200),10> | <(100,1),115>
4734  <(3,5),0>      | <(5,1),3>
4735  <(3,5),0>      | <(1,2),100>
4736  <(3,5),0>      | <(1,3),5>
4737  <(3,5),0>      | <(1,2),3>
4738  <(3,5),0>      | <(100,200),10>
4739  <(3,5),0>      | <(100,1),115>
4740 (20 rows)
4742 -- Area greater than circle
4743 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 > c2.f1;
4744        f1       |       f1       
4745 ----------------+----------------
4746  <(5,1),3>      | <(3,5),0>
4747  <(1,2),100>    | <(5,1),3>
4748  <(1,2),100>    | <(1,3),5>
4749  <(1,2),100>    | <(1,2),3>
4750  <(1,2),100>    | <(100,200),10>
4751  <(1,2),100>    | <(3,5),0>
4752  <(1,3),5>      | <(5,1),3>
4753  <(1,3),5>      | <(1,2),3>
4754  <(1,3),5>      | <(3,5),0>
4755  <(1,2),3>      | <(3,5),0>
4756  <(100,200),10> | <(5,1),3>
4757  <(100,200),10> | <(1,3),5>
4758  <(100,200),10> | <(1,2),3>
4759  <(100,200),10> | <(3,5),0>
4760  <(100,1),115>  | <(5,1),3>
4761  <(100,1),115>  | <(1,2),100>
4762  <(100,1),115>  | <(1,3),5>
4763  <(100,1),115>  | <(1,2),3>
4764  <(100,1),115>  | <(100,200),10>
4765  <(100,1),115>  | <(3,5),0>
4766 (20 rows)
4768 -- Area less than or equal circle
4769 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <= c2.f1;
4770        f1       |       f1       
4771 ----------------+----------------
4772  <(5,1),3>      | <(5,1),3>
4773  <(5,1),3>      | <(1,2),100>
4774  <(5,1),3>      | <(1,3),5>
4775  <(5,1),3>      | <(1,2),3>
4776  <(5,1),3>      | <(100,200),10>
4777  <(5,1),3>      | <(100,1),115>
4778  <(1,2),100>    | <(1,2),100>
4779  <(1,2),100>    | <(100,1),115>
4780  <(1,3),5>      | <(1,2),100>
4781  <(1,3),5>      | <(1,3),5>
4782  <(1,3),5>      | <(100,200),10>
4783  <(1,3),5>      | <(100,1),115>
4784  <(1,2),3>      | <(5,1),3>
4785  <(1,2),3>      | <(1,2),100>
4786  <(1,2),3>      | <(1,3),5>
4787  <(1,2),3>      | <(1,2),3>
4788  <(1,2),3>      | <(100,200),10>
4789  <(1,2),3>      | <(100,1),115>
4790  <(100,200),10> | <(1,2),100>
4791  <(100,200),10> | <(100,200),10>
4792  <(100,200),10> | <(100,1),115>
4793  <(100,1),115>  | <(100,1),115>
4794  <(3,5),0>      | <(5,1),3>
4795  <(3,5),0>      | <(1,2),100>
4796  <(3,5),0>      | <(1,3),5>
4797  <(3,5),0>      | <(1,2),3>
4798  <(3,5),0>      | <(100,200),10>
4799  <(3,5),0>      | <(100,1),115>
4800  <(3,5),0>      | <(3,5),0>
4801 (29 rows)
4803 -- Area greater than or equal circle
4804 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >= c2.f1;
4805        f1       |       f1       
4806 ----------------+----------------
4807  <(5,1),3>      | <(5,1),3>
4808  <(5,1),3>      | <(1,2),3>
4809  <(5,1),3>      | <(3,5),0>
4810  <(1,2),100>    | <(5,1),3>
4811  <(1,2),100>    | <(1,2),100>
4812  <(1,2),100>    | <(1,3),5>
4813  <(1,2),100>    | <(1,2),3>
4814  <(1,2),100>    | <(100,200),10>
4815  <(1,2),100>    | <(3,5),0>
4816  <(1,3),5>      | <(5,1),3>
4817  <(1,3),5>      | <(1,3),5>
4818  <(1,3),5>      | <(1,2),3>
4819  <(1,3),5>      | <(3,5),0>
4820  <(1,2),3>      | <(5,1),3>
4821  <(1,2),3>      | <(1,2),3>
4822  <(1,2),3>      | <(3,5),0>
4823  <(100,200),10> | <(5,1),3>
4824  <(100,200),10> | <(1,3),5>
4825  <(100,200),10> | <(1,2),3>
4826  <(100,200),10> | <(100,200),10>
4827  <(100,200),10> | <(3,5),0>
4828  <(100,1),115>  | <(5,1),3>
4829  <(100,1),115>  | <(1,2),100>
4830  <(100,1),115>  | <(1,3),5>
4831  <(100,1),115>  | <(1,2),3>
4832  <(100,1),115>  | <(100,200),10>
4833  <(100,1),115>  | <(100,1),115>
4834  <(100,1),115>  | <(3,5),0>
4835  <(3,5),0>      | <(3,5),0>
4836 (29 rows)
4838 -- Area less than circle
4839 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
4840        f1       |       f1       
4841 ----------------+----------------
4842  <(5,1),3>      | <(1,2),100>
4843  <(5,1),3>      | <(1,3),5>
4844  <(5,1),3>      | <(100,200),10>
4845  <(5,1),3>      | <(100,1),115>
4846  <(1,2),100>    | <(100,1),115>
4847  <(1,3),5>      | <(1,2),100>
4848  <(1,3),5>      | <(100,200),10>
4849  <(1,3),5>      | <(100,1),115>
4850  <(1,2),3>      | <(1,2),100>
4851  <(1,2),3>      | <(1,3),5>
4852  <(1,2),3>      | <(100,200),10>
4853  <(1,2),3>      | <(100,1),115>
4854  <(100,200),10> | <(1,2),100>
4855  <(100,200),10> | <(100,1),115>
4856  <(3,5),0>      | <(5,1),3>
4857  <(3,5),0>      | <(1,2),100>
4858  <(3,5),0>      | <(1,3),5>
4859  <(3,5),0>      | <(1,2),3>
4860  <(3,5),0>      | <(100,200),10>
4861  <(3,5),0>      | <(100,1),115>
4862 (20 rows)
4864 -- Area greater than circle
4865 SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
4866        f1       |       f1       
4867 ----------------+----------------
4868  <(5,1),3>      | <(1,2),100>
4869  <(5,1),3>      | <(1,3),5>
4870  <(5,1),3>      | <(100,200),10>
4871  <(5,1),3>      | <(100,1),115>
4872  <(1,2),100>    | <(100,1),115>
4873  <(1,3),5>      | <(1,2),100>
4874  <(1,3),5>      | <(100,200),10>
4875  <(1,3),5>      | <(100,1),115>
4876  <(1,2),3>      | <(1,2),100>
4877  <(1,2),3>      | <(1,3),5>
4878  <(1,2),3>      | <(100,200),10>
4879  <(1,2),3>      | <(100,1),115>
4880  <(100,200),10> | <(1,2),100>
4881  <(100,200),10> | <(100,1),115>
4882  <(3,5),0>      | <(5,1),3>
4883  <(3,5),0>      | <(1,2),100>
4884  <(3,5),0>      | <(1,3),5>
4885  <(3,5),0>      | <(1,2),3>
4886  <(3,5),0>      | <(100,200),10>
4887  <(3,5),0>      | <(100,1),115>
4888 (20 rows)
4890 -- Add point
4891 SELECT c.f1, p.f1, c.f1 + p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
4892        f1       |        f1         |        ?column?         
4893 ----------------+-------------------+-------------------------
4894  <(5,1),3>      | (0,0)             | <(5,1),3>
4895  <(1,2),100>    | (0,0)             | <(1,2),100>
4896  <(1,3),5>      | (0,0)             | <(1,3),5>
4897  <(1,2),3>      | (0,0)             | <(1,2),3>
4898  <(100,200),10> | (0,0)             | <(100,200),10>
4899  <(100,1),115>  | (0,0)             | <(100,1),115>
4900  <(3,5),0>      | (0,0)             | <(3,5),0>
4901  <(3,5),NaN>    | (0,0)             | <(3,5),NaN>
4902  <(5,1),3>      | (-10,0)           | <(-5,1),3>
4903  <(1,2),100>    | (-10,0)           | <(-9,2),100>
4904  <(1,3),5>      | (-10,0)           | <(-9,3),5>
4905  <(1,2),3>      | (-10,0)           | <(-9,2),3>
4906  <(100,200),10> | (-10,0)           | <(90,200),10>
4907  <(100,1),115>  | (-10,0)           | <(90,1),115>
4908  <(3,5),0>      | (-10,0)           | <(-7,5),0>
4909  <(3,5),NaN>    | (-10,0)           | <(-7,5),NaN>
4910  <(5,1),3>      | (-3,4)            | <(2,5),3>
4911  <(1,2),100>    | (-3,4)            | <(-2,6),100>
4912  <(1,3),5>      | (-3,4)            | <(-2,7),5>
4913  <(1,2),3>      | (-3,4)            | <(-2,6),3>
4914  <(100,200),10> | (-3,4)            | <(97,204),10>
4915  <(100,1),115>  | (-3,4)            | <(97,5),115>
4916  <(3,5),0>      | (-3,4)            | <(0,9),0>
4917  <(3,5),NaN>    | (-3,4)            | <(0,9),NaN>
4918  <(5,1),3>      | (5.1,34.5)        | <(10.1,35.5),3>
4919  <(1,2),100>    | (5.1,34.5)        | <(6.1,36.5),100>
4920  <(1,3),5>      | (5.1,34.5)        | <(6.1,37.5),5>
4921  <(1,2),3>      | (5.1,34.5)        | <(6.1,36.5),3>
4922  <(100,200),10> | (5.1,34.5)        | <(105.1,234.5),10>
4923  <(100,1),115>  | (5.1,34.5)        | <(105.1,35.5),115>
4924  <(3,5),0>      | (5.1,34.5)        | <(8.1,39.5),0>
4925  <(3,5),NaN>    | (5.1,34.5)        | <(8.1,39.5),NaN>
4926  <(5,1),3>      | (-5,-12)          | <(0,-11),3>
4927  <(1,2),100>    | (-5,-12)          | <(-4,-10),100>
4928  <(1,3),5>      | (-5,-12)          | <(-4,-9),5>
4929  <(1,2),3>      | (-5,-12)          | <(-4,-10),3>
4930  <(100,200),10> | (-5,-12)          | <(95,188),10>
4931  <(100,1),115>  | (-5,-12)          | <(95,-11),115>
4932  <(3,5),0>      | (-5,-12)          | <(-2,-7),0>
4933  <(3,5),NaN>    | (-5,-12)          | <(-2,-7),NaN>
4934  <(5,1),3>      | (1e-300,-1e-300)  | <(5,1),3>
4935  <(1,2),100>    | (1e-300,-1e-300)  | <(1,2),100>
4936  <(1,3),5>      | (1e-300,-1e-300)  | <(1,3),5>
4937  <(1,2),3>      | (1e-300,-1e-300)  | <(1,2),3>
4938  <(100,200),10> | (1e-300,-1e-300)  | <(100,200),10>
4939  <(100,1),115>  | (1e-300,-1e-300)  | <(100,1),115>
4940  <(3,5),0>      | (1e-300,-1e-300)  | <(3,5),0>
4941  <(3,5),NaN>    | (1e-300,-1e-300)  | <(3,5),NaN>
4942  <(5,1),3>      | (1e+300,Infinity) | <(1e+300,Infinity),3>
4943  <(1,2),100>    | (1e+300,Infinity) | <(1e+300,Infinity),100>
4944  <(1,3),5>      | (1e+300,Infinity) | <(1e+300,Infinity),5>
4945  <(1,2),3>      | (1e+300,Infinity) | <(1e+300,Infinity),3>
4946  <(100,200),10> | (1e+300,Infinity) | <(1e+300,Infinity),10>
4947  <(100,1),115>  | (1e+300,Infinity) | <(1e+300,Infinity),115>
4948  <(3,5),0>      | (1e+300,Infinity) | <(1e+300,Infinity),0>
4949  <(3,5),NaN>    | (1e+300,Infinity) | <(1e+300,Infinity),NaN>
4950  <(5,1),3>      | (Infinity,1e+300) | <(Infinity,1e+300),3>
4951  <(1,2),100>    | (Infinity,1e+300) | <(Infinity,1e+300),100>
4952  <(1,3),5>      | (Infinity,1e+300) | <(Infinity,1e+300),5>
4953  <(1,2),3>      | (Infinity,1e+300) | <(Infinity,1e+300),3>
4954  <(100,200),10> | (Infinity,1e+300) | <(Infinity,1e+300),10>
4955  <(100,1),115>  | (Infinity,1e+300) | <(Infinity,1e+300),115>
4956  <(3,5),0>      | (Infinity,1e+300) | <(Infinity,1e+300),0>
4957  <(3,5),NaN>    | (Infinity,1e+300) | <(Infinity,1e+300),NaN>
4958  <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),3>
4959  <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),100>
4960  <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),5>
4961  <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),3>
4962  <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),10>
4963  <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),115>
4964  <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),0>
4965  <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
4966  <(5,1),3>      | (10,10)           | <(15,11),3>
4967  <(1,2),100>    | (10,10)           | <(11,12),100>
4968  <(1,3),5>      | (10,10)           | <(11,13),5>
4969  <(1,2),3>      | (10,10)           | <(11,12),3>
4970  <(100,200),10> | (10,10)           | <(110,210),10>
4971  <(100,1),115>  | (10,10)           | <(110,11),115>
4972  <(3,5),0>      | (10,10)           | <(13,15),0>
4973  <(3,5),NaN>    | (10,10)           | <(13,15),NaN>
4974 (80 rows)
4976 -- Subtract point
4977 SELECT c.f1, p.f1, c.f1 - p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
4978        f1       |        f1         |         ?column?          
4979 ----------------+-------------------+---------------------------
4980  <(5,1),3>      | (0,0)             | <(5,1),3>
4981  <(1,2),100>    | (0,0)             | <(1,2),100>
4982  <(1,3),5>      | (0,0)             | <(1,3),5>
4983  <(1,2),3>      | (0,0)             | <(1,2),3>
4984  <(100,200),10> | (0,0)             | <(100,200),10>
4985  <(100,1),115>  | (0,0)             | <(100,1),115>
4986  <(3,5),0>      | (0,0)             | <(3,5),0>
4987  <(3,5),NaN>    | (0,0)             | <(3,5),NaN>
4988  <(5,1),3>      | (-10,0)           | <(15,1),3>
4989  <(1,2),100>    | (-10,0)           | <(11,2),100>
4990  <(1,3),5>      | (-10,0)           | <(11,3),5>
4991  <(1,2),3>      | (-10,0)           | <(11,2),3>
4992  <(100,200),10> | (-10,0)           | <(110,200),10>
4993  <(100,1),115>  | (-10,0)           | <(110,1),115>
4994  <(3,5),0>      | (-10,0)           | <(13,5),0>
4995  <(3,5),NaN>    | (-10,0)           | <(13,5),NaN>
4996  <(5,1),3>      | (-3,4)            | <(8,-3),3>
4997  <(1,2),100>    | (-3,4)            | <(4,-2),100>
4998  <(1,3),5>      | (-3,4)            | <(4,-1),5>
4999  <(1,2),3>      | (-3,4)            | <(4,-2),3>
5000  <(100,200),10> | (-3,4)            | <(103,196),10>
5001  <(100,1),115>  | (-3,4)            | <(103,-3),115>
5002  <(3,5),0>      | (-3,4)            | <(6,1),0>
5003  <(3,5),NaN>    | (-3,4)            | <(6,1),NaN>
5004  <(5,1),3>      | (5.1,34.5)        | <(-0.1,-33.5),3>
5005  <(1,2),100>    | (5.1,34.5)        | <(-4.1,-32.5),100>
5006  <(1,3),5>      | (5.1,34.5)        | <(-4.1,-31.5),5>
5007  <(1,2),3>      | (5.1,34.5)        | <(-4.1,-32.5),3>
5008  <(100,200),10> | (5.1,34.5)        | <(94.9,165.5),10>
5009  <(100,1),115>  | (5.1,34.5)        | <(94.9,-33.5),115>
5010  <(3,5),0>      | (5.1,34.5)        | <(-2.1,-29.5),0>
5011  <(3,5),NaN>    | (5.1,34.5)        | <(-2.1,-29.5),NaN>
5012  <(5,1),3>      | (-5,-12)          | <(10,13),3>
5013  <(1,2),100>    | (-5,-12)          | <(6,14),100>
5014  <(1,3),5>      | (-5,-12)          | <(6,15),5>
5015  <(1,2),3>      | (-5,-12)          | <(6,14),3>
5016  <(100,200),10> | (-5,-12)          | <(105,212),10>
5017  <(100,1),115>  | (-5,-12)          | <(105,13),115>
5018  <(3,5),0>      | (-5,-12)          | <(8,17),0>
5019  <(3,5),NaN>    | (-5,-12)          | <(8,17),NaN>
5020  <(5,1),3>      | (1e-300,-1e-300)  | <(5,1),3>
5021  <(1,2),100>    | (1e-300,-1e-300)  | <(1,2),100>
5022  <(1,3),5>      | (1e-300,-1e-300)  | <(1,3),5>
5023  <(1,2),3>      | (1e-300,-1e-300)  | <(1,2),3>
5024  <(100,200),10> | (1e-300,-1e-300)  | <(100,200),10>
5025  <(100,1),115>  | (1e-300,-1e-300)  | <(100,1),115>
5026  <(3,5),0>      | (1e-300,-1e-300)  | <(3,5),0>
5027  <(3,5),NaN>    | (1e-300,-1e-300)  | <(3,5),NaN>
5028  <(5,1),3>      | (1e+300,Infinity) | <(-1e+300,-Infinity),3>
5029  <(1,2),100>    | (1e+300,Infinity) | <(-1e+300,-Infinity),100>
5030  <(1,3),5>      | (1e+300,Infinity) | <(-1e+300,-Infinity),5>
5031  <(1,2),3>      | (1e+300,Infinity) | <(-1e+300,-Infinity),3>
5032  <(100,200),10> | (1e+300,Infinity) | <(-1e+300,-Infinity),10>
5033  <(100,1),115>  | (1e+300,Infinity) | <(-1e+300,-Infinity),115>
5034  <(3,5),0>      | (1e+300,Infinity) | <(-1e+300,-Infinity),0>
5035  <(3,5),NaN>    | (1e+300,Infinity) | <(-1e+300,-Infinity),NaN>
5036  <(5,1),3>      | (Infinity,1e+300) | <(-Infinity,-1e+300),3>
5037  <(1,2),100>    | (Infinity,1e+300) | <(-Infinity,-1e+300),100>
5038  <(1,3),5>      | (Infinity,1e+300) | <(-Infinity,-1e+300),5>
5039  <(1,2),3>      | (Infinity,1e+300) | <(-Infinity,-1e+300),3>
5040  <(100,200),10> | (Infinity,1e+300) | <(-Infinity,-1e+300),10>
5041  <(100,1),115>  | (Infinity,1e+300) | <(-Infinity,-1e+300),115>
5042  <(3,5),0>      | (Infinity,1e+300) | <(-Infinity,-1e+300),0>
5043  <(3,5),NaN>    | (Infinity,1e+300) | <(-Infinity,-1e+300),NaN>
5044  <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),3>
5045  <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),100>
5046  <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),5>
5047  <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),3>
5048  <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),10>
5049  <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),115>
5050  <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),0>
5051  <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
5052  <(5,1),3>      | (10,10)           | <(-5,-9),3>
5053  <(1,2),100>    | (10,10)           | <(-9,-8),100>
5054  <(1,3),5>      | (10,10)           | <(-9,-7),5>
5055  <(1,2),3>      | (10,10)           | <(-9,-8),3>
5056  <(100,200),10> | (10,10)           | <(90,190),10>
5057  <(100,1),115>  | (10,10)           | <(90,-9),115>
5058  <(3,5),0>      | (10,10)           | <(-7,-5),0>
5059  <(3,5),NaN>    | (10,10)           | <(-7,-5),NaN>
5060 (80 rows)
5062 -- Multiply with point
5063 SELECT c.f1, p.f1, c.f1 * p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
5064        f1       |        f1         |                  ?column?                  
5065 ----------------+-------------------+--------------------------------------------
5066  <(5,1),3>      | (0,0)             | <(0,0),0>
5067  <(1,2),100>    | (0,0)             | <(0,0),0>
5068  <(1,3),5>      | (0,0)             | <(0,0),0>
5069  <(1,2),3>      | (0,0)             | <(0,0),0>
5070  <(100,200),10> | (0,0)             | <(0,0),0>
5071  <(100,1),115>  | (0,0)             | <(0,0),0>
5072  <(3,5),0>      | (0,0)             | <(0,0),0>
5073  <(3,5),NaN>    | (0,0)             | <(0,0),NaN>
5074  <(5,1),3>      | (-10,0)           | <(-50,-10),30>
5075  <(1,2),100>    | (-10,0)           | <(-10,-20),1000>
5076  <(1,3),5>      | (-10,0)           | <(-10,-30),50>
5077  <(1,2),3>      | (-10,0)           | <(-10,-20),30>
5078  <(100,200),10> | (-10,0)           | <(-1000,-2000),100>
5079  <(100,1),115>  | (-10,0)           | <(-1000,-10),1150>
5080  <(3,5),0>      | (-10,0)           | <(-30,-50),0>
5081  <(3,5),NaN>    | (-10,0)           | <(-30,-50),NaN>
5082  <(5,1),3>      | (-3,4)            | <(-19,17),15>
5083  <(1,2),100>    | (-3,4)            | <(-11,-2),500>
5084  <(1,3),5>      | (-3,4)            | <(-15,-5),25>
5085  <(1,2),3>      | (-3,4)            | <(-11,-2),15>
5086  <(100,200),10> | (-3,4)            | <(-1100,-200),50>
5087  <(100,1),115>  | (-3,4)            | <(-304,397),575>
5088  <(3,5),0>      | (-3,4)            | <(-29,-3),0>
5089  <(3,5),NaN>    | (-3,4)            | <(-29,-3),NaN>
5090  <(5,1),3>      | (5.1,34.5)        | <(-9,177.6),104.624758064>
5091  <(1,2),100>    | (5.1,34.5)        | <(-63.9,44.7),3487.49193547>
5092  <(1,3),5>      | (5.1,34.5)        | <(-98.4,49.8),174.374596774>
5093  <(1,2),3>      | (5.1,34.5)        | <(-63.9,44.7),104.624758064>
5094  <(100,200),10> | (5.1,34.5)        | <(-6390,4470),348.749193547>
5095  <(100,1),115>  | (5.1,34.5)        | <(475.5,3455.1),4010.6157258>
5096  <(3,5),0>      | (5.1,34.5)        | <(-157.2,129),0>
5097  <(3,5),NaN>    | (5.1,34.5)        | <(-157.2,129),NaN>
5098  <(5,1),3>      | (-5,-12)          | <(-13,-65),39>
5099  <(1,2),100>    | (-5,-12)          | <(19,-22),1300>
5100  <(1,3),5>      | (-5,-12)          | <(31,-27),65>
5101  <(1,2),3>      | (-5,-12)          | <(19,-22),39>
5102  <(100,200),10> | (-5,-12)          | <(1900,-2200),130>
5103  <(100,1),115>  | (-5,-12)          | <(-488,-1205),1495>
5104  <(3,5),0>      | (-5,-12)          | <(45,-61),0>
5105  <(3,5),NaN>    | (-5,-12)          | <(45,-61),NaN>
5106  <(5,1),3>      | (1e-300,-1e-300)  | <(6e-300,-4e-300),4.24264068712e-300>
5107  <(1,2),100>    | (1e-300,-1e-300)  | <(3e-300,1e-300),1.41421356237e-298>
5108  <(1,3),5>      | (1e-300,-1e-300)  | <(4e-300,2e-300),7.07106781187e-300>
5109  <(1,2),3>      | (1e-300,-1e-300)  | <(3e-300,1e-300),4.24264068712e-300>
5110  <(100,200),10> | (1e-300,-1e-300)  | <(3e-298,1e-298),1.41421356237e-299>
5111  <(100,1),115>  | (1e-300,-1e-300)  | <(1.01e-298,-9.9e-299),1.62634559673e-298>
5112  <(3,5),0>      | (1e-300,-1e-300)  | <(8e-300,2e-300),0>
5113  <(3,5),NaN>    | (1e-300,-1e-300)  | <(8e-300,2e-300),NaN>
5114  <(5,1),3>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5115  <(1,2),100>    | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5116  <(1,3),5>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5117  <(1,2),3>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5118  <(100,200),10> | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5119  <(100,1),115>  | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
5120  <(3,5),0>      | (1e+300,Infinity) | <(-Infinity,Infinity),NaN>
5121  <(3,5),NaN>    | (1e+300,Infinity) | <(-Infinity,Infinity),NaN>
5122  <(5,1),3>      | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5123  <(1,2),100>    | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5124  <(1,3),5>      | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5125  <(1,2),3>      | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5126  <(100,200),10> | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5127  <(100,1),115>  | (Infinity,1e+300) | <(Infinity,Infinity),Infinity>
5128  <(3,5),0>      | (Infinity,1e+300) | <(Infinity,Infinity),NaN>
5129  <(3,5),NaN>    | (Infinity,1e+300) | <(Infinity,Infinity),NaN>
5130  <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),NaN>
5131  <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),NaN>
5132  <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),NaN>
5133  <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),NaN>
5134  <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),NaN>
5135  <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),NaN>
5136  <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),NaN>
5137  <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
5138  <(5,1),3>      | (10,10)           | <(40,60),42.4264068712>
5139  <(1,2),100>    | (10,10)           | <(-10,30),1414.21356237>
5140  <(1,3),5>      | (10,10)           | <(-20,40),70.7106781187>
5141  <(1,2),3>      | (10,10)           | <(-10,30),42.4264068712>
5142  <(100,200),10> | (10,10)           | <(-1000,3000),141.421356237>
5143  <(100,1),115>  | (10,10)           | <(990,1010),1626.34559673>
5144  <(3,5),0>      | (10,10)           | <(-20,80),0>
5145  <(3,5),NaN>    | (10,10)           | <(-20,80),NaN>
5146 (80 rows)
5148 -- Divide by point
5149 SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
5150        f1       |     f1     |                       ?column?                       
5151 ----------------+------------+------------------------------------------------------
5152  <(5,1),3>      | (5.1,34.5) | <(0.0493315573973,-0.137635045138),0.0860217042937>
5153  <(5,1),3>      | (10,10)    | <(0.3,-0.2),0.212132034356>
5154  <(1,2),100>    | (5.1,34.5) | <(0.0609244733856,-0.0199792807459),2.86739014312>
5155  <(1,2),100>    | (10,10)    | <(0.15,0.05),7.07106781187>
5156  <(1,3),5>      | (5.1,34.5) | <(0.0892901188891,-0.0157860983671),0.143369507156>
5157  <(1,3),5>      | (10,10)    | <(0.2,0.1),0.353553390593>
5158  <(1,2),3>      | (5.1,34.5) | <(0.0609244733856,-0.0199792807459),0.0860217042937>
5159  <(1,2),3>      | (10,10)    | <(0.15,0.05),0.212132034356>
5160  <(100,200),10> | (5.1,34.5) | <(6.09244733856,-1.99792807459),0.286739014312>
5161  <(100,200),10> | (10,10)    | <(15,5),0.707106781187>
5162  <(100,1),115>  | (5.1,34.5) | <(0.44768388338,-2.83237136796),3.29749866459>
5163  <(100,1),115>  | (10,10)    | <(5.05,-4.95),8.13172798365>
5164  <(3,5),0>      | (5.1,34.5) | <(0.154407774653,-0.0641310246164),0>
5165  <(3,5),0>      | (10,10)    | <(0.4,0.1),0>
5166  <(3,5),NaN>    | (5.1,34.5) | <(0.154407774653,-0.0641310246164),NaN>
5167  <(3,5),NaN>    | (10,10)    | <(0.4,0.1),NaN>
5168 (16 rows)
5170 -- Overflow error
5171 SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] > 1000;
5172 ERROR:  value out of range: overflow
5173 -- Division by 0 error
5174 SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1 ~= '(0,0)'::point;
5175 ERROR:  division by zero
5176 -- Distance to polygon
5177 SELECT c.f1, p.f1, c.f1 <-> p.f1 FROM CIRCLE_TBL c, POLYGON_TBL p;
5178        f1       |             f1             |    ?column?    
5179 ----------------+----------------------------+----------------
5180  <(5,1),3>      | ((2,0),(2,4),(0,0))        |              0
5181  <(5,1),3>      | ((3,1),(3,3),(1,0))        |              0
5182  <(5,1),3>      | ((1,2),(3,4),(5,6),(7,8))  | 0.535533905933
5183  <(5,1),3>      | ((7,8),(5,6),(3,4),(1,2))  | 0.535533905933
5184  <(5,1),3>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
5185  <(5,1),3>      | ((0,0))                    |  2.09901951359
5186  <(5,1),3>      | ((0,1),(0,1))              |              2
5187  <(1,2),100>    | ((2,0),(2,4),(0,0))        |              0
5188  <(1,2),100>    | ((3,1),(3,3),(1,0))        |              0
5189  <(1,2),100>    | ((1,2),(3,4),(5,6),(7,8))  |              0
5190  <(1,2),100>    | ((7,8),(5,6),(3,4),(1,2))  |              0
5191  <(1,2),100>    | ((1,2),(7,8),(5,6),(3,-4)) |              0
5192  <(1,2),100>    | ((0,0))                    |              0
5193  <(1,2),100>    | ((0,1),(0,1))              |              0
5194  <(1,3),5>      | ((2,0),(2,4),(0,0))        |              0
5195  <(1,3),5>      | ((3,1),(3,3),(1,0))        |              0
5196  <(1,3),5>      | ((1,2),(3,4),(5,6),(7,8))  |              0
5197  <(1,3),5>      | ((7,8),(5,6),(3,4),(1,2))  |              0
5198  <(1,3),5>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
5199  <(1,3),5>      | ((0,0))                    |              0
5200  <(1,3),5>      | ((0,1),(0,1))              |              0
5201  <(1,2),3>      | ((2,0),(2,4),(0,0))        |              0
5202  <(1,2),3>      | ((3,1),(3,3),(1,0))        |              0
5203  <(1,2),3>      | ((1,2),(3,4),(5,6),(7,8))  |              0
5204  <(1,2),3>      | ((7,8),(5,6),(3,4),(1,2))  |              0
5205  <(1,2),3>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
5206  <(1,2),3>      | ((0,0))                    |              0
5207  <(1,2),3>      | ((0,1),(0,1))              |              0
5208  <(100,200),10> | ((2,0),(2,4),(0,0))        |  209.134661795
5209  <(100,200),10> | ((3,1),(3,3),(1,0))        |  209.585974051
5210  <(100,200),10> | ((1,2),(3,4),(5,6),(7,8))  |  203.337760371
5211  <(100,200),10> | ((7,8),(5,6),(3,4),(1,2))  |  203.337760371
5212  <(100,200),10> | ((1,2),(7,8),(5,6),(3,-4)) |  203.337760371
5213  <(100,200),10> | ((0,0))                    |   213.60679775
5214  <(100,200),10> | ((0,1),(0,1))              |  212.712819568
5215  <(100,1),115>  | ((2,0),(2,4),(0,0))        |              0
5216  <(100,1),115>  | ((3,1),(3,3),(1,0))        |              0
5217  <(100,1),115>  | ((1,2),(3,4),(5,6),(7,8))  |              0
5218  <(100,1),115>  | ((7,8),(5,6),(3,4),(1,2))  |              0
5219  <(100,1),115>  | ((1,2),(7,8),(5,6),(3,-4)) |              0
5220  <(100,1),115>  | ((0,0))                    |              0
5221  <(100,1),115>  | ((0,1),(0,1))              |              0
5222  <(3,5),0>      | ((2,0),(2,4),(0,0))        |  1.41421356237
5223  <(3,5),0>      | ((3,1),(3,3),(1,0))        |              2
5224  <(3,5),0>      | ((1,2),(3,4),(5,6),(7,8))  | 0.707106781187
5225  <(3,5),0>      | ((7,8),(5,6),(3,4),(1,2))  | 0.707106781187
5226  <(3,5),0>      | ((1,2),(7,8),(5,6),(3,-4)) | 0.707106781187
5227  <(3,5),0>      | ((0,0))                    |  5.83095189485
5228  <(3,5),0>      | ((0,1),(0,1))              |              5
5229  <(3,5),NaN>    | ((2,0),(2,4),(0,0))        |            NaN
5230  <(3,5),NaN>    | ((3,1),(3,3),(1,0))        |            NaN
5231  <(3,5),NaN>    | ((1,2),(3,4),(5,6),(7,8))  |            NaN
5232  <(3,5),NaN>    | ((7,8),(5,6),(3,4),(1,2))  |            NaN
5233  <(3,5),NaN>    | ((1,2),(7,8),(5,6),(3,-4)) |            NaN
5234  <(3,5),NaN>    | ((0,0))                    |            NaN
5235  <(3,5),NaN>    | ((0,1),(0,1))              |            NaN
5236 (56 rows)
5238 -- Check index behavior for circles
5239 CREATE INDEX gcircleind ON circle_tbl USING gist (f1);
5240 SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1)
5241     ORDER BY area(f1);
5242       f1       
5243 ---------------
5244  <(1,2),3>
5245  <(1,3),5>
5246  <(1,2),100>
5247  <(100,1),115>
5248 (4 rows)
5250 EXPLAIN (COSTS OFF)
5251 SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1)
5252     ORDER BY area(f1);
5253                   QUERY PLAN                  
5254 ----------------------------------------------
5255  Sort
5256    Sort Key: (area(f1))
5257    ->  Seq Scan on circle_tbl
5258          Filter: (f1 && '<(1,-2),1>'::circle)
5259 (4 rows)
5261 SELECT * FROM circle_tbl WHERE f1 && circle(point(1,-2), 1)
5262     ORDER BY area(f1);
5263       f1       
5264 ---------------
5265  <(1,2),3>
5266  <(1,3),5>
5267  <(1,2),100>
5268  <(100,1),115>
5269 (4 rows)
5271 -- Check index behavior for polygons
5272 CREATE INDEX gpolygonind ON polygon_tbl USING gist (f1);
5273 SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
5274     ORDER BY (poly_center(f1))[0];
5275          f1          
5276 ---------------------
5277  ((2,0),(2,4),(0,0))
5278 (1 row)
5280 EXPLAIN (COSTS OFF)
5281 SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
5282     ORDER BY (poly_center(f1))[0];
5283                        QUERY PLAN                       
5284 --------------------------------------------------------
5285  Sort
5286    Sort Key: ((poly_center(f1))[0])
5287    ->  Seq Scan on polygon_tbl
5288          Filter: (f1 @> '((1,1),(2,2),(2,1))'::polygon)
5289 (4 rows)
5291 SELECT * FROM polygon_tbl WHERE f1 @> '((1,1),(2,2),(2,1))'::polygon
5292     ORDER BY (poly_center(f1))[0];
5293          f1          
5294 ---------------------
5295  ((2,0),(2,4),(0,0))
5296 (1 row)
5298 -- test non-error-throwing API for some core types
5299 SELECT pg_input_is_valid('(1', 'circle');
5300  pg_input_is_valid 
5301 -------------------
5303 (1 row)
5305 SELECT * FROM pg_input_error_info('1,', 'circle');
5306                   message                   | detail | hint | sql_error_code 
5307 --------------------------------------------+--------+------+----------------
5308  invalid input syntax for type circle: "1," |        |      | 22P02
5309 (1 row)
5311 SELECT pg_input_is_valid('(1,2),-1', 'circle');
5312  pg_input_is_valid 
5313 -------------------
5315 (1 row)
5317 SELECT * FROM pg_input_error_info('(1,2),-1', 'circle');
5318                      message                      | detail | hint | sql_error_code 
5319 --------------------------------------------------+--------+------+----------------
5320  invalid input syntax for type circle: "(1,2),-1" |        |      | 22P02
5321 (1 row)