From 3dee4e8b3dbfef57cc57fc721e7f1d7144d22658 Mon Sep 17 00:00:00 2001
From: Emre Hasegeli <emre@hasegeli.com>
Date: Tue, 24 Oct 2017 11:28:21 +0200
Subject: [PATCH 6/6] geo-tests-v03

Improve test coverage of geometric types

The tests for the geometric functions and operators were in sad state.
This commit increases test coverage of geo_ops.c significantly.  It
removes the alternative results to expect -0 on some platforms.  We
better try to return the same results on different platforms, but if we
can't we can add them back using the results from build farm.

The tests are added to geometric.sql file.  It is not clear where to
put them as there are many cross datatype operators.  Organising them
on a single file sorted by the left hand side of the operators appear
to be a simple solution.  We may take this further and remove the other
tests later.
---
 src/test/regress/expected/box.out          |   44 +-
 src/test/regress/expected/circle.out       |   39 +-
 src/test/regress/expected/create_index.out |   73 +-
 src/test/regress/expected/geometry.out     | 4879 ++++++++++++++++++++++++++--
 src/test/regress/expected/geometry_1.out   |  563 ----
 src/test/regress/expected/geometry_2.out   |  563 ----
 src/test/regress/expected/line.out         |  269 +-
 src/test/regress/expected/lseg.out         |   24 +-
 src/test/regress/expected/path.out         |   49 +-
 src/test/regress/expected/point.out        |  358 +-
 src/test/regress/expected/polygon.out      |  200 +-
 src/test/regress/sql/box.sql               |    9 +
 src/test/regress/sql/circle.sql            |   10 +-
 src/test/regress/sql/geometry.sql          |  400 ++-
 src/test/regress/sql/line.sql              |   78 +-
 src/test/regress/sql/lseg.sql              |    9 +-
 src/test/regress/sql/path.sql              |   22 +-
 src/test/regress/sql/point.sql             |   10 +
 src/test/regress/sql/polygon.sql           |   91 +-
 19 files changed, 5476 insertions(+), 2214 deletions(-)
 delete mode 100644 src/test/regress/expected/geometry_1.out
 delete mode 100644 src/test/regress/expected/geometry_2.out

diff --git a/src/test/regress/expected/box.out b/src/test/regress/expected/box.out
index 49af242c8c..998b52223c 100644
--- a/src/test/regress/expected/box.out
+++ b/src/test/regress/expected/box.out
@@ -11,92 +11,109 @@
 -- 1	| o-+-o
 --	|   |
 -- 0	+---+
 --
 --	0 1 2 3
 --
 -- boxes are specified by two points, given by four floats x1,y1,x2,y2
 CREATE TABLE BOX_TBL (f1 box);
 INSERT INTO BOX_TBL (f1) VALUES ('(2.0,2.0,0.0,0.0)');
 INSERT INTO BOX_TBL (f1) VALUES ('(1.0,1.0,3.0,3.0)');
+INSERT INTO BOX_TBL (f1) VALUES ('((-8, 2), (-2, -10))');
 -- degenerate cases where the box is a line or a point
 -- note that lines and points boxes all have zero area
 INSERT INTO BOX_TBL (f1) VALUES ('(2.5, 2.5, 2.5,3.5)');
 INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)');
 -- badly formatted box inputs
 INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)');
 ERROR:  invalid input syntax for type box: "(2.3, 4.5)"
 LINE 1: INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)');
                                          ^
+INSERT INTO BOX_TBL (f1) VALUES ('[1, 2, 3, 4)');
+ERROR:  invalid input syntax for type box: "[1, 2, 3, 4)"
+LINE 1: INSERT INTO BOX_TBL (f1) VALUES ('[1, 2, 3, 4)');
+                                         ^
+INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4]');
+ERROR:  invalid input syntax for type box: "(1, 2, 3, 4]"
+LINE 1: INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4]');
+                                         ^
+INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4) x');
+ERROR:  invalid input syntax for type box: "(1, 2, 3, 4) x"
+LINE 1: INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4) x');
+                                         ^
 INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
 ERROR:  invalid input syntax for type box: "asdfasdf(ad"
 LINE 1: INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
                                          ^
 SELECT '' AS four, * FROM BOX_TBL;
  four |         f1          
 ------+---------------------
       | (2,2),(0,0)
       | (3,3),(1,1)
+      | (-2,2),(-8,-10)
       | (2.5,3.5),(2.5,2.5)
       | (3,3),(3,3)
-(4 rows)
+(5 rows)
 
 SELECT '' AS four, b.*, area(b.f1) as barea
    FROM BOX_TBL b;
  four |         f1          | barea 
 ------+---------------------+-------
       | (2,2),(0,0)         |     4
       | (3,3),(1,1)         |     4
+      | (-2,2),(-8,-10)     |    72
       | (2.5,3.5),(2.5,2.5) |     0
       | (3,3),(3,3)         |     0
-(4 rows)
+(5 rows)
 
 -- overlap
 SELECT '' AS three, b.f1
    FROM BOX_TBL b
    WHERE b.f1 && box '(2.5,2.5,1.0,1.0)';
  three |         f1          
 -------+---------------------
        | (2,2),(0,0)
        | (3,3),(1,1)
        | (2.5,3.5),(2.5,2.5)
 (3 rows)
 
 -- left-or-overlap (x only)
 SELECT '' AS two, b1.*
    FROM BOX_TBL b1
    WHERE b1.f1 &< box '(2.0,2.0,2.5,2.5)';
  two |         f1          
 -----+---------------------
      | (2,2),(0,0)
+     | (-2,2),(-8,-10)
      | (2.5,3.5),(2.5,2.5)
-(2 rows)
+(3 rows)
 
 -- right-or-overlap (x only)
 SELECT '' AS two, b1.*
    FROM BOX_TBL b1
    WHERE b1.f1 &> box '(2.0,2.0,2.5,2.5)';
  two |         f1          
 -----+---------------------
      | (2.5,3.5),(2.5,2.5)
      | (3,3),(3,3)
 (2 rows)
 
 -- left of
 SELECT '' AS two, b.f1
    FROM BOX_TBL b
    WHERE b.f1 << box '(3.0,3.0,5.0,5.0)';
  two |         f1          
 -----+---------------------
      | (2,2),(0,0)
+     | (-2,2),(-8,-10)
      | (2.5,3.5),(2.5,2.5)
-(2 rows)
+(3 rows)
 
 -- area <=
 SELECT '' AS four, b.f1
    FROM BOX_TBL b
    WHERE b.f1 <= box '(3.0,3.0,5.0,5.0)';
  four |         f1          
 ------+---------------------
       | (2,2),(0,0)
       | (3,3),(1,1)
       | (2.5,3.5),(2.5,2.5)
@@ -120,47 +137,50 @@ SELECT '' AS two, b.f1
  two |     f1      
 -----+-------------
      | (2,2),(0,0)
      | (3,3),(1,1)
 (2 rows)
 
 -- area >
 SELECT '' AS two, b.f1
    FROM BOX_TBL b				-- zero area
    WHERE b.f1 > box '(3.5,3.0,4.5,3.0)';
- two |     f1      
------+-------------
+ two |       f1        
+-----+-----------------
      | (2,2),(0,0)
      | (3,3),(1,1)
-(2 rows)
+     | (-2,2),(-8,-10)
+(3 rows)
 
 -- area >=
 SELECT '' AS four, b.f1
    FROM BOX_TBL b				-- zero area
    WHERE b.f1 >= box '(3.5,3.0,4.5,3.0)';
  four |         f1          
 ------+---------------------
       | (2,2),(0,0)
       | (3,3),(1,1)
+      | (-2,2),(-8,-10)
       | (2.5,3.5),(2.5,2.5)
       | (3,3),(3,3)
-(4 rows)
+(5 rows)
 
 -- right of
 SELECT '' AS two, b.f1
    FROM BOX_TBL b
    WHERE box '(3.0,3.0,5.0,5.0)' >> b.f1;
  two |         f1          
 -----+---------------------
      | (2,2),(0,0)
+     | (-2,2),(-8,-10)
      | (2.5,3.5),(2.5,2.5)
-(2 rows)
+(3 rows)
 
 -- contained in
 SELECT '' AS three, b.f1
    FROM BOX_TBL b
    WHERE b.f1 <@ box '(0,0,3,3)';
  three |     f1      
 -------+-------------
        | (2,2),(0,0)
        | (3,3),(1,1)
        | (3,3),(3,3)
@@ -186,41 +206,43 @@ SELECT '' AS one, b.f1
      | (3,3),(1,1)
 (1 row)
 
 -- center of box, left unary operator
 SELECT '' AS four, @@(b1.f1) AS p
    FROM BOX_TBL b1;
  four |    p    
 ------+---------
       | (1,1)
       | (2,2)
+      | (-5,-4)
       | (2.5,3)
       | (3,3)
-(4 rows)
+(5 rows)
 
 -- wholly-contained
 SELECT '' AS one, b1.*, b2.*
    FROM BOX_TBL b1, BOX_TBL b2
    WHERE b1.f1 @> b2.f1 and not b1.f1 ~= b2.f1;
  one |     f1      |     f1      
 -----+-------------+-------------
      | (3,3),(1,1) | (3,3),(3,3)
 (1 row)
 
 SELECT '' AS four, height(f1), width(f1) FROM BOX_TBL;
  four | height | width 
 ------+--------+-------
       |      2 |     2
       |      2 |     2
+      |     12 |     6
       |      1 |     0
       |      0 |     0
-(4 rows)
+(5 rows)
 
 --
 -- Test the SP-GiST index
 --
 CREATE TEMPORARY TABLE box_temp (f1 box);
 INSERT INTO box_temp
 	SELECT box(point(i, i), point(i * 2, i * 2))
 	FROM generate_series(1, 50) AS i;
 CREATE INDEX box_spgist ON box_temp USING spgist (f1);
 INSERT INTO box_temp
diff --git a/src/test/regress/expected/circle.out b/src/test/regress/expected/circle.out
index 9ba4a0495d..2ed74cc6aa 100644
--- a/src/test/regress/expected/circle.out
+++ b/src/test/regress/expected/circle.out
@@ -1,99 +1,122 @@
 --
 -- CIRCLE
 --
 CREATE TABLE CIRCLE_TBL (f1 circle);
 INSERT INTO CIRCLE_TBL VALUES ('<(5,1),3>');
 INSERT INTO CIRCLE_TBL VALUES ('<(1,2),100>');
 INSERT INTO CIRCLE_TBL VALUES ('1,3,5');
 INSERT INTO CIRCLE_TBL VALUES ('((1,2),3)');
 INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10>');
-INSERT INTO CIRCLE_TBL VALUES ('<(100,1),115>');
+INSERT INTO CIRCLE_TBL VALUES (' < ( 100 , 1 ) , 115 > ');
+INSERT INTO CIRCLE_TBL VALUES ('<(3,5),0>');	-- Zero radius
+INSERT INTO CIRCLE_TBL VALUES ('<(3,5),NaN>');	-- NaN radius
 -- bad values
 INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
 ERROR:  invalid input syntax for type circle: "<(-100,0),-100>"
 LINE 1: INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
                                        ^
+INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10');
+ERROR:  invalid input syntax for type circle: "<(100,200),10"
+LINE 1: INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10');
+                                       ^
+INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10> x');
+ERROR:  invalid input syntax for type circle: "<(100,200),10> x"
+LINE 1: INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10> x');
+                                       ^
 INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
 ERROR:  invalid input syntax for type circle: "1abc,3,5"
 LINE 1: INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
                                        ^
 INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
 ERROR:  invalid input syntax for type circle: "(3,(1,2),3)"
 LINE 1: INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
                                        ^
 SELECT * FROM CIRCLE_TBL;
        f1       
 ----------------
  <(5,1),3>
  <(1,2),100>
  <(1,3),5>
  <(1,2),3>
  <(100,200),10>
  <(100,1),115>
-(6 rows)
+ <(3,5),0>
+ <(3,5),NaN>
+(8 rows)
 
 SELECT '' AS six, center(f1) AS center
   FROM CIRCLE_TBL;
  six |  center   
 -----+-----------
      | (5,1)
      | (1,2)
      | (1,3)
      | (1,2)
      | (100,200)
      | (100,1)
-(6 rows)
+     | (3,5)
+     | (3,5)
+(8 rows)
 
 SELECT '' AS six, radius(f1) AS radius
   FROM CIRCLE_TBL;
  six | radius 
 -----+--------
      |      3
      |    100
      |      5
      |      3
      |     10
      |    115
-(6 rows)
+     |      0
+     |    NaN
+(8 rows)
 
 SELECT '' AS six, diameter(f1) AS diameter
   FROM CIRCLE_TBL;
  six | diameter 
 -----+----------
      |        6
      |      200
      |       10
      |        6
      |       20
      |      230
-(6 rows)
+     |        0
+     |      NaN
+(8 rows)
 
 SELECT '' AS two, f1 FROM CIRCLE_TBL WHERE radius(f1) < 5;
  two |    f1     
 -----+-----------
      | <(5,1),3>
      | <(1,2),3>
-(2 rows)
+     | <(3,5),0>
+(3 rows)
 
 SELECT '' AS four, f1 FROM CIRCLE_TBL WHERE diameter(f1) >= 10;
  four |       f1       
 ------+----------------
       | <(1,2),100>
       | <(1,3),5>
       | <(100,200),10>
       | <(100,1),115>
-(4 rows)
+      | <(3,5),NaN>
+(5 rows)
 
 SELECT '' as five, c1.f1 AS one, c2.f1 AS two, (c1.f1 <-> c2.f1) AS distance
   FROM CIRCLE_TBL c1, CIRCLE_TBL c2
   WHERE (c1.f1 < c2.f1) AND ((c1.f1 <-> c2.f1) > 0)
   ORDER BY distance, area(c1.f1), area(c2.f1);
  five |      one       |      two       |     distance     
 ------+----------------+----------------+------------------
+      | <(3,5),0>      | <(1,2),3>      | 0.60555127546399
+      | <(3,5),0>      | <(5,1),3>      | 1.47213595499958
       | <(100,200),10> | <(100,1),115>  |               74
       | <(100,200),10> | <(1,2),100>    | 111.370729772479
       | <(1,3),5>      | <(100,200),10> | 205.476756144497
       | <(5,1),3>      | <(100,200),10> |  207.51303816328
+      | <(3,5),0>      | <(100,200),10> | 207.793480159531
       | <(1,2),3>      | <(100,200),10> | 208.370729772479
-(5 rows)
+(8 rows)
 
diff --git a/src/test/regress/expected/create_index.out b/src/test/regress/expected/create_index.out
index 031a0bcec9..ac300469b2 100644
--- a/src/test/regress/expected/create_index.out
+++ b/src/test/regress/expected/create_index.out
@@ -150,96 +150,103 @@ SELECT count(*) FROM point_tbl WHERE f1 <@ box '(0,0,100,100)';
 
 SELECT count(*) FROM point_tbl WHERE box '(0,0,100,100)' @> f1;
  count 
 -------
      3
 (1 row)
 
 SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,50),(100,0),(0,0)';
  count 
 -------
-     3
+     5
 (1 row)
 
 SELECT count(*) FROM point_tbl WHERE f1 <@ circle '<(50,50),50>';
  count 
 -------
      1
 (1 row)
 
 SELECT count(*) FROM point_tbl p WHERE p.f1 << '(0.0, 0.0)';
  count 
 -------
      3
 (1 row)
 
 SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)';
  count 
 -------
-     2
+     3
 (1 row)
 
 SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)';
  count 
 -------
      1
 (1 row)
 
 SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)';
  count 
 -------
-     3
+     4
 (1 row)
 
 SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)';
  count 
 -------
      1
 (1 row)
 
 SELECT * FROM point_tbl ORDER BY f1 <-> '0,1';
-     f1     
-------------
+        f1         
+-------------------
  (0,0)
+ (1e-300,-1e-300)
  (-3,4)
  (-10,0)
  (10,10)
  (-5,-12)
  (5.1,34.5)
+ (1e+300,Infinity)
+ (NaN,NaN)
  
-(7 rows)
+(10 rows)
 
 SELECT * FROM point_tbl WHERE f1 IS NULL;
  f1 
 ----
  
 (1 row)
 
 SELECT * FROM point_tbl WHERE f1 IS NOT NULL ORDER BY f1 <-> '0,1';
-     f1     
-------------
+        f1         
+-------------------
+ (1e-300,-1e-300)
  (0,0)
  (-3,4)
  (-10,0)
  (10,10)
  (-5,-12)
  (5.1,34.5)
-(6 rows)
+ (1e+300,Infinity)
+ (NaN,NaN)
+(9 rows)
 
 SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1';
-   f1    
----------
+        f1        
+------------------
  (0,0)
+ (1e-300,-1e-300)
  (-3,4)
  (-10,0)
  (10,10)
-(4 rows)
+(5 rows)
 
 SELECT count(*) FROM quad_point_tbl WHERE p IS NULL;
  count 
 -------
      3
 (1 row)
 
 SELECT count(*) FROM quad_point_tbl WHERE p IS NOT NULL;
  count 
 -------
@@ -561,21 +568,21 @@ SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,
                                        QUERY PLAN                                       
 ----------------------------------------------------------------------------------------
  Aggregate
    ->  Index Only Scan using gpointind on point_tbl
          Index Cond: (f1 <@ '((0,0),(0,100),(100,100),(50,50),(100,0),(0,0))'::polygon)
 (3 rows)
 
 SELECT count(*) FROM point_tbl WHERE f1 <@ polygon '(0,0),(0,100),(100,100),(50,50),(100,0),(0,0)';
  count 
 -------
-     3
+     4
 (1 row)
 
 EXPLAIN (COSTS OFF)
 SELECT count(*) FROM point_tbl WHERE f1 <@ circle '<(50,50),50>';
                      QUERY PLAN                     
 ----------------------------------------------------
  Aggregate
    ->  Index Only Scan using gpointind on point_tbl
          Index Cond: (f1 <@ '<(50,50),50>'::circle)
 (3 rows)
@@ -606,21 +613,21 @@ SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)';
                       QUERY PLAN                      
 ------------------------------------------------------
  Aggregate
    ->  Index Only Scan using gpointind on point_tbl p
          Index Cond: (f1 >> '(0,0)'::point)
 (3 rows)
 
 SELECT count(*) FROM point_tbl p WHERE p.f1 >> '(0.0, 0.0)';
  count 
 -------
-     2
+     3
 (1 row)
 
 EXPLAIN (COSTS OFF)
 SELECT count(*) FROM point_tbl p WHERE p.f1 <^ '(0.0, 0.0)';
                       QUERY PLAN                      
 ------------------------------------------------------
  Aggregate
    ->  Index Only Scan using gpointind on point_tbl p
          Index Cond: (f1 <^ '(0,0)'::point)
 (3 rows)
@@ -636,21 +643,21 @@ SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)';
                       QUERY PLAN                      
 ------------------------------------------------------
  Aggregate
    ->  Index Only Scan using gpointind on point_tbl p
          Index Cond: (f1 >^ '(0,0)'::point)
 (3 rows)
 
 SELECT count(*) FROM point_tbl p WHERE p.f1 >^ '(0.0, 0.0)';
  count 
 -------
-     3
+     4
 (1 row)
 
 EXPLAIN (COSTS OFF)
 SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)';
                       QUERY PLAN                      
 ------------------------------------------------------
  Aggregate
    ->  Index Only Scan using gpointind on point_tbl p
          Index Cond: (f1 ~= '(-5,-12)'::point)
 (3 rows)
@@ -663,30 +670,33 @@ SELECT count(*) FROM point_tbl p WHERE p.f1 ~= '(-5, -12)';
 
 EXPLAIN (COSTS OFF)
 SELECT * FROM point_tbl ORDER BY f1 <-> '0,1';
                   QUERY PLAN                  
 ----------------------------------------------
  Index Only Scan using gpointind on point_tbl
    Order By: (f1 <-> '(0,1)'::point)
 (2 rows)
 
 SELECT * FROM point_tbl ORDER BY f1 <-> '0,1';
-     f1     
-------------
+        f1         
+-------------------
+ (10,10)
+ (NaN,NaN)
  (0,0)
+ (1e-300,-1e-300)
  (-3,4)
  (-10,0)
- (10,10)
  (-5,-12)
  (5.1,34.5)
  
-(7 rows)
+ (1e+300,Infinity)
+(10 rows)
 
 EXPLAIN (COSTS OFF)
 SELECT * FROM point_tbl WHERE f1 IS NULL;
                   QUERY PLAN                  
 ----------------------------------------------
  Index Only Scan using gpointind on point_tbl
    Index Cond: (f1 IS NULL)
 (2 rows)
 
 SELECT * FROM point_tbl WHERE f1 IS NULL;
@@ -698,47 +708,51 @@ SELECT * FROM point_tbl WHERE f1 IS NULL;
 EXPLAIN (COSTS OFF)
 SELECT * FROM point_tbl WHERE f1 IS NOT NULL ORDER BY f1 <-> '0,1';
                   QUERY PLAN                  
 ----------------------------------------------
  Index Only Scan using gpointind on point_tbl
    Index Cond: (f1 IS NOT NULL)
    Order By: (f1 <-> '(0,1)'::point)
 (3 rows)
 
 SELECT * FROM point_tbl WHERE f1 IS NOT NULL ORDER BY f1 <-> '0,1';
-     f1     
-------------
+        f1         
+-------------------
+ (10,10)
+ (NaN,NaN)
  (0,0)
+ (1e-300,-1e-300)
  (-3,4)
  (-10,0)
- (10,10)
  (-5,-12)
  (5.1,34.5)
-(6 rows)
+ (1e+300,Infinity)
+(9 rows)
 
 EXPLAIN (COSTS OFF)
 SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1';
                    QUERY PLAN                   
 ------------------------------------------------
  Index Only Scan using gpointind on point_tbl
    Index Cond: (f1 <@ '(10,10),(-10,-10)'::box)
    Order By: (f1 <-> '(0,1)'::point)
 (3 rows)
 
 SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1';
-   f1    
----------
+        f1        
+------------------
  (0,0)
+ (1e-300,-1e-300)
  (-3,4)
  (-10,0)
  (10,10)
-(4 rows)
+(5 rows)
 
 EXPLAIN (COSTS OFF)
 SELECT count(*) FROM quad_point_tbl WHERE p IS NULL;
                         QUERY PLAN                         
 -----------------------------------------------------------
  Aggregate
    ->  Index Only Scan using sp_quad_ind on quad_point_tbl
          Index Cond: (p IS NULL)
 (3 rows)
 
@@ -1240,27 +1254,28 @@ SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0
 ------------------------------------------------------------
  Sort
    Sort Key: ((f1 <-> '(0,1)'::point))
    ->  Bitmap Heap Scan on point_tbl
          Recheck Cond: (f1 <@ '(10,10),(-10,-10)'::box)
          ->  Bitmap Index Scan on gpointind
                Index Cond: (f1 <@ '(10,10),(-10,-10)'::box)
 (6 rows)
 
 SELECT * FROM point_tbl WHERE f1 <@ '(-10,-10),(10,10)':: box ORDER BY f1 <-> '0,1';
-   f1    
----------
+        f1        
+------------------
  (0,0)
+ (1e-300,-1e-300)
  (-3,4)
  (-10,0)
  (10,10)
-(4 rows)
+(5 rows)
 
 EXPLAIN (COSTS OFF)
 SELECT count(*) FROM quad_point_tbl WHERE p IS NULL;
                   QUERY PLAN                  
 ----------------------------------------------
  Aggregate
    ->  Bitmap Heap Scan on quad_point_tbl
          Recheck Cond: (p IS NULL)
          ->  Bitmap Index Scan on sp_quad_ind
                Index Cond: (p IS NULL)
diff --git a/src/test/regress/expected/geometry.out b/src/test/regress/expected/geometry.out
index e4c0039040..58051b8946 100644
--- a/src/test/regress/expected/geometry.out
+++ b/src/test/regress/expected/geometry.out
@@ -6,558 +6,4885 @@
 SET extra_float_digits TO -3;
 --
 -- Points
 --
 SELECT '' AS four, center(f1) AS center
    FROM BOX_TBL;
  four | center  
 ------+---------
       | (1,1)
       | (2,2)
+      | (-5,-4)
       | (2.5,3)
       | (3,3)
-(4 rows)
+(5 rows)
 
 SELECT '' AS four, (@@ f1) AS center
    FROM BOX_TBL;
  four | center  
 ------+---------
       | (1,1)
       | (2,2)
+      | (-5,-4)
       | (2.5,3)
       | (3,3)
-(4 rows)
+(5 rows)
 
 SELECT '' AS six, point(f1) AS center
    FROM CIRCLE_TBL;
  six |  center   
 -----+-----------
      | (5,1)
      | (1,2)
      | (1,3)
      | (1,2)
      | (100,200)
      | (100,1)
-(6 rows)
+     | (3,5)
+     | (3,5)
+(8 rows)
 
 SELECT '' AS six, (@@ f1) AS center
    FROM CIRCLE_TBL;
  six |  center   
 -----+-----------
      | (5,1)
      | (1,2)
      | (1,3)
      | (1,2)
      | (100,200)
      | (100,1)
-(6 rows)
+     | (3,5)
+     | (3,5)
+(8 rows)
 
 SELECT '' AS two, (@@ f1) AS center
    FROM POLYGON_TBL
    WHERE (# f1) > 2;
  two |            center             
 -----+-------------------------------
      | (1.33333333333,1.33333333333)
      | (2.33333333333,1.33333333333)
-(2 rows)
+     | (4,5)
+     | (4,5)
+     | (4,3)
+(5 rows)
 
 -- "is horizontal" function
 SELECT '' AS two, p1.f1
    FROM POINT_TBL p1
    WHERE ishorizontal(p1.f1, point '(0,0)');
- two |   f1    
------+---------
+ two |        f1        
+-----+------------------
      | (0,0)
      | (-10,0)
-(2 rows)
+     | (1e-300,-1e-300)
+(3 rows)
 
 -- "is horizontal" operator
 SELECT '' AS two, p1.f1
    FROM POINT_TBL p1
    WHERE p1.f1 ?- point '(0,0)';
- two |   f1    
------+---------
+ two |        f1        
+-----+------------------
      | (0,0)
      | (-10,0)
-(2 rows)
+     | (1e-300,-1e-300)
+(3 rows)
 
 -- "is vertical" function
 SELECT '' AS one, p1.f1
    FROM POINT_TBL p1
    WHERE isvertical(p1.f1, point '(5.1,34.5)');
  one |     f1     
 -----+------------
      | (5.1,34.5)
 (1 row)
 
 -- "is vertical" operator
 SELECT '' AS one, p1.f1
    FROM POINT_TBL p1
    WHERE p1.f1 ?| point '(5.1,34.5)';
  one |     f1     
 -----+------------
      | (5.1,34.5)
 (1 row)
 
+-- Slope
+SELECT p1.f1, p2.f1, slope(p1.f1, p2.f1) FROM POINT_TBL p1, POINT_TBL p2;
+        f1         |        f1         |       slope        
+-------------------+-------------------+--------------------
+ (0,0)             | (0,0)             | 1.79769313486e+308
+ (0,0)             | (-10,0)           |                  0
+ (0,0)             | (-3,4)            |     -1.33333333333
+ (0,0)             | (5.1,34.5)        |      6.76470588235
+ (0,0)             | (-5,-12)          |                2.4
+ (0,0)             | (1e-300,-1e-300)  | 1.79769313486e+308
+ (0,0)             | (1e+300,Infinity) |           Infinity
+ (0,0)             | (NaN,NaN)         |                NaN
+ (0,0)             | (10,10)           |                  1
+ (-10,0)           | (0,0)             |                  0
+ (-10,0)           | (-10,0)           | 1.79769313486e+308
+ (-10,0)           | (-3,4)            |     0.571428571429
+ (-10,0)           | (5.1,34.5)        |      2.28476821192
+ (-10,0)           | (-5,-12)          |               -2.4
+ (-10,0)           | (1e-300,-1e-300)  |                  0
+ (-10,0)           | (1e+300,Infinity) |           Infinity
+ (-10,0)           | (NaN,NaN)         |                NaN
+ (-10,0)           | (10,10)           |                0.5
+ (-3,4)            | (0,0)             |     -1.33333333333
+ (-3,4)            | (-10,0)           |     0.571428571429
+ (-3,4)            | (-3,4)            | 1.79769313486e+308
+ (-3,4)            | (5.1,34.5)        |      3.76543209877
+ (-3,4)            | (-5,-12)          |                  8
+ (-3,4)            | (1e-300,-1e-300)  |     -1.33333333333
+ (-3,4)            | (1e+300,Infinity) |           Infinity
+ (-3,4)            | (NaN,NaN)         |                NaN
+ (-3,4)            | (10,10)           |     0.461538461538
+ (5.1,34.5)        | (0,0)             |      6.76470588235
+ (5.1,34.5)        | (-10,0)           |      2.28476821192
+ (5.1,34.5)        | (-3,4)            |      3.76543209877
+ (5.1,34.5)        | (5.1,34.5)        | 1.79769313486e+308
+ (5.1,34.5)        | (-5,-12)          |      4.60396039604
+ (5.1,34.5)        | (1e-300,-1e-300)  |      6.76470588235
+ (5.1,34.5)        | (1e+300,Infinity) |           Infinity
+ (5.1,34.5)        | (NaN,NaN)         |                NaN
+ (5.1,34.5)        | (10,10)           |                 -5
+ (-5,-12)          | (0,0)             |                2.4
+ (-5,-12)          | (-10,0)           |               -2.4
+ (-5,-12)          | (-3,4)            |                  8
+ (-5,-12)          | (5.1,34.5)        |      4.60396039604
+ (-5,-12)          | (-5,-12)          | 1.79769313486e+308
+ (-5,-12)          | (1e-300,-1e-300)  |                2.4
+ (-5,-12)          | (1e+300,Infinity) |           Infinity
+ (-5,-12)          | (NaN,NaN)         |                NaN
+ (-5,-12)          | (10,10)           |      1.46666666667
+ (1e-300,-1e-300)  | (0,0)             | 1.79769313486e+308
+ (1e-300,-1e-300)  | (-10,0)           |                  0
+ (1e-300,-1e-300)  | (-3,4)            |     -1.33333333333
+ (1e-300,-1e-300)  | (5.1,34.5)        |      6.76470588235
+ (1e-300,-1e-300)  | (-5,-12)          |                2.4
+ (1e-300,-1e-300)  | (1e-300,-1e-300)  | 1.79769313486e+308
+ (1e-300,-1e-300)  | (1e+300,Infinity) |           Infinity
+ (1e-300,-1e-300)  | (NaN,NaN)         |                NaN
+ (1e-300,-1e-300)  | (10,10)           |                  1
+ (1e+300,Infinity) | (0,0)             |           Infinity
+ (1e+300,Infinity) | (-10,0)           |           Infinity
+ (1e+300,Infinity) | (-3,4)            |           Infinity
+ (1e+300,Infinity) | (5.1,34.5)        |           Infinity
+ (1e+300,Infinity) | (-5,-12)          |           Infinity
+ (1e+300,Infinity) | (1e-300,-1e-300)  |           Infinity
+ (1e+300,Infinity) | (1e+300,Infinity) | 1.79769313486e+308
+ (1e+300,Infinity) | (NaN,NaN)         |                NaN
+ (1e+300,Infinity) | (10,10)           |           Infinity
+ (NaN,NaN)         | (0,0)             |                NaN
+ (NaN,NaN)         | (-10,0)           |                NaN
+ (NaN,NaN)         | (-3,4)            |                NaN
+ (NaN,NaN)         | (5.1,34.5)        |                NaN
+ (NaN,NaN)         | (-5,-12)          |                NaN
+ (NaN,NaN)         | (1e-300,-1e-300)  |                NaN
+ (NaN,NaN)         | (1e+300,Infinity) |                NaN
+ (NaN,NaN)         | (NaN,NaN)         |                NaN
+ (NaN,NaN)         | (10,10)           |                NaN
+ (10,10)           | (0,0)             |                  1
+ (10,10)           | (-10,0)           |                0.5
+ (10,10)           | (-3,4)            |     0.461538461538
+ (10,10)           | (5.1,34.5)        |                 -5
+ (10,10)           | (-5,-12)          |      1.46666666667
+ (10,10)           | (1e-300,-1e-300)  |                  1
+ (10,10)           | (1e+300,Infinity) |           Infinity
+ (10,10)           | (NaN,NaN)         |                NaN
+ (10,10)           | (10,10)           | 1.79769313486e+308
+(81 rows)
+
+-- Add point
+SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM POINT_TBL p1, POINT_TBL p2;
+        f1         |        f1         |     ?column?      
+-------------------+-------------------+-------------------
+ (0,0)             | (0,0)             | (0,0)
+ (0,0)             | (-10,0)           | (-10,0)
+ (0,0)             | (-3,4)            | (-3,4)
+ (0,0)             | (5.1,34.5)        | (5.1,34.5)
+ (0,0)             | (-5,-12)          | (-5,-12)
+ (0,0)             | (1e-300,-1e-300)  | (1e-300,-1e-300)
+ (0,0)             | (1e+300,Infinity) | (1e+300,Infinity)
+ (0,0)             | (NaN,NaN)         | (NaN,NaN)
+ (0,0)             | (10,10)           | (10,10)
+ (-10,0)           | (0,0)             | (-10,0)
+ (-10,0)           | (-10,0)           | (-20,0)
+ (-10,0)           | (-3,4)            | (-13,4)
+ (-10,0)           | (5.1,34.5)        | (-4.9,34.5)
+ (-10,0)           | (-5,-12)          | (-15,-12)
+ (-10,0)           | (1e-300,-1e-300)  | (-10,-1e-300)
+ (-10,0)           | (1e+300,Infinity) | (1e+300,Infinity)
+ (-10,0)           | (NaN,NaN)         | (NaN,NaN)
+ (-10,0)           | (10,10)           | (0,10)
+ (-3,4)            | (0,0)             | (-3,4)
+ (-3,4)            | (-10,0)           | (-13,4)
+ (-3,4)            | (-3,4)            | (-6,8)
+ (-3,4)            | (5.1,34.5)        | (2.1,38.5)
+ (-3,4)            | (-5,-12)          | (-8,-8)
+ (-3,4)            | (1e-300,-1e-300)  | (-3,4)
+ (-3,4)            | (1e+300,Infinity) | (1e+300,Infinity)
+ (-3,4)            | (NaN,NaN)         | (NaN,NaN)
+ (-3,4)            | (10,10)           | (7,14)
+ (5.1,34.5)        | (0,0)             | (5.1,34.5)
+ (5.1,34.5)        | (-10,0)           | (-4.9,34.5)
+ (5.1,34.5)        | (-3,4)            | (2.1,38.5)
+ (5.1,34.5)        | (5.1,34.5)        | (10.2,69)
+ (5.1,34.5)        | (-5,-12)          | (0.1,22.5)
+ (5.1,34.5)        | (1e-300,-1e-300)  | (5.1,34.5)
+ (5.1,34.5)        | (1e+300,Infinity) | (1e+300,Infinity)
+ (5.1,34.5)        | (NaN,NaN)         | (NaN,NaN)
+ (5.1,34.5)        | (10,10)           | (15.1,44.5)
+ (-5,-12)          | (0,0)             | (-5,-12)
+ (-5,-12)          | (-10,0)           | (-15,-12)
+ (-5,-12)          | (-3,4)            | (-8,-8)
+ (-5,-12)          | (5.1,34.5)        | (0.1,22.5)
+ (-5,-12)          | (-5,-12)          | (-10,-24)
+ (-5,-12)          | (1e-300,-1e-300)  | (-5,-12)
+ (-5,-12)          | (1e+300,Infinity) | (1e+300,Infinity)
+ (-5,-12)          | (NaN,NaN)         | (NaN,NaN)
+ (-5,-12)          | (10,10)           | (5,-2)
+ (1e-300,-1e-300)  | (0,0)             | (1e-300,-1e-300)
+ (1e-300,-1e-300)  | (-10,0)           | (-10,-1e-300)
+ (1e-300,-1e-300)  | (-3,4)            | (-3,4)
+ (1e-300,-1e-300)  | (5.1,34.5)        | (5.1,34.5)
+ (1e-300,-1e-300)  | (-5,-12)          | (-5,-12)
+ (1e-300,-1e-300)  | (1e-300,-1e-300)  | (2e-300,-2e-300)
+ (1e-300,-1e-300)  | (1e+300,Infinity) | (1e+300,Infinity)
+ (1e-300,-1e-300)  | (NaN,NaN)         | (NaN,NaN)
+ (1e-300,-1e-300)  | (10,10)           | (10,10)
+ (1e+300,Infinity) | (0,0)             | (1e+300,Infinity)
+ (1e+300,Infinity) | (-10,0)           | (1e+300,Infinity)
+ (1e+300,Infinity) | (-3,4)            | (1e+300,Infinity)
+ (1e+300,Infinity) | (5.1,34.5)        | (1e+300,Infinity)
+ (1e+300,Infinity) | (-5,-12)          | (1e+300,Infinity)
+ (1e+300,Infinity) | (1e-300,-1e-300)  | (1e+300,Infinity)
+ (1e+300,Infinity) | (1e+300,Infinity) | (2e+300,Infinity)
+ (1e+300,Infinity) | (NaN,NaN)         | (NaN,NaN)
+ (1e+300,Infinity) | (10,10)           | (1e+300,Infinity)
+ (NaN,NaN)         | (0,0)             | (NaN,NaN)
+ (NaN,NaN)         | (-10,0)           | (NaN,NaN)
+ (NaN,NaN)         | (-3,4)            | (NaN,NaN)
+ (NaN,NaN)         | (5.1,34.5)        | (NaN,NaN)
+ (NaN,NaN)         | (-5,-12)          | (NaN,NaN)
+ (NaN,NaN)         | (1e-300,-1e-300)  | (NaN,NaN)
+ (NaN,NaN)         | (1e+300,Infinity) | (NaN,NaN)
+ (NaN,NaN)         | (NaN,NaN)         | (NaN,NaN)
+ (NaN,NaN)         | (10,10)           | (NaN,NaN)
+ (10,10)           | (0,0)             | (10,10)
+ (10,10)           | (-10,0)           | (0,10)
+ (10,10)           | (-3,4)            | (7,14)
+ (10,10)           | (5.1,34.5)        | (15.1,44.5)
+ (10,10)           | (-5,-12)          | (5,-2)
+ (10,10)           | (1e-300,-1e-300)  | (10,10)
+ (10,10)           | (1e+300,Infinity) | (1e+300,Infinity)
+ (10,10)           | (NaN,NaN)         | (NaN,NaN)
+ (10,10)           | (10,10)           | (20,20)
+(81 rows)
+
+-- Subtract point
+SELECT p1.f1, p2.f1, p1.f1 - p2.f1 FROM POINT_TBL p1, POINT_TBL p2;
+        f1         |        f1         |      ?column?       
+-------------------+-------------------+---------------------
+ (0,0)             | (0,0)             | (0,0)
+ (0,0)             | (-10,0)           | (10,0)
+ (0,0)             | (-3,4)            | (3,-4)
+ (0,0)             | (5.1,34.5)        | (-5.1,-34.5)
+ (0,0)             | (-5,-12)          | (5,12)
+ (0,0)             | (1e-300,-1e-300)  | (-1e-300,1e-300)
+ (0,0)             | (1e+300,Infinity) | (-1e+300,-Infinity)
+ (0,0)             | (NaN,NaN)         | (NaN,NaN)
+ (0,0)             | (10,10)           | (-10,-10)
+ (-10,0)           | (0,0)             | (-10,0)
+ (-10,0)           | (-10,0)           | (0,0)
+ (-10,0)           | (-3,4)            | (-7,-4)
+ (-10,0)           | (5.1,34.5)        | (-15.1,-34.5)
+ (-10,0)           | (-5,-12)          | (-5,12)
+ (-10,0)           | (1e-300,-1e-300)  | (-10,1e-300)
+ (-10,0)           | (1e+300,Infinity) | (-1e+300,-Infinity)
+ (-10,0)           | (NaN,NaN)         | (NaN,NaN)
+ (-10,0)           | (10,10)           | (-20,-10)
+ (-3,4)            | (0,0)             | (-3,4)
+ (-3,4)            | (-10,0)           | (7,4)
+ (-3,4)            | (-3,4)            | (0,0)
+ (-3,4)            | (5.1,34.5)        | (-8.1,-30.5)
+ (-3,4)            | (-5,-12)          | (2,16)
+ (-3,4)            | (1e-300,-1e-300)  | (-3,4)
+ (-3,4)            | (1e+300,Infinity) | (-1e+300,-Infinity)
+ (-3,4)            | (NaN,NaN)         | (NaN,NaN)
+ (-3,4)            | (10,10)           | (-13,-6)
+ (5.1,34.5)        | (0,0)             | (5.1,34.5)
+ (5.1,34.5)        | (-10,0)           | (15.1,34.5)
+ (5.1,34.5)        | (-3,4)            | (8.1,30.5)
+ (5.1,34.5)        | (5.1,34.5)        | (0,0)
+ (5.1,34.5)        | (-5,-12)          | (10.1,46.5)
+ (5.1,34.5)        | (1e-300,-1e-300)  | (5.1,34.5)
+ (5.1,34.5)        | (1e+300,Infinity) | (-1e+300,-Infinity)
+ (5.1,34.5)        | (NaN,NaN)         | (NaN,NaN)
+ (5.1,34.5)        | (10,10)           | (-4.9,24.5)
+ (-5,-12)          | (0,0)             | (-5,-12)
+ (-5,-12)          | (-10,0)           | (5,-12)
+ (-5,-12)          | (-3,4)            | (-2,-16)
+ (-5,-12)          | (5.1,34.5)        | (-10.1,-46.5)
+ (-5,-12)          | (-5,-12)          | (0,0)
+ (-5,-12)          | (1e-300,-1e-300)  | (-5,-12)
+ (-5,-12)          | (1e+300,Infinity) | (-1e+300,-Infinity)
+ (-5,-12)          | (NaN,NaN)         | (NaN,NaN)
+ (-5,-12)          | (10,10)           | (-15,-22)
+ (1e-300,-1e-300)  | (0,0)             | (1e-300,-1e-300)
+ (1e-300,-1e-300)  | (-10,0)           | (10,-1e-300)
+ (1e-300,-1e-300)  | (-3,4)            | (3,-4)
+ (1e-300,-1e-300)  | (5.1,34.5)        | (-5.1,-34.5)
+ (1e-300,-1e-300)  | (-5,-12)          | (5,12)
+ (1e-300,-1e-300)  | (1e-300,-1e-300)  | (0,0)
+ (1e-300,-1e-300)  | (1e+300,Infinity) | (-1e+300,-Infinity)
+ (1e-300,-1e-300)  | (NaN,NaN)         | (NaN,NaN)
+ (1e-300,-1e-300)  | (10,10)           | (-10,-10)
+ (1e+300,Infinity) | (0,0)             | (1e+300,Infinity)
+ (1e+300,Infinity) | (-10,0)           | (1e+300,Infinity)
+ (1e+300,Infinity) | (-3,4)            | (1e+300,Infinity)
+ (1e+300,Infinity) | (5.1,34.5)        | (1e+300,Infinity)
+ (1e+300,Infinity) | (-5,-12)          | (1e+300,Infinity)
+ (1e+300,Infinity) | (1e-300,-1e-300)  | (1e+300,Infinity)
+ (1e+300,Infinity) | (1e+300,Infinity) | (0,NaN)
+ (1e+300,Infinity) | (NaN,NaN)         | (NaN,NaN)
+ (1e+300,Infinity) | (10,10)           | (1e+300,Infinity)
+ (NaN,NaN)         | (0,0)             | (NaN,NaN)
+ (NaN,NaN)         | (-10,0)           | (NaN,NaN)
+ (NaN,NaN)         | (-3,4)            | (NaN,NaN)
+ (NaN,NaN)         | (5.1,34.5)        | (NaN,NaN)
+ (NaN,NaN)         | (-5,-12)          | (NaN,NaN)
+ (NaN,NaN)         | (1e-300,-1e-300)  | (NaN,NaN)
+ (NaN,NaN)         | (1e+300,Infinity) | (NaN,NaN)
+ (NaN,NaN)         | (NaN,NaN)         | (NaN,NaN)
+ (NaN,NaN)         | (10,10)           | (NaN,NaN)
+ (10,10)           | (0,0)             | (10,10)
+ (10,10)           | (-10,0)           | (20,10)
+ (10,10)           | (-3,4)            | (13,6)
+ (10,10)           | (5.1,34.5)        | (4.9,-24.5)
+ (10,10)           | (-5,-12)          | (15,22)
+ (10,10)           | (1e-300,-1e-300)  | (10,10)
+ (10,10)           | (1e+300,Infinity) | (-1e+300,-Infinity)
+ (10,10)           | (NaN,NaN)         | (NaN,NaN)
+ (10,10)           | (10,10)           | (0,0)
+(81 rows)
+
+-- Multiply with point
+SELECT p1.f1, p2.f1, p1.f1 * p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1[0] BETWEEN 1 AND 1000;
+     f1     |        f1         |       ?column?        
+------------+-------------------+-----------------------
+ (5.1,34.5) | (0,0)             | (0,0)
+ (10,10)    | (0,0)             | (0,0)
+ (5.1,34.5) | (-10,0)           | (-51,-345)
+ (10,10)    | (-10,0)           | (-100,-100)
+ (5.1,34.5) | (-3,4)            | (-153.3,-83.1)
+ (10,10)    | (-3,4)            | (-70,10)
+ (5.1,34.5) | (5.1,34.5)        | (-1164.24,351.9)
+ (10,10)    | (5.1,34.5)        | (-294,396)
+ (5.1,34.5) | (-5,-12)          | (388.5,-233.7)
+ (10,10)    | (-5,-12)          | (70,-170)
+ (5.1,34.5) | (1e-300,-1e-300)  | (3.96e-299,2.94e-299)
+ (10,10)    | (1e-300,-1e-300)  | (2e-299,0)
+ (5.1,34.5) | (1e+300,Infinity) | (-Infinity,Infinity)
+ (10,10)    | (1e+300,Infinity) | (-Infinity,Infinity)
+ (5.1,34.5) | (NaN,NaN)         | (NaN,NaN)
+ (10,10)    | (NaN,NaN)         | (NaN,NaN)
+ (5.1,34.5) | (10,10)           | (-294,396)
+ (10,10)    | (10,10)           | (0,200)
+(18 rows)
+
+-- Underflow error
+SELECT p1.f1, p2.f1, p1.f1 * p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1[0] < 1;
+ERROR:  value out of range: underflow
+-- Divide by point
+SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1[0] BETWEEN 1 AND 1000;
+        f1         |     f1     |                 ?column?                  
+-------------------+------------+-------------------------------------------
+ (0,0)             | (5.1,34.5) | (0,0)
+ (0,0)             | (10,10)    | (0,0)
+ (-10,0)           | (5.1,34.5) | (-0.0419318237877,0.283656455034)
+ (-10,0)           | (10,10)    | (-0.5,0.5)
+ (-3,4)            | (5.1,34.5) | (0.100883034877,0.101869666025)
+ (-3,4)            | (10,10)    | (0.05,0.35)
+ (5.1,34.5)        | (5.1,34.5) | (1,0)
+ (5.1,34.5)        | (10,10)    | (1.98,1.47)
+ (-5,-12)          | (5.1,34.5) | (-0.361353657935,0.0915100389719)
+ (-5,-12)          | (10,10)    | (-0.85,-0.35)
+ (1e-300,-1e-300)  | (5.1,34.5) | (-2.41724631247e-302,-3.25588278822e-302)
+ (1e-300,-1e-300)  | (10,10)    | (0,-1e-301)
+ (1e+300,Infinity) | (5.1,34.5) | (Infinity,Infinity)
+ (1e+300,Infinity) | (10,10)    | (Infinity,Infinity)
+ (NaN,NaN)         | (5.1,34.5) | (NaN,NaN)
+ (NaN,NaN)         | (10,10)    | (NaN,NaN)
+ (10,10)           | (5.1,34.5) | (0.325588278822,-0.241724631247)
+ (10,10)           | (10,10)    | (1,0)
+(18 rows)
+
+-- Overflow error
+SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1[0] > 1000;
+ERROR:  value out of range: overflow
+-- Division by 0 error
+SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1 ~= '(0,0)'::point;
+ERROR:  division by zero
+-- Distance to line
+SELECT p.f1, l.s, p.f1 <-> l.s FROM POINT_TBL p, LINE_TBL l;
+        f1         |                   s                   |      ?column?      
+-------------------+---------------------------------------+--------------------
+ (0,0)             | {0,-1,5}                              |                  5
+ (0,0)             | {1,0,5}                               |                  5
+ (0,0)             | {0,3,0}                               |                  0
+ (0,0)             | {1,-1,0}                              |                  0
+ (0,0)             | {-0.4,-1,-6}                          |      5.57086014531
+ (0,0)             | {-0.000184615384615,-1,15.3846153846} |      15.3846151224
+ (0,0)             | {3,NaN,5}                             |                NaN
+ (0,0)             | {NaN,NaN,NaN}                         |                NaN
+ (0,0)             | {0,-1,3}                              |                  3
+ (0,0)             | {-1,0,3}                              |                  3
+ (-10,0)           | {0,-1,5}                              |                  5
+ (-10,0)           | {1,0,5}                               |                  5
+ (-10,0)           | {0,3,0}                               |                  0
+ (-10,0)           | {1,-1,0}                              |      7.07106781187
+ (-10,0)           | {-0.4,-1,-6}                          |      1.85695338177
+ (-10,0)           | {-0.000184615384615,-1,15.3846153846} |      15.3864612763
+ (-10,0)           | {3,NaN,5}                             |                NaN
+ (-10,0)           | {NaN,NaN,NaN}                         |                NaN
+ (-10,0)           | {0,-1,3}                              |                  3
+ (-10,0)           | {-1,0,3}                              |                 13
+ (-3,4)            | {0,-1,5}                              |                  1
+ (-3,4)            | {1,0,5}                               |                  2
+ (-3,4)            | {0,3,0}                               |                  4
+ (-3,4)            | {1,-1,0}                              |      4.94974746831
+ (-3,4)            | {-0.4,-1,-6}                          |      8.17059487979
+ (-3,4)            | {-0.000184615384615,-1,15.3846153846} |      11.3851690368
+ (-3,4)            | {3,NaN,5}                             |                NaN
+ (-3,4)            | {NaN,NaN,NaN}                         |                NaN
+ (-3,4)            | {0,-1,3}                              |                  1
+ (-3,4)            | {-1,0,3}                              |                  6
+ (5.1,34.5)        | {0,-1,5}                              |               29.5
+ (5.1,34.5)        | {1,0,5}                               |               10.1
+ (5.1,34.5)        | {0,3,0}                               |               34.5
+ (5.1,34.5)        | {1,-1,0}                              |      20.7889393669
+ (5.1,34.5)        | {-0.4,-1,-6}                          |      39.4973984303
+ (5.1,34.5)        | {-0.000184615384615,-1,15.3846153846} |      19.1163258281
+ (5.1,34.5)        | {3,NaN,5}                             |                NaN
+ (5.1,34.5)        | {NaN,NaN,NaN}                         |                NaN
+ (5.1,34.5)        | {0,-1,3}                              |               31.5
+ (5.1,34.5)        | {-1,0,3}                              |                2.1
+ (-5,-12)          | {0,-1,5}                              |                 17
+ (-5,-12)          | {1,0,5}                               |                  0
+ (-5,-12)          | {0,3,0}                               |                 12
+ (-5,-12)          | {1,-1,0}                              |      4.94974746831
+ (-5,-12)          | {-0.4,-1,-6}                          |      7.42781352708
+ (-5,-12)          | {-0.000184615384615,-1,15.3846153846} |      27.3855379948
+ (-5,-12)          | {3,NaN,5}                             |                NaN
+ (-5,-12)          | {NaN,NaN,NaN}                         |                NaN
+ (-5,-12)          | {0,-1,3}                              |                 15
+ (-5,-12)          | {-1,0,3}                              |                  8
+ (1e-300,-1e-300)  | {0,-1,5}                              |                  5
+ (1e-300,-1e-300)  | {1,0,5}                               |                  5
+ (1e-300,-1e-300)  | {0,3,0}                               |             1e-300
+ (1e-300,-1e-300)  | {1,-1,0}                              | 1.41421356237e-300
+ (1e-300,-1e-300)  | {-0.4,-1,-6}                          |      5.57086014531
+ (1e-300,-1e-300)  | {-0.000184615384615,-1,15.3846153846} |      15.3846151224
+ (1e-300,-1e-300)  | {3,NaN,5}                             |                NaN
+ (1e-300,-1e-300)  | {NaN,NaN,NaN}                         |                NaN
+ (1e-300,-1e-300)  | {0,-1,3}                              |                  3
+ (1e-300,-1e-300)  | {-1,0,3}                              |                  3
+ (1e+300,Infinity) | {0,-1,5}                              |           Infinity
+ (1e+300,Infinity) | {1,0,5}                               |                NaN
+ (1e+300,Infinity) | {0,3,0}                               |           Infinity
+ (1e+300,Infinity) | {1,-1,0}                              |           Infinity
+ (1e+300,Infinity) | {-0.4,-1,-6}                          |           Infinity
+ (1e+300,Infinity) | {-0.000184615384615,-1,15.3846153846} |           Infinity
+ (1e+300,Infinity) | {3,NaN,5}                             |                NaN
+ (1e+300,Infinity) | {NaN,NaN,NaN}                         |                NaN
+ (1e+300,Infinity) | {0,-1,3}                              |           Infinity
+ (1e+300,Infinity) | {-1,0,3}                              |                NaN
+ (NaN,NaN)         | {0,-1,5}                              |                NaN
+ (NaN,NaN)         | {1,0,5}                               |                NaN
+ (NaN,NaN)         | {0,3,0}                               |                NaN
+ (NaN,NaN)         | {1,-1,0}                              |                NaN
+ (NaN,NaN)         | {-0.4,-1,-6}                          |                NaN
+ (NaN,NaN)         | {-0.000184615384615,-1,15.3846153846} |                NaN
+ (NaN,NaN)         | {3,NaN,5}                             |                NaN
+ (NaN,NaN)         | {NaN,NaN,NaN}                         |                NaN
+ (NaN,NaN)         | {0,-1,3}                              |                NaN
+ (NaN,NaN)         | {-1,0,3}                              |                NaN
+ (10,10)           | {0,-1,5}                              |                  5
+ (10,10)           | {1,0,5}                               |                 15
+ (10,10)           | {0,3,0}                               |                 10
+ (10,10)           | {1,-1,0}                              |                  0
+ (10,10)           | {-0.4,-1,-6}                          |      18.5695338177
+ (10,10)           | {-0.000184615384615,-1,15.3846153846} |      5.38276913903
+ (10,10)           | {3,NaN,5}                             |                NaN
+ (10,10)           | {NaN,NaN,NaN}                         |                NaN
+ (10,10)           | {0,-1,3}                              |                  7
+ (10,10)           | {-1,0,3}                              |                  7
+(90 rows)
+
+-- Distance to line segment
+SELECT p.f1, l.s, p.f1 <-> l.s FROM POINT_TBL p, LSEG_TBL l;
+        f1         |               s               |      ?column?      
+-------------------+-------------------------------+--------------------
+ (0,0)             | [(1,2),(3,4)]                 |       2.2360679775
+ (0,0)             | [(0,0),(6,6)]                 |                  0
+ (0,0)             | [(10,-10),(-3,-4)]            |      4.88901207039
+ (0,0)             | [(-1000000,200),(300000,-40)] |      15.3846151224
+ (0,0)             | [(11,22),(33,44)]             |      24.5967477525
+ (0,0)             | [(-10,2),(-10,3)]             |      10.1980390272
+ (0,0)             | [(0,-20),(30,-20)]            |                 20
+ (0,0)             | [(NaN,1),(NaN,90)]            |                NaN
+ (-10,0)           | [(1,2),(3,4)]                 |      11.1803398875
+ (-10,0)           | [(0,0),(6,6)]                 |                 10
+ (-10,0)           | [(10,-10),(-3,-4)]            |       8.0622577483
+ (-10,0)           | [(-1000000,200),(300000,-40)] |      15.3864612763
+ (-10,0)           | [(11,22),(33,44)]             |      30.4138126515
+ (-10,0)           | [(-10,2),(-10,3)]             |                  2
+ (-10,0)           | [(0,-20),(30,-20)]            |       22.360679775
+ (-10,0)           | [(NaN,1),(NaN,90)]            |                NaN
+ (-3,4)            | [(1,2),(3,4)]                 |        4.472135955
+ (-3,4)            | [(0,0),(6,6)]                 |      4.94974746831
+ (-3,4)            | [(10,-10),(-3,-4)]            |                  8
+ (-3,4)            | [(-1000000,200),(300000,-40)] |      11.3851690367
+ (-3,4)            | [(11,22),(33,44)]             |       22.803508502
+ (-3,4)            | [(-10,2),(-10,3)]             |      7.07106781187
+ (-3,4)            | [(0,-20),(30,-20)]            |      24.1867732449
+ (-3,4)            | [(NaN,1),(NaN,90)]            |                NaN
+ (5.1,34.5)        | [(1,2),(3,4)]                 |      30.5722096028
+ (5.1,34.5)        | [(0,0),(6,6)]                 |      28.5142069853
+ (5.1,34.5)        | [(10,-10),(-3,-4)]            |      39.3428519556
+ (5.1,34.5)        | [(-1000000,200),(300000,-40)] |      19.1163258281
+ (5.1,34.5)        | [(11,22),(33,44)]             |      13.0107647738
+ (5.1,34.5)        | [(-10,2),(-10,3)]             |       34.932220084
+ (5.1,34.5)        | [(0,-20),(30,-20)]            |               54.5
+ (5.1,34.5)        | [(NaN,1),(NaN,90)]            |                NaN
+ (-5,-12)          | [(1,2),(3,4)]                 |      15.2315462117
+ (-5,-12)          | [(0,0),(6,6)]                 |                 13
+ (-5,-12)          | [(10,-10),(-3,-4)]            |      8.10179143093
+ (-5,-12)          | [(-1000000,200),(300000,-40)] |      27.3855379949
+ (-5,-12)          | [(11,22),(33,44)]             |      37.5765884561
+ (-5,-12)          | [(-10,2),(-10,3)]             |      14.8660687473
+ (-5,-12)          | [(0,-20),(30,-20)]            |      9.43398113206
+ (-5,-12)          | [(NaN,1),(NaN,90)]            |                NaN
+ (1e-300,-1e-300)  | [(1,2),(3,4)]                 |       2.2360679775
+ (1e-300,-1e-300)  | [(0,0),(6,6)]                 | 1.41421356237e-300
+ (1e-300,-1e-300)  | [(10,-10),(-3,-4)]            |      4.88901207039
+ (1e-300,-1e-300)  | [(-1000000,200),(300000,-40)] |      15.3846151224
+ (1e-300,-1e-300)  | [(11,22),(33,44)]             |      24.5967477525
+ (1e-300,-1e-300)  | [(-10,2),(-10,3)]             |      10.1980390272
+ (1e-300,-1e-300)  | [(0,-20),(30,-20)]            |                 20
+ (1e-300,-1e-300)  | [(NaN,1),(NaN,90)]            |                NaN
+ (1e+300,Infinity) | [(1,2),(3,4)]                 |           Infinity
+ (1e+300,Infinity) | [(0,0),(6,6)]                 |           Infinity
+ (1e+300,Infinity) | [(10,-10),(-3,-4)]            |           Infinity
+ (1e+300,Infinity) | [(-1000000,200),(300000,-40)] |           Infinity
+ (1e+300,Infinity) | [(11,22),(33,44)]             |           Infinity
+ (1e+300,Infinity) | [(-10,2),(-10,3)]             |           Infinity
+ (1e+300,Infinity) | [(0,-20),(30,-20)]            |           Infinity
+ (1e+300,Infinity) | [(NaN,1),(NaN,90)]            |           Infinity
+ (NaN,NaN)         | [(1,2),(3,4)]                 |                NaN
+ (NaN,NaN)         | [(0,0),(6,6)]                 |                NaN
+ (NaN,NaN)         | [(10,-10),(-3,-4)]            |                NaN
+ (NaN,NaN)         | [(-1000000,200),(300000,-40)] |                NaN
+ (NaN,NaN)         | [(11,22),(33,44)]             |                NaN
+ (NaN,NaN)         | [(-10,2),(-10,3)]             |                NaN
+ (NaN,NaN)         | [(0,-20),(30,-20)]            |                NaN
+ (NaN,NaN)         | [(NaN,1),(NaN,90)]            |                NaN
+ (10,10)           | [(1,2),(3,4)]                 |      9.21954445729
+ (10,10)           | [(0,0),(6,6)]                 |      5.65685424949
+ (10,10)           | [(10,-10),(-3,-4)]            |        18.15918769
+ (10,10)           | [(-1000000,200),(300000,-40)] |      5.38276913904
+ (10,10)           | [(11,22),(33,44)]             |      12.0415945788
+ (10,10)           | [(-10,2),(-10,3)]             |      21.1896201004
+ (10,10)           | [(0,-20),(30,-20)]            |                 30
+ (10,10)           | [(NaN,1),(NaN,90)]            |                NaN
+(72 rows)
+
+-- Distance to box
+SELECT p.f1, b.f1, p.f1 <-> b.f1 FROM POINT_TBL p, BOX_TBL b;
+        f1         |         f1          |      ?column?      
+-------------------+---------------------+--------------------
+ (0,0)             | (2,2),(0,0)         |                  0
+ (0,0)             | (3,3),(1,1)         |      1.41421356237
+ (0,0)             | (-2,2),(-8,-10)     |                  2
+ (0,0)             | (2.5,3.5),(2.5,2.5) |      3.53553390593
+ (0,0)             | (3,3),(3,3)         |      4.24264068712
+ (-10,0)           | (2,2),(0,0)         |                 10
+ (-10,0)           | (3,3),(1,1)         |      11.0453610172
+ (-10,0)           | (-2,2),(-8,-10)     |                  2
+ (-10,0)           | (2.5,3.5),(2.5,2.5) |       12.747548784
+ (-10,0)           | (3,3),(3,3)         |      13.3416640641
+ (-3,4)            | (2,2),(0,0)         |      3.60555127546
+ (-3,4)            | (3,3),(1,1)         |      4.12310562562
+ (-3,4)            | (-2,2),(-8,-10)     |                  2
+ (-3,4)            | (2.5,3.5),(2.5,2.5) |      5.52268050859
+ (-3,4)            | (3,3),(3,3)         |       6.0827625303
+ (5.1,34.5)        | (2,2),(0,0)         |      32.6475113906
+ (5.1,34.5)        | (3,3),(1,1)         |      31.5699223946
+ (5.1,34.5)        | (-2,2),(-8,-10)     |      33.2664996656
+ (5.1,34.5)        | (2.5,3.5),(2.5,2.5) |       31.108841187
+ (5.1,34.5)        | (3,3),(3,3)         |      31.5699223946
+ (-5,-12)          | (2,2),(0,0)         |                 13
+ (-5,-12)          | (3,3),(1,1)         |      14.3178210633
+ (-5,-12)          | (-2,2),(-8,-10)     |                  2
+ (-5,-12)          | (2.5,3.5),(2.5,2.5) |      16.3248277173
+ (-5,-12)          | (3,3),(3,3)         |                 17
+ (1e-300,-1e-300)  | (2,2),(0,0)         | 1.41421356237e-300
+ (1e-300,-1e-300)  | (3,3),(1,1)         |      1.41421356237
+ (1e-300,-1e-300)  | (-2,2),(-8,-10)     |                  2
+ (1e-300,-1e-300)  | (2.5,3.5),(2.5,2.5) |      3.53553390593
+ (1e-300,-1e-300)  | (3,3),(3,3)         |      4.24264068712
+ (1e+300,Infinity) | (2,2),(0,0)         |           Infinity
+ (1e+300,Infinity) | (3,3),(1,1)         |           Infinity
+ (1e+300,Infinity) | (-2,2),(-8,-10)     |           Infinity
+ (1e+300,Infinity) | (2.5,3.5),(2.5,2.5) |           Infinity
+ (1e+300,Infinity) | (3,3),(3,3)         |           Infinity
+ (NaN,NaN)         | (2,2),(0,0)         |                NaN
+ (NaN,NaN)         | (3,3),(1,1)         |                NaN
+ (NaN,NaN)         | (-2,2),(-8,-10)     |                NaN
+ (NaN,NaN)         | (2.5,3.5),(2.5,2.5) |                NaN
+ (NaN,NaN)         | (3,3),(3,3)         |                NaN
+ (10,10)           | (2,2),(0,0)         |       11.313708499
+ (10,10)           | (3,3),(1,1)         |      9.89949493661
+ (10,10)           | (-2,2),(-8,-10)     |      14.4222051019
+ (10,10)           | (2.5,3.5),(2.5,2.5) |      9.92471662064
+ (10,10)           | (3,3),(3,3)         |      9.89949493661
+(45 rows)
+
+-- Distance to path
+SELECT p.f1, p1.f1, p.f1 <-> p1.f1 FROM POINT_TBL p, PATH_TBL p1;
+        f1         |            f1             |      ?column?      
+-------------------+---------------------------+--------------------
+ (0,0)             | [(1,2),(3,4)]             |       2.2360679775
+ (0,0)             | ((1,2),(3,4))             |       2.2360679775
+ (0,0)             | [(0,0),(3,0),(4,5),(1,6)] |                  0
+ (0,0)             | ((1,2),(3,4))             |       2.2360679775
+ (0,0)             | ((1,2),(3,4))             |       2.2360679775
+ (0,0)             | [(1,2),(3,4)]             |       2.2360679775
+ (0,0)             | ((10,20))                 |       22.360679775
+ (0,0)             | [(11,12),(13,14)]         |      16.2788205961
+ (0,0)             | ((11,12),(13,14))         |      16.2788205961
+ (-10,0)           | [(1,2),(3,4)]             |      11.1803398875
+ (-10,0)           | ((1,2),(3,4))             |      11.1803398875
+ (-10,0)           | [(0,0),(3,0),(4,5),(1,6)] |                 10
+ (-10,0)           | ((1,2),(3,4))             |      11.1803398875
+ (-10,0)           | ((1,2),(3,4))             |      11.1803398875
+ (-10,0)           | [(1,2),(3,4)]             |      11.1803398875
+ (-10,0)           | ((10,20))                 |      28.2842712475
+ (-10,0)           | [(11,12),(13,14)]         |      24.1867732449
+ (-10,0)           | ((11,12),(13,14))         |      24.1867732449
+ (-3,4)            | [(1,2),(3,4)]             |        4.472135955
+ (-3,4)            | ((1,2),(3,4))             |        4.472135955
+ (-3,4)            | [(0,0),(3,0),(4,5),(1,6)] |        4.472135955
+ (-3,4)            | ((1,2),(3,4))             |        4.472135955
+ (-3,4)            | ((1,2),(3,4))             |        4.472135955
+ (-3,4)            | [(1,2),(3,4)]             |        4.472135955
+ (-3,4)            | ((10,20))                 |      20.6155281281
+ (-3,4)            | [(11,12),(13,14)]         |      16.1245154966
+ (-3,4)            | ((11,12),(13,14))         |      16.1245154966
+ (5.1,34.5)        | [(1,2),(3,4)]             |      30.5722096028
+ (5.1,34.5)        | ((1,2),(3,4))             |      30.5722096028
+ (5.1,34.5)        | [(0,0),(3,0),(4,5),(1,6)] |       28.793402022
+ (5.1,34.5)        | ((1,2),(3,4))             |      30.5722096028
+ (5.1,34.5)        | ((1,2),(3,4))             |      30.5722096028
+ (5.1,34.5)        | [(1,2),(3,4)]             |      30.5722096028
+ (5.1,34.5)        | ((10,20))                 |      15.3055545473
+ (5.1,34.5)        | [(11,12),(13,14)]         |      21.9695243462
+ (5.1,34.5)        | ((11,12),(13,14))         |      21.9695243462
+ (-5,-12)          | [(1,2),(3,4)]             |      15.2315462117
+ (-5,-12)          | ((1,2),(3,4))             |      15.2315462117
+ (-5,-12)          | [(0,0),(3,0),(4,5),(1,6)] |                 13
+ (-5,-12)          | ((1,2),(3,4))             |      15.2315462117
+ (-5,-12)          | ((1,2),(3,4))             |      15.2315462117
+ (-5,-12)          | [(1,2),(3,4)]             |      15.2315462117
+ (-5,-12)          | ((10,20))                 |      35.3411940941
+ (-5,-12)          | [(11,12),(13,14)]         |      28.8444102037
+ (-5,-12)          | ((11,12),(13,14))         |      28.8444102037
+ (1e-300,-1e-300)  | [(1,2),(3,4)]             |       2.2360679775
+ (1e-300,-1e-300)  | ((1,2),(3,4))             |       2.2360679775
+ (1e-300,-1e-300)  | [(0,0),(3,0),(4,5),(1,6)] | 1.41421356237e-300
+ (1e-300,-1e-300)  | ((1,2),(3,4))             |       2.2360679775
+ (1e-300,-1e-300)  | ((1,2),(3,4))             |       2.2360679775
+ (1e-300,-1e-300)  | [(1,2),(3,4)]             |       2.2360679775
+ (1e-300,-1e-300)  | ((10,20))                 |       22.360679775
+ (1e-300,-1e-300)  | [(11,12),(13,14)]         |      16.2788205961
+ (1e-300,-1e-300)  | ((11,12),(13,14))         |      16.2788205961
+ (1e+300,Infinity) | [(1,2),(3,4)]             |           Infinity
+ (1e+300,Infinity) | ((1,2),(3,4))             |           Infinity
+ (1e+300,Infinity) | [(0,0),(3,0),(4,5),(1,6)] |           Infinity
+ (1e+300,Infinity) | ((1,2),(3,4))             |           Infinity
+ (1e+300,Infinity) | ((1,2),(3,4))             |           Infinity
+ (1e+300,Infinity) | [(1,2),(3,4)]             |           Infinity
+ (1e+300,Infinity) | ((10,20))                 |           Infinity
+ (1e+300,Infinity) | [(11,12),(13,14)]         |           Infinity
+ (1e+300,Infinity) | ((11,12),(13,14))         |           Infinity
+ (NaN,NaN)         | [(1,2),(3,4)]             |                NaN
+ (NaN,NaN)         | ((1,2),(3,4))             |                NaN
+ (NaN,NaN)         | [(0,0),(3,0),(4,5),(1,6)] |                NaN
+ (NaN,NaN)         | ((1,2),(3,4))             |                NaN
+ (NaN,NaN)         | ((1,2),(3,4))             |                NaN
+ (NaN,NaN)         | [(1,2),(3,4)]             |                NaN
+ (NaN,NaN)         | ((10,20))                 |                NaN
+ (NaN,NaN)         | [(11,12),(13,14)]         |                NaN
+ (NaN,NaN)         | ((11,12),(13,14))         |                NaN
+ (10,10)           | [(1,2),(3,4)]             |      9.21954445729
+ (10,10)           | ((1,2),(3,4))             |      9.21954445729
+ (10,10)           | [(0,0),(3,0),(4,5),(1,6)] |      7.81024967591
+ (10,10)           | ((1,2),(3,4))             |      9.21954445729
+ (10,10)           | ((1,2),(3,4))             |      9.21954445729
+ (10,10)           | [(1,2),(3,4)]             |      9.21954445729
+ (10,10)           | ((10,20))                 |                 10
+ (10,10)           | [(11,12),(13,14)]         |       2.2360679775
+ (10,10)           | ((11,12),(13,14))         |       2.2360679775
+(81 rows)
+
+-- Distance to polygon
+SELECT p.f1, p1.f1, p.f1 <-> p1.f1 FROM POINT_TBL p, POLYGON_TBL p1;
+        f1         |             f1             |   ?column?    
+-------------------+----------------------------+---------------
+ (0,0)             | ((2,0),(2,4),(0,0))        |             0
+ (0,0)             | ((3,1),(3,3),(1,0))        |             1
+ (0,0)             | ((1,2),(3,4),(5,6),(7,8))  |  2.2360679775
+ (0,0)             | ((7,8),(5,6),(3,4),(1,2))  |  2.2360679775
+ (0,0)             | ((1,2),(7,8),(5,6),(3,-4)) | 1.58113883008
+ (0,0)             | ((0,0))                    |             0
+ (0,0)             | ((0,1),(0,1))              |             1
+ (-10,0)           | ((2,0),(2,4),(0,0))        |            10
+ (-10,0)           | ((3,1),(3,3),(1,0))        |            11
+ (-10,0)           | ((1,2),(3,4),(5,6),(7,8))  | 11.1803398875
+ (-10,0)           | ((7,8),(5,6),(3,4),(1,2))  | 11.1803398875
+ (-10,0)           | ((1,2),(7,8),(5,6),(3,-4)) | 11.1803398875
+ (-10,0)           | ((0,0))                    |            10
+ (-10,0)           | ((0,1),(0,1))              | 10.0498756211
+ (-3,4)            | ((2,0),(2,4),(0,0))        |   4.472135955
+ (-3,4)            | ((3,1),(3,3),(1,0))        | 5.54700196225
+ (-3,4)            | ((1,2),(3,4),(5,6),(7,8))  |   4.472135955
+ (-3,4)            | ((7,8),(5,6),(3,4),(1,2))  |   4.472135955
+ (-3,4)            | ((1,2),(7,8),(5,6),(3,-4)) |   4.472135955
+ (-3,4)            | ((0,0))                    |             5
+ (-3,4)            | ((0,1),(0,1))              | 4.24264068712
+ (5.1,34.5)        | ((2,0),(2,4),(0,0))        | 30.6571362002
+ (5.1,34.5)        | ((3,1),(3,3),(1,0))        | 31.5699223946
+ (5.1,34.5)        | ((1,2),(3,4),(5,6),(7,8))  | 26.5680258958
+ (5.1,34.5)        | ((7,8),(5,6),(3,4),(1,2))  | 26.5680258958
+ (5.1,34.5)        | ((1,2),(7,8),(5,6),(3,-4)) | 26.5680258958
+ (5.1,34.5)        | ((0,0))                    | 34.8749193547
+ (5.1,34.5)        | ((0,1),(0,1))              | 33.8859853037
+ (-5,-12)          | ((2,0),(2,4),(0,0))        |            13
+ (-5,-12)          | ((3,1),(3,3),(1,0))        |  13.416407865
+ (-5,-12)          | ((1,2),(3,4),(5,6),(7,8))  | 15.2315462117
+ (-5,-12)          | ((7,8),(5,6),(3,4),(1,2))  | 15.2315462117
+ (-5,-12)          | ((1,2),(7,8),(5,6),(3,-4)) |  11.313708499
+ (-5,-12)          | ((0,0))                    |            13
+ (-5,-12)          | ((0,1),(0,1))              | 13.9283882772
+ (1e-300,-1e-300)  | ((2,0),(2,4),(0,0))        |             0
+ (1e-300,-1e-300)  | ((3,1),(3,3),(1,0))        |             1
+ (1e-300,-1e-300)  | ((1,2),(3,4),(5,6),(7,8))  |  2.2360679775
+ (1e-300,-1e-300)  | ((7,8),(5,6),(3,4),(1,2))  |  2.2360679775
+ (1e-300,-1e-300)  | ((1,2),(7,8),(5,6),(3,-4)) | 1.58113883008
+ (1e-300,-1e-300)  | ((0,0))                    |             0
+ (1e-300,-1e-300)  | ((0,1),(0,1))              |             1
+ (1e+300,Infinity) | ((2,0),(2,4),(0,0))        |      Infinity
+ (1e+300,Infinity) | ((3,1),(3,3),(1,0))        |      Infinity
+ (1e+300,Infinity) | ((1,2),(3,4),(5,6),(7,8))  |      Infinity
+ (1e+300,Infinity) | ((7,8),(5,6),(3,4),(1,2))  |      Infinity
+ (1e+300,Infinity) | ((1,2),(7,8),(5,6),(3,-4)) |      Infinity
+ (1e+300,Infinity) | ((0,0))                    |      Infinity
+ (1e+300,Infinity) | ((0,1),(0,1))              |      Infinity
+ (NaN,NaN)         | ((2,0),(2,4),(0,0))        |             0
+ (NaN,NaN)         | ((3,1),(3,3),(1,0))        |             0
+ (NaN,NaN)         | ((1,2),(3,4),(5,6),(7,8))  |             0
+ (NaN,NaN)         | ((7,8),(5,6),(3,4),(1,2))  |             0
+ (NaN,NaN)         | ((1,2),(7,8),(5,6),(3,-4)) |             0
+ (NaN,NaN)         | ((0,0))                    |             0
+ (NaN,NaN)         | ((0,1),(0,1))              |             0
+ (10,10)           | ((2,0),(2,4),(0,0))        |            10
+ (10,10)           | ((3,1),(3,3),(1,0))        | 9.89949493661
+ (10,10)           | ((1,2),(3,4),(5,6),(7,8))  | 3.60555127546
+ (10,10)           | ((7,8),(5,6),(3,4),(1,2))  | 3.60555127546
+ (10,10)           | ((1,2),(7,8),(5,6),(3,-4)) | 3.60555127546
+ (10,10)           | ((0,0))                    | 14.1421356237
+ (10,10)           | ((0,1),(0,1))              | 13.4536240471
+(63 rows)
+
+-- Closest point to line
+SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LINE_TBL l;
+        f1         |                   s                   |             ?column?             
+-------------------+---------------------------------------+----------------------------------
+ (0,0)             | {0,-1,5}                              | (0,5)
+ (0,0)             | {1,0,5}                               | (-5,0)
+ (0,0)             | {0,3,0}                               | (0,0)
+ (0,0)             | {1,-1,0}                              | (0,0)
+ (0,0)             | {-0.4,-1,-6}                          | (-2.06896551724,-5.1724137931)
+ (0,0)             | {-0.000184615384615,-1,15.3846153846} | (0.00284023658959,15.3846148603)
+ (0,0)             | {3,NaN,5}                             | 
+ (0,0)             | {NaN,NaN,NaN}                         | 
+ (0,0)             | {0,-1,3}                              | (0,3)
+ (0,0)             | {-1,0,3}                              | (3,0)
+ (-10,0)           | {0,-1,5}                              | (-10,5)
+ (-10,0)           | {1,0,5}                               | (-5,0)
+ (-10,0)           | {0,3,0}                               | (-10,0)
+ (-10,0)           | {1,-1,0}                              | (-5,-5)
+ (-10,0)           | {-0.4,-1,-6}                          | (-10.6896551724,-1.72413793103)
+ (-10,0)           | {-0.000184615384615,-1,15.3846153846} | (-9.99715942258,15.386461014)
+ (-10,0)           | {3,NaN,5}                             | 
+ (-10,0)           | {NaN,NaN,NaN}                         | 
+ (-10,0)           | {0,-1,3}                              | (-10,3)
+ (-10,0)           | {-1,0,3}                              | (3,0)
+ (-3,4)            | {0,-1,5}                              | (-3,5)
+ (-3,4)            | {1,0,5}                               | (-5,4)
+ (-3,4)            | {0,3,0}                               | (-3,0)
+ (-3,4)            | {1,-1,0}                              | (0.5,0.5)
+ (-3,4)            | {-0.4,-1,-6}                          | (-6.03448275862,-3.58620689655)
+ (-3,4)            | {-0.000184615384615,-1,15.3846153846} | (-2.99789812268,15.3851688427)
+ (-3,4)            | {3,NaN,5}                             | 
+ (-3,4)            | {NaN,NaN,NaN}                         | 
+ (-3,4)            | {0,-1,3}                              | (-3,3)
+ (-3,4)            | {-1,0,3}                              | (3,4)
+ (5.1,34.5)        | {0,-1,5}                              | (5.1,5)
+ (5.1,34.5)        | {1,0,5}                               | (-5,34.5)
+ (5.1,34.5)        | {0,3,0}                               | (5.1,0)
+ (5.1,34.5)        | {1,-1,0}                              | (19.8,19.8)
+ (5.1,34.5)        | {-0.4,-1,-6}                          | (-9.56896551724,-2.1724137931)
+ (5.1,34.5)        | {-0.000184615384615,-1,15.3846153846} | (5.09647083221,15.3836744977)
+ (5.1,34.5)        | {3,NaN,5}                             | 
+ (5.1,34.5)        | {NaN,NaN,NaN}                         | 
+ (5.1,34.5)        | {0,-1,3}                              | (5.1,3)
+ (5.1,34.5)        | {-1,0,3}                              | (3,34.5)
+ (-5,-12)          | {0,-1,5}                              | (-5,5)
+ (-5,-12)          | {1,0,5}                               | (-5,-12)
+ (-5,-12)          | {0,3,0}                               | (-5,0)
+ (-5,-12)          | {1,-1,0}                              | (-8.5,-8.5)
+ (-5,-12)          | {-0.4,-1,-6}                          | (-2.24137931034,-5.10344827586)
+ (-5,-12)          | {-0.000184615384615,-1,15.3846153846} | (-4.99494420846,15.3855375282)
+ (-5,-12)          | {3,NaN,5}                             | 
+ (-5,-12)          | {NaN,NaN,NaN}                         | 
+ (-5,-12)          | {0,-1,3}                              | (-5,3)
+ (-5,-12)          | {-1,0,3}                              | (3,-12)
+ (1e-300,-1e-300)  | {0,-1,5}                              | (1e-300,5)
+ (1e-300,-1e-300)  | {1,0,5}                               | (-5,-1e-300)
+ (1e-300,-1e-300)  | {0,3,0}                               | (1e-300,0)
+ (1e-300,-1e-300)  | {1,-1,0}                              | (0,0)
+ (1e-300,-1e-300)  | {-0.4,-1,-6}                          | (-2.06896551724,-5.1724137931)
+ (1e-300,-1e-300)  | {-0.000184615384615,-1,15.3846153846} | (0.00284023658959,15.3846148603)
+ (1e-300,-1e-300)  | {3,NaN,5}                             | 
+ (1e-300,-1e-300)  | {NaN,NaN,NaN}                         | 
+ (1e-300,-1e-300)  | {0,-1,3}                              | (1e-300,3)
+ (1e-300,-1e-300)  | {-1,0,3}                              | (3,-1e-300)
+ (1e+300,Infinity) | {0,-1,5}                              | (1e+300,5)
+ (1e+300,Infinity) | {1,0,5}                               | 
+ (1e+300,Infinity) | {0,3,0}                               | (1e+300,0)
+ (1e+300,Infinity) | {1,-1,0}                              | (Infinity,NaN)
+ (1e+300,Infinity) | {-0.4,-1,-6}                          | (-Infinity,NaN)
+ (1e+300,Infinity) | {-0.000184615384615,-1,15.3846153846} | (-Infinity,NaN)
+ (1e+300,Infinity) | {3,NaN,5}                             | 
+ (1e+300,Infinity) | {NaN,NaN,NaN}                         | 
+ (1e+300,Infinity) | {0,-1,3}                              | (1e+300,3)
+ (1e+300,Infinity) | {-1,0,3}                              | 
+ (NaN,NaN)         | {0,-1,5}                              | 
+ (NaN,NaN)         | {1,0,5}                               | 
+ (NaN,NaN)         | {0,3,0}                               | 
+ (NaN,NaN)         | {1,-1,0}                              | 
+ (NaN,NaN)         | {-0.4,-1,-6}                          | 
+ (NaN,NaN)         | {-0.000184615384615,-1,15.3846153846} | 
+ (NaN,NaN)         | {3,NaN,5}                             | 
+ (NaN,NaN)         | {NaN,NaN,NaN}                         | 
+ (NaN,NaN)         | {0,-1,3}                              | 
+ (NaN,NaN)         | {-1,0,3}                              | 
+ (10,10)           | {0,-1,5}                              | (10,5)
+ (10,10)           | {1,0,5}                               | (-5,10)
+ (10,10)           | {0,3,0}                               | (10,0)
+ (10,10)           | {1,-1,0}                              | (10,10)
+ (10,10)           | {-0.4,-1,-6}                          | (3.10344827586,-7.24137931034)
+ (10,10)           | {-0.000184615384615,-1,15.3846153846} | (10.000993742,15.3827690473)
+ (10,10)           | {3,NaN,5}                             | 
+ (10,10)           | {NaN,NaN,NaN}                         | 
+ (10,10)           | {0,-1,3}                              | (10,3)
+ (10,10)           | {-1,0,3}                              | (3,10)
+(90 rows)
+
+-- Closest point to line segment
+SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LSEG_TBL l;
+        f1         |               s               |             ?column?             
+-------------------+-------------------------------+----------------------------------
+ (0,0)             | [(1,2),(3,4)]                 | (1,2)
+ (0,0)             | [(0,0),(6,6)]                 | (0,0)
+ (0,0)             | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
+ (0,0)             | [(-1000000,200),(300000,-40)] | (0.00284023658959,15.3846148603)
+ (0,0)             | [(11,22),(33,44)]             | (11,22)
+ (0,0)             | [(-10,2),(-10,3)]             | (-10,2)
+ (0,0)             | [(0,-20),(30,-20)]            | (0,-20)
+ (0,0)             | [(NaN,1),(NaN,90)]            | 
+ (-10,0)           | [(1,2),(3,4)]                 | (1,2)
+ (-10,0)           | [(0,0),(6,6)]                 | (0,0)
+ (-10,0)           | [(10,-10),(-3,-4)]            | (-3,-4)
+ (-10,0)           | [(-1000000,200),(300000,-40)] | (-9.99715942258,15.386461014)
+ (-10,0)           | [(11,22),(33,44)]             | (11,22)
+ (-10,0)           | [(-10,2),(-10,3)]             | (-10,2)
+ (-10,0)           | [(0,-20),(30,-20)]            | (0,-20)
+ (-10,0)           | [(NaN,1),(NaN,90)]            | 
+ (-3,4)            | [(1,2),(3,4)]                 | (1,2)
+ (-3,4)            | [(0,0),(6,6)]                 | (0.5,0.5)
+ (-3,4)            | [(10,-10),(-3,-4)]            | (-3,-4)
+ (-3,4)            | [(-1000000,200),(300000,-40)] | (-2.99789812268,15.3851688427)
+ (-3,4)            | [(11,22),(33,44)]             | (11,22)
+ (-3,4)            | [(-10,2),(-10,3)]             | (-10,3)
+ (-3,4)            | [(0,-20),(30,-20)]            | (0,-20)
+ (-3,4)            | [(NaN,1),(NaN,90)]            | 
+ (5.1,34.5)        | [(1,2),(3,4)]                 | (3,4)
+ (5.1,34.5)        | [(0,0),(6,6)]                 | (6,6)
+ (5.1,34.5)        | [(10,-10),(-3,-4)]            | (-3,-4)
+ (5.1,34.5)        | [(-1000000,200),(300000,-40)] | (5.09647083221,15.3836744977)
+ (5.1,34.5)        | [(11,22),(33,44)]             | (14.3,25.3)
+ (5.1,34.5)        | [(-10,2),(-10,3)]             | (-10,3)
+ (5.1,34.5)        | [(0,-20),(30,-20)]            | (5.1,-20)
+ (5.1,34.5)        | [(NaN,1),(NaN,90)]            | 
+ (-5,-12)          | [(1,2),(3,4)]                 | (1,2)
+ (-5,-12)          | [(0,0),(6,6)]                 | (0,0)
+ (-5,-12)          | [(10,-10),(-3,-4)]            | (-1.60487804878,-4.64390243902)
+ (-5,-12)          | [(-1000000,200),(300000,-40)] | (-4.99494420846,15.3855375282)
+ (-5,-12)          | [(11,22),(33,44)]             | (11,22)
+ (-5,-12)          | [(-10,2),(-10,3)]             | (-10,2)
+ (-5,-12)          | [(0,-20),(30,-20)]            | (0,-20)
+ (-5,-12)          | [(NaN,1),(NaN,90)]            | 
+ (1e-300,-1e-300)  | [(1,2),(3,4)]                 | (1,2)
+ (1e-300,-1e-300)  | [(0,0),(6,6)]                 | (0,0)
+ (1e-300,-1e-300)  | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
+ (1e-300,-1e-300)  | [(-1000000,200),(300000,-40)] | (0.00284023658959,15.3846148603)
+ (1e-300,-1e-300)  | [(11,22),(33,44)]             | (11,22)
+ (1e-300,-1e-300)  | [(-10,2),(-10,3)]             | (-10,2)
+ (1e-300,-1e-300)  | [(0,-20),(30,-20)]            | (0,-20)
+ (1e-300,-1e-300)  | [(NaN,1),(NaN,90)]            | 
+ (1e+300,Infinity) | [(1,2),(3,4)]                 | (3,4)
+ (1e+300,Infinity) | [(0,0),(6,6)]                 | (6,6)
+ (1e+300,Infinity) | [(10,-10),(-3,-4)]            | (-3,-4)
+ (1e+300,Infinity) | [(-1000000,200),(300000,-40)] | (300000,-40)
+ (1e+300,Infinity) | [(11,22),(33,44)]             | (33,44)
+ (1e+300,Infinity) | [(-10,2),(-10,3)]             | (-10,3)
+ (1e+300,Infinity) | [(0,-20),(30,-20)]            | (30,-20)
+ (1e+300,Infinity) | [(NaN,1),(NaN,90)]            | (NaN,90)
+ (NaN,NaN)         | [(1,2),(3,4)]                 | 
+ (NaN,NaN)         | [(0,0),(6,6)]                 | 
+ (NaN,NaN)         | [(10,-10),(-3,-4)]            | 
+ (NaN,NaN)         | [(-1000000,200),(300000,-40)] | 
+ (NaN,NaN)         | [(11,22),(33,44)]             | 
+ (NaN,NaN)         | [(-10,2),(-10,3)]             | 
+ (NaN,NaN)         | [(0,-20),(30,-20)]            | 
+ (NaN,NaN)         | [(NaN,1),(NaN,90)]            | 
+ (10,10)           | [(1,2),(3,4)]                 | (3,4)
+ (10,10)           | [(0,0),(6,6)]                 | (6,6)
+ (10,10)           | [(10,-10),(-3,-4)]            | (2.39024390244,-6.48780487805)
+ (10,10)           | [(-1000000,200),(300000,-40)] | (10.000993742,15.3827690473)
+ (10,10)           | [(11,22),(33,44)]             | (11,22)
+ (10,10)           | [(-10,2),(-10,3)]             | (-10,3)
+ (10,10)           | [(0,-20),(30,-20)]            | (10,-20)
+ (10,10)           | [(NaN,1),(NaN,90)]            | 
+(72 rows)
+
+-- Closest point to box
+SELECT p.f1, b.f1, p.f1 ## b.f1 FROM POINT_TBL p, BOX_TBL b;
+        f1         |         f1          |   ?column?   
+-------------------+---------------------+--------------
+ (0,0)             | (2,2),(0,0)         | (0,0)
+ (0,0)             | (3,3),(1,1)         | (1,1)
+ (0,0)             | (-2,2),(-8,-10)     | (-2,0)
+ (0,0)             | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
+ (0,0)             | (3,3),(3,3)         | (3,3)
+ (-10,0)           | (2,2),(0,0)         | (0,0)
+ (-10,0)           | (3,3),(1,1)         | (1,1)
+ (-10,0)           | (-2,2),(-8,-10)     | (-8,0)
+ (-10,0)           | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
+ (-10,0)           | (3,3),(3,3)         | (3,3)
+ (-3,4)            | (2,2),(0,0)         | (0,2)
+ (-3,4)            | (3,3),(1,1)         | (1,3)
+ (-3,4)            | (-2,2),(-8,-10)     | (-3,2)
+ (-3,4)            | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
+ (-3,4)            | (3,3),(3,3)         | (3,3)
+ (5.1,34.5)        | (2,2),(0,0)         | (2,2)
+ (5.1,34.5)        | (3,3),(1,1)         | (3,3)
+ (5.1,34.5)        | (-2,2),(-8,-10)     | (-2,2)
+ (5.1,34.5)        | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
+ (5.1,34.5)        | (3,3),(3,3)         | (3,3)
+ (-5,-12)          | (2,2),(0,0)         | (0,0)
+ (-5,-12)          | (3,3),(1,1)         | (1,1)
+ (-5,-12)          | (-2,2),(-8,-10)     | (-5,-10)
+ (-5,-12)          | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
+ (-5,-12)          | (3,3),(3,3)         | (3,3)
+ (1e-300,-1e-300)  | (2,2),(0,0)         | (0,0)
+ (1e-300,-1e-300)  | (3,3),(1,1)         | (1,1)
+ (1e-300,-1e-300)  | (-2,2),(-8,-10)     | (-2,-1e-300)
+ (1e-300,-1e-300)  | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
+ (1e-300,-1e-300)  | (3,3),(3,3)         | (3,3)
+ (1e+300,Infinity) | (2,2),(0,0)         | (0,2)
+ (1e+300,Infinity) | (3,3),(1,1)         | (1,3)
+ (1e+300,Infinity) | (-2,2),(-8,-10)     | (-8,2)
+ (1e+300,Infinity) | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
+ (1e+300,Infinity) | (3,3),(3,3)         | (3,3)
+ (NaN,NaN)         | (2,2),(0,0)         | 
+ (NaN,NaN)         | (3,3),(1,1)         | 
+ (NaN,NaN)         | (-2,2),(-8,-10)     | 
+ (NaN,NaN)         | (2.5,3.5),(2.5,2.5) | 
+ (NaN,NaN)         | (3,3),(3,3)         | 
+ (10,10)           | (2,2),(0,0)         | (2,2)
+ (10,10)           | (3,3),(1,1)         | (3,3)
+ (10,10)           | (-2,2),(-8,-10)     | (-2,2)
+ (10,10)           | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
+ (10,10)           | (3,3),(3,3)         | (3,3)
+(45 rows)
+
+-- On line
+SELECT p.f1, l.s FROM POINT_TBL p, LINE_TBL l WHERE p.f1 <@ l.s;
+        f1        |    s     
+------------------+----------
+ (0,0)            | {0,3,0}
+ (0,0)            | {1,-1,0}
+ (-10,0)          | {0,3,0}
+ (-5,-12)         | {1,0,5}
+ (1e-300,-1e-300) | {0,3,0}
+ (1e-300,-1e-300) | {1,-1,0}
+ (10,10)          | {1,-1,0}
+(7 rows)
+
+-- On line segment
+SELECT p.f1, l.s FROM POINT_TBL p, LSEG_TBL l WHERE p.f1 <@ l.s;
+        f1        |       s       
+------------------+---------------
+ (0,0)            | [(0,0),(6,6)]
+ (1e-300,-1e-300) | [(0,0),(6,6)]
+(2 rows)
+
+-- On path
+SELECT p.f1, p1.f1 FROM POINT_TBL p, PATH_TBL p1 WHERE p.f1 <@ p1.f1;
+        f1        |            f1             
+------------------+---------------------------
+ (0,0)            | [(0,0),(3,0),(4,5),(1,6)]
+ (1e-300,-1e-300) | [(0,0),(3,0),(4,5),(1,6)]
+ (NaN,NaN)        | ((1,2),(3,4))
+ (NaN,NaN)        | ((1,2),(3,4))
+ (NaN,NaN)        | ((1,2),(3,4))
+ (NaN,NaN)        | ((10,20))
+ (NaN,NaN)        | ((11,12),(13,14))
+(7 rows)
+
+--
+-- Lines
+--
+-- Vertical
+SELECT s FROM LINE_TBL WHERE ?| s;
+    s     
+----------
+ {1,0,5}
+ {-1,0,3}
+(2 rows)
+
+-- Horizontal
+SELECT s FROM LINE_TBL WHERE ?- s;
+    s     
+----------
+ {0,-1,5}
+ {0,3,0}
+ {0,-1,3}
+(3 rows)
+
+-- Same as line
+SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s = l2.s;
+                   s                   |                   s                   
+---------------------------------------+---------------------------------------
+ {0,-1,5}                              | {0,-1,5}
+ {1,0,5}                               | {1,0,5}
+ {0,3,0}                               | {0,3,0}
+ {1,-1,0}                              | {1,-1,0}
+ {-0.4,-1,-6}                          | {-0.4,-1,-6}
+ {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846}
+ {3,NaN,5}                             | {3,NaN,5}
+ {NaN,NaN,NaN}                         | {NaN,NaN,NaN}
+ {0,-1,3}                              | {0,-1,3}
+ {-1,0,3}                              | {-1,0,3}
+(10 rows)
+
+-- Parallel to line
+SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?|| l2.s;
+                   s                   |                   s                   
+---------------------------------------+---------------------------------------
+ {0,-1,5}                              | {0,-1,5}
+ {0,-1,5}                              | {0,3,0}
+ {0,-1,5}                              | {0,-1,3}
+ {1,0,5}                               | {1,0,5}
+ {1,0,5}                               | {-1,0,3}
+ {0,3,0}                               | {0,-1,5}
+ {0,3,0}                               | {0,3,0}
+ {0,3,0}                               | {0,-1,3}
+ {1,-1,0}                              | {1,-1,0}
+ {-0.4,-1,-6}                          | {-0.4,-1,-6}
+ {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846}
+ {0,-1,3}                              | {0,-1,5}
+ {0,-1,3}                              | {0,3,0}
+ {0,-1,3}                              | {0,-1,3}
+ {-1,0,3}                              | {1,0,5}
+ {-1,0,3}                              | {-1,0,3}
+(16 rows)
+
+-- Perpendicular to line
+SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?-| l2.s;
+    s     |    s     
+----------+----------
+ {0,-1,5} | {1,0,5}
+ {0,-1,5} | {-1,0,3}
+ {1,0,5}  | {0,-1,5}
+ {1,0,5}  | {0,3,0}
+ {1,0,5}  | {0,-1,3}
+ {0,3,0}  | {1,0,5}
+ {0,3,0}  | {-1,0,3}
+ {0,-1,3} | {1,0,5}
+ {0,-1,3} | {-1,0,3}
+ {-1,0,3} | {0,-1,5}
+ {-1,0,3} | {0,3,0}
+ {-1,0,3} | {0,-1,3}
+(12 rows)
+
+-- Distance to line
+SELECT l1.s, l2.s, l1.s <-> l2.s FROM LINE_TBL l1, LINE_TBL l2;
+                   s                   |                   s                   | ?column? 
+---------------------------------------+---------------------------------------+----------
+ {0,-1,5}                              | {0,-1,5}                              |        0
+ {0,-1,5}                              | {1,0,5}                               |        0
+ {0,-1,5}                              | {0,3,0}                               |        5
+ {0,-1,5}                              | {1,-1,0}                              |        0
+ {0,-1,5}                              | {-0.4,-1,-6}                          |        0
+ {0,-1,5}                              | {-0.000184615384615,-1,15.3846153846} |        0
+ {0,-1,5}                              | {3,NaN,5}                             |        0
+ {0,-1,5}                              | {NaN,NaN,NaN}                         |        0
+ {0,-1,5}                              | {0,-1,3}                              |        2
+ {0,-1,5}                              | {-1,0,3}                              |        0
+ {1,0,5}                               | {0,-1,5}                              |        0
+ {1,0,5}                               | {1,0,5}                               |        0
+ {1,0,5}                               | {0,3,0}                               |        0
+ {1,0,5}                               | {1,-1,0}                              |        0
+ {1,0,5}                               | {-0.4,-1,-6}                          |        0
+ {1,0,5}                               | {-0.000184615384615,-1,15.3846153846} |        0
+ {1,0,5}                               | {3,NaN,5}                             |        0
+ {1,0,5}                               | {NaN,NaN,NaN}                         |        0
+ {1,0,5}                               | {0,-1,3}                              |        0
+ {1,0,5}                               | {-1,0,3}                              |        8
+ {0,3,0}                               | {0,-1,5}                              |        5
+ {0,3,0}                               | {1,0,5}                               |        0
+ {0,3,0}                               | {0,3,0}                               |        0
+ {0,3,0}                               | {1,-1,0}                              |        0
+ {0,3,0}                               | {-0.4,-1,-6}                          |        0
+ {0,3,0}                               | {-0.000184615384615,-1,15.3846153846} |        0
+ {0,3,0}                               | {3,NaN,5}                             |        0
+ {0,3,0}                               | {NaN,NaN,NaN}                         |        0
+ {0,3,0}                               | {0,-1,3}                              |        3
+ {0,3,0}                               | {-1,0,3}                              |        0
+ {1,-1,0}                              | {0,-1,5}                              |        0
+ {1,-1,0}                              | {1,0,5}                               |        0
+ {1,-1,0}                              | {0,3,0}                               |        0
+ {1,-1,0}                              | {1,-1,0}                              |        0
+ {1,-1,0}                              | {-0.4,-1,-6}                          |        0
+ {1,-1,0}                              | {-0.000184615384615,-1,15.3846153846} |        0
+ {1,-1,0}                              | {3,NaN,5}                             |        0
+ {1,-1,0}                              | {NaN,NaN,NaN}                         |        0
+ {1,-1,0}                              | {0,-1,3}                              |        0
+ {1,-1,0}                              | {-1,0,3}                              |        0
+ {-0.4,-1,-6}                          | {0,-1,5}                              |        0
+ {-0.4,-1,-6}                          | {1,0,5}                               |        0
+ {-0.4,-1,-6}                          | {0,3,0}                               |        0
+ {-0.4,-1,-6}                          | {1,-1,0}                              |        0
+ {-0.4,-1,-6}                          | {-0.4,-1,-6}                          |        0
+ {-0.4,-1,-6}                          | {-0.000184615384615,-1,15.3846153846} |        0
+ {-0.4,-1,-6}                          | {3,NaN,5}                             |        0
+ {-0.4,-1,-6}                          | {NaN,NaN,NaN}                         |        0
+ {-0.4,-1,-6}                          | {0,-1,3}                              |        0
+ {-0.4,-1,-6}                          | {-1,0,3}                              |        0
+ {-0.000184615384615,-1,15.3846153846} | {0,-1,5}                              |        0
+ {-0.000184615384615,-1,15.3846153846} | {1,0,5}                               |        0
+ {-0.000184615384615,-1,15.3846153846} | {0,3,0}                               |        0
+ {-0.000184615384615,-1,15.3846153846} | {1,-1,0}                              |        0
+ {-0.000184615384615,-1,15.3846153846} | {-0.4,-1,-6}                          |        0
+ {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846} |        0
+ {-0.000184615384615,-1,15.3846153846} | {3,NaN,5}                             |        0
+ {-0.000184615384615,-1,15.3846153846} | {NaN,NaN,NaN}                         |        0
+ {-0.000184615384615,-1,15.3846153846} | {0,-1,3}                              |        0
+ {-0.000184615384615,-1,15.3846153846} | {-1,0,3}                              |        0
+ {3,NaN,5}                             | {0,-1,5}                              |        0
+ {3,NaN,5}                             | {1,0,5}                               |        0
+ {3,NaN,5}                             | {0,3,0}                               |        0
+ {3,NaN,5}                             | {1,-1,0}                              |        0
+ {3,NaN,5}                             | {-0.4,-1,-6}                          |        0
+ {3,NaN,5}                             | {-0.000184615384615,-1,15.3846153846} |        0
+ {3,NaN,5}                             | {3,NaN,5}                             |        0
+ {3,NaN,5}                             | {NaN,NaN,NaN}                         |        0
+ {3,NaN,5}                             | {0,-1,3}                              |        0
+ {3,NaN,5}                             | {-1,0,3}                              |        0
+ {NaN,NaN,NaN}                         | {0,-1,5}                              |        0
+ {NaN,NaN,NaN}                         | {1,0,5}                               |        0
+ {NaN,NaN,NaN}                         | {0,3,0}                               |        0
+ {NaN,NaN,NaN}                         | {1,-1,0}                              |        0
+ {NaN,NaN,NaN}                         | {-0.4,-1,-6}                          |        0
+ {NaN,NaN,NaN}                         | {-0.000184615384615,-1,15.3846153846} |        0
+ {NaN,NaN,NaN}                         | {3,NaN,5}                             |        0
+ {NaN,NaN,NaN}                         | {NaN,NaN,NaN}                         |        0
+ {NaN,NaN,NaN}                         | {0,-1,3}                              |        0
+ {NaN,NaN,NaN}                         | {-1,0,3}                              |        0
+ {0,-1,3}                              | {0,-1,5}                              |        2
+ {0,-1,3}                              | {1,0,5}                               |        0
+ {0,-1,3}                              | {0,3,0}                               |        3
+ {0,-1,3}                              | {1,-1,0}                              |        0
+ {0,-1,3}                              | {-0.4,-1,-6}                          |        0
+ {0,-1,3}                              | {-0.000184615384615,-1,15.3846153846} |        0
+ {0,-1,3}                              | {3,NaN,5}                             |        0
+ {0,-1,3}                              | {NaN,NaN,NaN}                         |        0
+ {0,-1,3}                              | {0,-1,3}                              |        0
+ {0,-1,3}                              | {-1,0,3}                              |        0
+ {-1,0,3}                              | {0,-1,5}                              |        0
+ {-1,0,3}                              | {1,0,5}                               |        8
+ {-1,0,3}                              | {0,3,0}                               |        0
+ {-1,0,3}                              | {1,-1,0}                              |        0
+ {-1,0,3}                              | {-0.4,-1,-6}                          |        0
+ {-1,0,3}                              | {-0.000184615384615,-1,15.3846153846} |        0
+ {-1,0,3}                              | {3,NaN,5}                             |        0
+ {-1,0,3}                              | {NaN,NaN,NaN}                         |        0
+ {-1,0,3}                              | {0,-1,3}                              |        0
+ {-1,0,3}                              | {-1,0,3}                              |        0
+(100 rows)
+
+-- Distance to box
+SELECT l.s, b.f1, l.s <-> b.f1 FROM LINE_TBL l, BOX_TBL b;
+ERROR:  function "dist_lb" not implemented
+-- Intersect with line
+SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?# l2.s;
+                   s                   |                   s                   
+---------------------------------------+---------------------------------------
+ {0,-1,5}                              | {1,0,5}
+ {0,-1,5}                              | {1,-1,0}
+ {0,-1,5}                              | {-0.4,-1,-6}
+ {0,-1,5}                              | {-0.000184615384615,-1,15.3846153846}
+ {0,-1,5}                              | {3,NaN,5}
+ {0,-1,5}                              | {NaN,NaN,NaN}
+ {0,-1,5}                              | {-1,0,3}
+ {1,0,5}                               | {0,-1,5}
+ {1,0,5}                               | {0,3,0}
+ {1,0,5}                               | {1,-1,0}
+ {1,0,5}                               | {-0.4,-1,-6}
+ {1,0,5}                               | {-0.000184615384615,-1,15.3846153846}
+ {1,0,5}                               | {3,NaN,5}
+ {1,0,5}                               | {NaN,NaN,NaN}
+ {1,0,5}                               | {0,-1,3}
+ {0,3,0}                               | {1,0,5}
+ {0,3,0}                               | {1,-1,0}
+ {0,3,0}                               | {-0.4,-1,-6}
+ {0,3,0}                               | {-0.000184615384615,-1,15.3846153846}
+ {0,3,0}                               | {3,NaN,5}
+ {0,3,0}                               | {NaN,NaN,NaN}
+ {0,3,0}                               | {-1,0,3}
+ {1,-1,0}                              | {0,-1,5}
+ {1,-1,0}                              | {1,0,5}
+ {1,-1,0}                              | {0,3,0}
+ {1,-1,0}                              | {-0.4,-1,-6}
+ {1,-1,0}                              | {-0.000184615384615,-1,15.3846153846}
+ {1,-1,0}                              | {3,NaN,5}
+ {1,-1,0}                              | {NaN,NaN,NaN}
+ {1,-1,0}                              | {0,-1,3}
+ {1,-1,0}                              | {-1,0,3}
+ {-0.4,-1,-6}                          | {0,-1,5}
+ {-0.4,-1,-6}                          | {1,0,5}
+ {-0.4,-1,-6}                          | {0,3,0}
+ {-0.4,-1,-6}                          | {1,-1,0}
+ {-0.4,-1,-6}                          | {-0.000184615384615,-1,15.3846153846}
+ {-0.4,-1,-6}                          | {3,NaN,5}
+ {-0.4,-1,-6}                          | {NaN,NaN,NaN}
+ {-0.4,-1,-6}                          | {0,-1,3}
+ {-0.4,-1,-6}                          | {-1,0,3}
+ {-0.000184615384615,-1,15.3846153846} | {0,-1,5}
+ {-0.000184615384615,-1,15.3846153846} | {1,0,5}
+ {-0.000184615384615,-1,15.3846153846} | {0,3,0}
+ {-0.000184615384615,-1,15.3846153846} | {1,-1,0}
+ {-0.000184615384615,-1,15.3846153846} | {-0.4,-1,-6}
+ {-0.000184615384615,-1,15.3846153846} | {3,NaN,5}
+ {-0.000184615384615,-1,15.3846153846} | {NaN,NaN,NaN}
+ {-0.000184615384615,-1,15.3846153846} | {0,-1,3}
+ {-0.000184615384615,-1,15.3846153846} | {-1,0,3}
+ {3,NaN,5}                             | {0,-1,5}
+ {3,NaN,5}                             | {1,0,5}
+ {3,NaN,5}                             | {0,3,0}
+ {3,NaN,5}                             | {1,-1,0}
+ {3,NaN,5}                             | {-0.4,-1,-6}
+ {3,NaN,5}                             | {-0.000184615384615,-1,15.3846153846}
+ {3,NaN,5}                             | {3,NaN,5}
+ {3,NaN,5}                             | {NaN,NaN,NaN}
+ {3,NaN,5}                             | {0,-1,3}
+ {3,NaN,5}                             | {-1,0,3}
+ {NaN,NaN,NaN}                         | {0,-1,5}
+ {NaN,NaN,NaN}                         | {1,0,5}
+ {NaN,NaN,NaN}                         | {0,3,0}
+ {NaN,NaN,NaN}                         | {1,-1,0}
+ {NaN,NaN,NaN}                         | {-0.4,-1,-6}
+ {NaN,NaN,NaN}                         | {-0.000184615384615,-1,15.3846153846}
+ {NaN,NaN,NaN}                         | {3,NaN,5}
+ {NaN,NaN,NaN}                         | {NaN,NaN,NaN}
+ {NaN,NaN,NaN}                         | {0,-1,3}
+ {NaN,NaN,NaN}                         | {-1,0,3}
+ {0,-1,3}                              | {1,0,5}
+ {0,-1,3}                              | {1,-1,0}
+ {0,-1,3}                              | {-0.4,-1,-6}
+ {0,-1,3}                              | {-0.000184615384615,-1,15.3846153846}
+ {0,-1,3}                              | {3,NaN,5}
+ {0,-1,3}                              | {NaN,NaN,NaN}
+ {0,-1,3}                              | {-1,0,3}
+ {-1,0,3}                              | {0,-1,5}
+ {-1,0,3}                              | {0,3,0}
+ {-1,0,3}                              | {1,-1,0}
+ {-1,0,3}                              | {-0.4,-1,-6}
+ {-1,0,3}                              | {-0.000184615384615,-1,15.3846153846}
+ {-1,0,3}                              | {3,NaN,5}
+ {-1,0,3}                              | {NaN,NaN,NaN}
+ {-1,0,3}                              | {0,-1,3}
+(84 rows)
+
+-- Intersect with box
+SELECT l.s, b.f1 FROM LINE_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
+      s       |         f1          
+--------------+---------------------
+ {1,0,5}      | (-2,2),(-8,-10)
+ {0,3,0}      | (2,2),(0,0)
+ {0,3,0}      | (-2,2),(-8,-10)
+ {1,-1,0}     | (2,2),(0,0)
+ {1,-1,0}     | (3,3),(1,1)
+ {1,-1,0}     | (-2,2),(-8,-10)
+ {1,-1,0}     | (2.5,3.5),(2.5,2.5)
+ {1,-1,0}     | (3,3),(3,3)
+ {-0.4,-1,-6} | (-2,2),(-8,-10)
+ {0,-1,3}     | (3,3),(1,1)
+ {0,-1,3}     | (2.5,3.5),(2.5,2.5)
+ {0,-1,3}     | (3,3),(3,3)
+ {-1,0,3}     | (3,3),(1,1)
+(13 rows)
+
+-- Intersection point with line
+SELECT l1.s, l2.s, l1.s # l2.s FROM LINE_TBL l1, LINE_TBL l2;
+                   s                   |                   s                   |             ?column?              
+---------------------------------------+---------------------------------------+-----------------------------------
+ {0,-1,5}                              | {0,-1,5}                              | 
+ {0,-1,5}                              | {1,0,5}                               | (-5,5)
+ {0,-1,5}                              | {0,3,0}                               | 
+ {0,-1,5}                              | {1,-1,0}                              | (5,5)
+ {0,-1,5}                              | {-0.4,-1,-6}                          | (-27.5,5)
+ {0,-1,5}                              | {-0.000184615384615,-1,15.3846153846} | (56250,5)
+ {0,-1,5}                              | {3,NaN,5}                             | (NaN,NaN)
+ {0,-1,5}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
+ {0,-1,5}                              | {0,-1,3}                              | 
+ {0,-1,5}                              | {-1,0,3}                              | (3,5)
+ {1,0,5}                               | {0,-1,5}                              | (-5,5)
+ {1,0,5}                               | {1,0,5}                               | 
+ {1,0,5}                               | {0,3,0}                               | (-5,0)
+ {1,0,5}                               | {1,-1,0}                              | (-5,-5)
+ {1,0,5}                               | {-0.4,-1,-6}                          | (-5,-4)
+ {1,0,5}                               | {-0.000184615384615,-1,15.3846153846} | (-5,15.3855384615)
+ {1,0,5}                               | {3,NaN,5}                             | (-5,NaN)
+ {1,0,5}                               | {NaN,NaN,NaN}                         | (-5,NaN)
+ {1,0,5}                               | {0,-1,3}                              | (-5,3)
+ {1,0,5}                               | {-1,0,3}                              | 
+ {0,3,0}                               | {0,-1,5}                              | 
+ {0,3,0}                               | {1,0,5}                               | (-5,0)
+ {0,3,0}                               | {0,3,0}                               | 
+ {0,3,0}                               | {1,-1,0}                              | (0,0)
+ {0,3,0}                               | {-0.4,-1,-6}                          | (-15,0)
+ {0,3,0}                               | {-0.000184615384615,-1,15.3846153846} | (83333.3333333,0)
+ {0,3,0}                               | {3,NaN,5}                             | (NaN,NaN)
+ {0,3,0}                               | {NaN,NaN,NaN}                         | (NaN,NaN)
+ {0,3,0}                               | {0,-1,3}                              | 
+ {0,3,0}                               | {-1,0,3}                              | (3,0)
+ {1,-1,0}                              | {0,-1,5}                              | (5,5)
+ {1,-1,0}                              | {1,0,5}                               | (-5,-5)
+ {1,-1,0}                              | {0,3,0}                               | (0,0)
+ {1,-1,0}                              | {1,-1,0}                              | 
+ {1,-1,0}                              | {-0.4,-1,-6}                          | (-4.28571428571,-4.28571428571)
+ {1,-1,0}                              | {-0.000184615384615,-1,15.3846153846} | (15.3817756722,15.3817756722)
+ {1,-1,0}                              | {3,NaN,5}                             | (NaN,NaN)
+ {1,-1,0}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
+ {1,-1,0}                              | {0,-1,3}                              | (3,3)
+ {1,-1,0}                              | {-1,0,3}                              | (3,3)
+ {-0.4,-1,-6}                          | {0,-1,5}                              | (-27.5,5)
+ {-0.4,-1,-6}                          | {1,0,5}                               | (-5,-4)
+ {-0.4,-1,-6}                          | {0,3,0}                               | (-15,0)
+ {-0.4,-1,-6}                          | {1,-1,0}                              | (-4.28571428571,-4.28571428571)
+ {-0.4,-1,-6}                          | {-0.4,-1,-6}                          | 
+ {-0.4,-1,-6}                          | {-0.000184615384615,-1,15.3846153846} | (-53.4862244113,15.3944897645)
+ {-0.4,-1,-6}                          | {3,NaN,5}                             | (NaN,NaN)
+ {-0.4,-1,-6}                          | {NaN,NaN,NaN}                         | (NaN,NaN)
+ {-0.4,-1,-6}                          | {0,-1,3}                              | (-22.5,3)
+ {-0.4,-1,-6}                          | {-1,0,3}                              | (3,-7.2)
+ {-0.000184615384615,-1,15.3846153846} | {0,-1,5}                              | (56250,5)
+ {-0.000184615384615,-1,15.3846153846} | {1,0,5}                               | (-5,15.3855384615)
+ {-0.000184615384615,-1,15.3846153846} | {0,3,0}                               | (83333.3333333,-1.7763568394e-15)
+ {-0.000184615384615,-1,15.3846153846} | {1,-1,0}                              | (15.3817756722,15.3817756722)
+ {-0.000184615384615,-1,15.3846153846} | {-0.4,-1,-6}                          | (-53.4862244113,15.3944897645)
+ {-0.000184615384615,-1,15.3846153846} | {-0.000184615384615,-1,15.3846153846} | 
+ {-0.000184615384615,-1,15.3846153846} | {3,NaN,5}                             | (NaN,NaN)
+ {-0.000184615384615,-1,15.3846153846} | {NaN,NaN,NaN}                         | (NaN,NaN)
+ {-0.000184615384615,-1,15.3846153846} | {0,-1,3}                              | (67083.3333333,3)
+ {-0.000184615384615,-1,15.3846153846} | {-1,0,3}                              | (3,15.3840615385)
+ {3,NaN,5}                             | {0,-1,5}                              | (NaN,NaN)
+ {3,NaN,5}                             | {1,0,5}                               | (-5,NaN)
+ {3,NaN,5}                             | {0,3,0}                               | (NaN,NaN)
+ {3,NaN,5}                             | {1,-1,0}                              | (NaN,NaN)
+ {3,NaN,5}                             | {-0.4,-1,-6}                          | (NaN,NaN)
+ {3,NaN,5}                             | {-0.000184615384615,-1,15.3846153846} | (NaN,NaN)
+ {3,NaN,5}                             | {3,NaN,5}                             | (NaN,NaN)
+ {3,NaN,5}                             | {NaN,NaN,NaN}                         | (NaN,NaN)
+ {3,NaN,5}                             | {0,-1,3}                              | (NaN,NaN)
+ {3,NaN,5}                             | {-1,0,3}                              | (3,NaN)
+ {NaN,NaN,NaN}                         | {0,-1,5}                              | (NaN,NaN)
+ {NaN,NaN,NaN}                         | {1,0,5}                               | (-5,NaN)
+ {NaN,NaN,NaN}                         | {0,3,0}                               | (NaN,NaN)
+ {NaN,NaN,NaN}                         | {1,-1,0}                              | (NaN,NaN)
+ {NaN,NaN,NaN}                         | {-0.4,-1,-6}                          | (NaN,NaN)
+ {NaN,NaN,NaN}                         | {-0.000184615384615,-1,15.3846153846} | (NaN,NaN)
+ {NaN,NaN,NaN}                         | {3,NaN,5}                             | (NaN,NaN)
+ {NaN,NaN,NaN}                         | {NaN,NaN,NaN}                         | (NaN,NaN)
+ {NaN,NaN,NaN}                         | {0,-1,3}                              | (NaN,NaN)
+ {NaN,NaN,NaN}                         | {-1,0,3}                              | (3,NaN)
+ {0,-1,3}                              | {0,-1,5}                              | 
+ {0,-1,3}                              | {1,0,5}                               | (-5,3)
+ {0,-1,3}                              | {0,3,0}                               | 
+ {0,-1,3}                              | {1,-1,0}                              | (3,3)
+ {0,-1,3}                              | {-0.4,-1,-6}                          | (-22.5,3)
+ {0,-1,3}                              | {-0.000184615384615,-1,15.3846153846} | (67083.3333333,3)
+ {0,-1,3}                              | {3,NaN,5}                             | (NaN,NaN)
+ {0,-1,3}                              | {NaN,NaN,NaN}                         | (NaN,NaN)
+ {0,-1,3}                              | {0,-1,3}                              | 
+ {0,-1,3}                              | {-1,0,3}                              | (3,3)
+ {-1,0,3}                              | {0,-1,5}                              | (3,5)
+ {-1,0,3}                              | {1,0,5}                               | 
+ {-1,0,3}                              | {0,3,0}                               | (3,0)
+ {-1,0,3}                              | {1,-1,0}                              | (3,3)
+ {-1,0,3}                              | {-0.4,-1,-6}                          | (3,-7.2)
+ {-1,0,3}                              | {-0.000184615384615,-1,15.3846153846} | (3,15.3840615385)
+ {-1,0,3}                              | {3,NaN,5}                             | (3,NaN)
+ {-1,0,3}                              | {NaN,NaN,NaN}                         | (3,NaN)
+ {-1,0,3}                              | {0,-1,3}                              | (3,3)
+ {-1,0,3}                              | {-1,0,3}                              | 
+(100 rows)
+
+-- Closest point to line segment
+SELECT l.s, l1.s, l.s ## l1.s FROM LINE_TBL l, LSEG_TBL l1;
+                   s                   |               s               |             ?column?              
+---------------------------------------+-------------------------------+-----------------------------------
+ {0,-1,5}                              | [(1,2),(3,4)]                 | (3,4)
+ {0,-1,5}                              | [(0,0),(6,6)]                 | (5,5)
+ {0,-1,5}                              | [(10,-10),(-3,-4)]            | (-3,-4)
+ {0,-1,5}                              | [(-1000000,200),(300000,-40)] | (56250,5)
+ {0,-1,5}                              | [(11,22),(33,44)]             | (11,22)
+ {0,-1,5}                              | [(-10,2),(-10,3)]             | (-10,3)
+ {0,-1,5}                              | [(0,-20),(30,-20)]            | 
+ {0,-1,5}                              | [(NaN,1),(NaN,90)]            | 
+ {1,0,5}                               | [(1,2),(3,4)]                 | (1,2)
+ {1,0,5}                               | [(0,0),(6,6)]                 | (0,0)
+ {1,0,5}                               | [(10,-10),(-3,-4)]            | (-3,-4)
+ {1,0,5}                               | [(-1000000,200),(300000,-40)] | (-5,15.3855384615)
+ {1,0,5}                               | [(11,22),(33,44)]             | (11,22)
+ {1,0,5}                               | [(-10,2),(-10,3)]             | 
+ {1,0,5}                               | [(0,-20),(30,-20)]            | (0,-20)
+ {1,0,5}                               | [(NaN,1),(NaN,90)]            | 
+ {0,3,0}                               | [(1,2),(3,4)]                 | (1,2)
+ {0,3,0}                               | [(0,0),(6,6)]                 | (0,0)
+ {0,3,0}                               | [(10,-10),(-3,-4)]            | (-3,-4)
+ {0,3,0}                               | [(-1000000,200),(300000,-40)] | (83333.3333333,-1.7763568394e-15)
+ {0,3,0}                               | [(11,22),(33,44)]             | (11,22)
+ {0,3,0}                               | [(-10,2),(-10,3)]             | (-10,2)
+ {0,3,0}                               | [(0,-20),(30,-20)]            | 
+ {0,3,0}                               | [(NaN,1),(NaN,90)]            | 
+ {1,-1,0}                              | [(1,2),(3,4)]                 | 
+ {1,-1,0}                              | [(0,0),(6,6)]                 | 
+ {1,-1,0}                              | [(10,-10),(-3,-4)]            | (-3,-4)
+ {1,-1,0}                              | [(-1000000,200),(300000,-40)] | (15.3817756722,15.3817756722)
+ {1,-1,0}                              | [(11,22),(33,44)]             | 
+ {1,-1,0}                              | [(-10,2),(-10,3)]             | (-10,2)
+ {1,-1,0}                              | [(0,-20),(30,-20)]            | (0,-20)
+ {1,-1,0}                              | [(NaN,1),(NaN,90)]            | 
+ {-0.4,-1,-6}                          | [(1,2),(3,4)]                 | (1,2)
+ {-0.4,-1,-6}                          | [(0,0),(6,6)]                 | (0,0)
+ {-0.4,-1,-6}                          | [(10,-10),(-3,-4)]            | (10,-10)
+ {-0.4,-1,-6}                          | [(-1000000,200),(300000,-40)] | (-53.4862244113,15.3944897645)
+ {-0.4,-1,-6}                          | [(11,22),(33,44)]             | (11,22)
+ {-0.4,-1,-6}                          | [(-10,2),(-10,3)]             | (-10,2)
+ {-0.4,-1,-6}                          | [(0,-20),(30,-20)]            | (30,-20)
+ {-0.4,-1,-6}                          | [(NaN,1),(NaN,90)]            | 
+ {-0.000184615384615,-1,15.3846153846} | [(1,2),(3,4)]                 | (3,4)
+ {-0.000184615384615,-1,15.3846153846} | [(0,0),(6,6)]                 | (6,6)
+ {-0.000184615384615,-1,15.3846153846} | [(10,-10),(-3,-4)]            | (-3,-4)
+ {-0.000184615384615,-1,15.3846153846} | [(-1000000,200),(300000,-40)] | 
+ {-0.000184615384615,-1,15.3846153846} | [(11,22),(33,44)]             | (11,22)
+ {-0.000184615384615,-1,15.3846153846} | [(-10,2),(-10,3)]             | (-10,3)
+ {-0.000184615384615,-1,15.3846153846} | [(0,-20),(30,-20)]            | (30,-20)
+ {-0.000184615384615,-1,15.3846153846} | [(NaN,1),(NaN,90)]            | 
+ {3,NaN,5}                             | [(1,2),(3,4)]                 | 
+ {3,NaN,5}                             | [(0,0),(6,6)]                 | 
+ {3,NaN,5}                             | [(10,-10),(-3,-4)]            | 
+ {3,NaN,5}                             | [(-1000000,200),(300000,-40)] | 
+ {3,NaN,5}                             | [(11,22),(33,44)]             | 
+ {3,NaN,5}                             | [(-10,2),(-10,3)]             | 
+ {3,NaN,5}                             | [(0,-20),(30,-20)]            | 
+ {3,NaN,5}                             | [(NaN,1),(NaN,90)]            | 
+ {NaN,NaN,NaN}                         | [(1,2),(3,4)]                 | 
+ {NaN,NaN,NaN}                         | [(0,0),(6,6)]                 | 
+ {NaN,NaN,NaN}                         | [(10,-10),(-3,-4)]            | 
+ {NaN,NaN,NaN}                         | [(-1000000,200),(300000,-40)] | 
+ {NaN,NaN,NaN}                         | [(11,22),(33,44)]             | 
+ {NaN,NaN,NaN}                         | [(-10,2),(-10,3)]             | 
+ {NaN,NaN,NaN}                         | [(0,-20),(30,-20)]            | 
+ {NaN,NaN,NaN}                         | [(NaN,1),(NaN,90)]            | 
+ {0,-1,3}                              | [(1,2),(3,4)]                 | (2,3)
+ {0,-1,3}                              | [(0,0),(6,6)]                 | (3,3)
+ {0,-1,3}                              | [(10,-10),(-3,-4)]            | (-3,-4)
+ {0,-1,3}                              | [(-1000000,200),(300000,-40)] | (67083.3333333,3)
+ {0,-1,3}                              | [(11,22),(33,44)]             | (11,22)
+ {0,-1,3}                              | [(-10,2),(-10,3)]             | (-10,3)
+ {0,-1,3}                              | [(0,-20),(30,-20)]            | 
+ {0,-1,3}                              | [(NaN,1),(NaN,90)]            | 
+ {-1,0,3}                              | [(1,2),(3,4)]                 | (3,4)
+ {-1,0,3}                              | [(0,0),(6,6)]                 | (3,3)
+ {-1,0,3}                              | [(10,-10),(-3,-4)]            | (3,-6.76923076923)
+ {-1,0,3}                              | [(-1000000,200),(300000,-40)] | (3,15.3840615385)
+ {-1,0,3}                              | [(11,22),(33,44)]             | (11,22)
+ {-1,0,3}                              | [(-10,2),(-10,3)]             | 
+ {-1,0,3}                              | [(0,-20),(30,-20)]            | (3,-20)
+ {-1,0,3}                              | [(NaN,1),(NaN,90)]            | 
+(80 rows)
+
+-- Closest point to box
+SELECT l.s, b.f1, l.s ## b.f1 FROM LINE_TBL l, BOX_TBL b;
+ERROR:  function "close_lb" not implemented
 --
 -- Line segments
 --
 -- intersection
 SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
    FROM LSEG_TBL l, POINT_TBL p;
 ERROR:  operator does not exist: lseg # point
 LINE 1: SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
                                            ^
 HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
--- closest point
-SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
-   FROM LSEG_TBL l, POINT_TBL p;
- thirty |     f1     |               s               |             closest              
---------+------------+-------------------------------+----------------------------------
-        | (0,0)      | [(1,2),(3,4)]                 | (1,2)
-        | (0,0)      | [(0,0),(6,6)]                 | (-0,0)
-        | (0,0)      | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
-        | (0,0)      | [(-1000000,200),(300000,-40)] | (0.00284023658959,15.3846148603)
-        | (0,0)      | [(11,22),(33,44)]             | (11,22)
-        | (-10,0)    | [(1,2),(3,4)]                 | (1,2)
-        | (-10,0)    | [(0,0),(6,6)]                 | (0,0)
-        | (-10,0)    | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (-10,0)    | [(-1000000,200),(300000,-40)] | (-9.99715942258,15.386461014)
-        | (-10,0)    | [(11,22),(33,44)]             | (11,22)
-        | (-3,4)     | [(1,2),(3,4)]                 | (1,2)
-        | (-3,4)     | [(0,0),(6,6)]                 | (0.5,0.5)
-        | (-3,4)     | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (-3,4)     | [(-1000000,200),(300000,-40)] | (-2.99789812268,15.3851688427)
-        | (-3,4)     | [(11,22),(33,44)]             | (11,22)
-        | (5.1,34.5) | [(1,2),(3,4)]                 | (3,4)
-        | (5.1,34.5) | [(0,0),(6,6)]                 | (6,6)
-        | (5.1,34.5) | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (5.1,34.5) | [(-1000000,200),(300000,-40)] | (5.09647083221,15.3836744977)
-        | (5.1,34.5) | [(11,22),(33,44)]             | (14.3,25.3)
-        | (-5,-12)   | [(1,2),(3,4)]                 | (1,2)
-        | (-5,-12)   | [(0,0),(6,6)]                 | (0,0)
-        | (-5,-12)   | [(10,-10),(-3,-4)]            | (-1.60487804878,-4.64390243902)
-        | (-5,-12)   | [(-1000000,200),(300000,-40)] | (-4.99494420846,15.3855375282)
-        | (-5,-12)   | [(11,22),(33,44)]             | (11,22)
-        | (10,10)    | [(1,2),(3,4)]                 | (3,4)
-        | (10,10)    | [(0,0),(6,6)]                 | (6,6)
-        | (10,10)    | [(10,-10),(-3,-4)]            | (2.39024390244,-6.48780487805)
-        | (10,10)    | [(-1000000,200),(300000,-40)] | (10.000993742,15.3827690473)
-        | (10,10)    | [(11,22),(33,44)]             | (11,22)
-(30 rows)
+-- Length
+SELECT s, @-@ s FROM LSEG_TBL;
+               s               |   ?column?    
+-------------------------------+---------------
+ [(1,2),(3,4)]                 | 2.82842712475
+ [(0,0),(6,6)]                 | 8.48528137424
+ [(10,-10),(-3,-4)]            | 14.3178210633
+ [(-1000000,200),(300000,-40)] | 1300000.02215
+ [(11,22),(33,44)]             | 31.1126983722
+ [(-10,2),(-10,3)]             |             1
+ [(0,-20),(30,-20)]            |            30
+ [(NaN,1),(NaN,90)]            |           NaN
+(8 rows)
+
+-- Vertical
+SELECT s FROM LSEG_TBL WHERE ?| s;
+         s         
+-------------------
+ [(-10,2),(-10,3)]
+(1 row)
+
+-- Horizontal
+SELECT s FROM LSEG_TBL WHERE ?- s;
+         s          
+--------------------
+ [(0,-20),(30,-20)]
+(1 row)
+
+-- Center
+SELECT s, @@ s FROM LSEG_TBL;
+               s               |   ?column?   
+-------------------------------+--------------
+ [(1,2),(3,4)]                 | (2,3)
+ [(0,0),(6,6)]                 | (3,3)
+ [(10,-10),(-3,-4)]            | (3.5,-7)
+ [(-1000000,200),(300000,-40)] | (-350000,80)
+ [(11,22),(33,44)]             | (22,33)
+ [(-10,2),(-10,3)]             | (-10,2.5)
+ [(0,-20),(30,-20)]            | (15,-20)
+ [(NaN,1),(NaN,90)]            | (NaN,45.5)
+(8 rows)
+
+-- To point
+SELECT s, s::point FROM LSEG_TBL;
+               s               |      s       
+-------------------------------+--------------
+ [(1,2),(3,4)]                 | (2,3)
+ [(0,0),(6,6)]                 | (3,3)
+ [(10,-10),(-3,-4)]            | (3.5,-7)
+ [(-1000000,200),(300000,-40)] | (-350000,80)
+ [(11,22),(33,44)]             | (22,33)
+ [(-10,2),(-10,3)]             | (-10,2.5)
+ [(0,-20),(30,-20)]            | (15,-20)
+ [(NaN,1),(NaN,90)]            | (NaN,45.5)
+(8 rows)
+
+-- Has points less than line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s < l2.s;
+         s          |               s               
+--------------------+-------------------------------
+ [(1,2),(3,4)]      | [(0,0),(6,6)]
+ [(1,2),(3,4)]      | [(10,-10),(-3,-4)]
+ [(1,2),(3,4)]      | [(-1000000,200),(300000,-40)]
+ [(1,2),(3,4)]      | [(11,22),(33,44)]
+ [(1,2),(3,4)]      | [(0,-20),(30,-20)]
+ [(0,0),(6,6)]      | [(10,-10),(-3,-4)]
+ [(0,0),(6,6)]      | [(-1000000,200),(300000,-40)]
+ [(0,0),(6,6)]      | [(11,22),(33,44)]
+ [(0,0),(6,6)]      | [(0,-20),(30,-20)]
+ [(10,-10),(-3,-4)] | [(-1000000,200),(300000,-40)]
+ [(10,-10),(-3,-4)] | [(11,22),(33,44)]
+ [(10,-10),(-3,-4)] | [(0,-20),(30,-20)]
+ [(11,22),(33,44)]  | [(-1000000,200),(300000,-40)]
+ [(-10,2),(-10,3)]  | [(1,2),(3,4)]
+ [(-10,2),(-10,3)]  | [(0,0),(6,6)]
+ [(-10,2),(-10,3)]  | [(10,-10),(-3,-4)]
+ [(-10,2),(-10,3)]  | [(-1000000,200),(300000,-40)]
+ [(-10,2),(-10,3)]  | [(11,22),(33,44)]
+ [(-10,2),(-10,3)]  | [(0,-20),(30,-20)]
+ [(0,-20),(30,-20)] | [(-1000000,200),(300000,-40)]
+ [(0,-20),(30,-20)] | [(11,22),(33,44)]
+(21 rows)
+
+-- Has points less than or equal to line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s <= l2.s;
+               s               |               s               
+-------------------------------+-------------------------------
+ [(1,2),(3,4)]                 | [(1,2),(3,4)]
+ [(1,2),(3,4)]                 | [(0,0),(6,6)]
+ [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]
+ [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)]
+ [(1,2),(3,4)]                 | [(11,22),(33,44)]
+ [(1,2),(3,4)]                 | [(0,-20),(30,-20)]
+ [(0,0),(6,6)]                 | [(0,0),(6,6)]
+ [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]
+ [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)]
+ [(0,0),(6,6)]                 | [(11,22),(33,44)]
+ [(0,0),(6,6)]                 | [(0,-20),(30,-20)]
+ [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
+ [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)]
+ [(10,-10),(-3,-4)]            | [(11,22),(33,44)]
+ [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]
+ [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
+ [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)]
+ [(11,22),(33,44)]             | [(11,22),(33,44)]
+ [(-10,2),(-10,3)]             | [(1,2),(3,4)]
+ [(-10,2),(-10,3)]             | [(0,0),(6,6)]
+ [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]
+ [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)]
+ [(-10,2),(-10,3)]             | [(11,22),(33,44)]
+ [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
+ [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]
+ [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)]
+ [(0,-20),(30,-20)]            | [(11,22),(33,44)]
+ [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
+(28 rows)
+
+-- Has points equal to line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s = l2.s;
+               s               |               s               
+-------------------------------+-------------------------------
+ [(1,2),(3,4)]                 | [(1,2),(3,4)]
+ [(0,0),(6,6)]                 | [(0,0),(6,6)]
+ [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
+ [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
+ [(11,22),(33,44)]             | [(11,22),(33,44)]
+ [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
+ [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
+ [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]
+(8 rows)
+
+-- Has points greater than or equal to line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s >= l2.s;
+               s               |               s               
+-------------------------------+-------------------------------
+ [(1,2),(3,4)]                 | [(1,2),(3,4)]
+ [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
+ [(0,0),(6,6)]                 | [(1,2),(3,4)]
+ [(0,0),(6,6)]                 | [(0,0),(6,6)]
+ [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
+ [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
+ [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
+ [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
+ [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
+ [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
+ [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
+ [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
+ [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
+ [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
+ [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
+ [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
+ [(11,22),(33,44)]             | [(1,2),(3,4)]
+ [(11,22),(33,44)]             | [(0,0),(6,6)]
+ [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
+ [(11,22),(33,44)]             | [(11,22),(33,44)]
+ [(11,22),(33,44)]             | [(-10,2),(-10,3)]
+ [(11,22),(33,44)]             | [(0,-20),(30,-20)]
+ [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
+ [(0,-20),(30,-20)]            | [(1,2),(3,4)]
+ [(0,-20),(30,-20)]            | [(0,0),(6,6)]
+ [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
+ [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
+ [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
+(28 rows)
+
+-- Has points greater than line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s > l2.s;
+               s               |         s          
+-------------------------------+--------------------
+ [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
+ [(0,0),(6,6)]                 | [(1,2),(3,4)]
+ [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
+ [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
+ [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
+ [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
+ [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
+ [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
+ [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
+ [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
+ [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
+ [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
+ [(11,22),(33,44)]             | [(1,2),(3,4)]
+ [(11,22),(33,44)]             | [(0,0),(6,6)]
+ [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
+ [(11,22),(33,44)]             | [(-10,2),(-10,3)]
+ [(11,22),(33,44)]             | [(0,-20),(30,-20)]
+ [(0,-20),(30,-20)]            | [(1,2),(3,4)]
+ [(0,-20),(30,-20)]            | [(0,0),(6,6)]
+ [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
+ [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
+(21 rows)
+
+-- Has points not equal to line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s != l2.s;
+               s               |               s               
+-------------------------------+-------------------------------
+ [(1,2),(3,4)]                 | [(0,0),(6,6)]
+ [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]
+ [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)]
+ [(1,2),(3,4)]                 | [(11,22),(33,44)]
+ [(1,2),(3,4)]                 | [(-10,2),(-10,3)]
+ [(1,2),(3,4)]                 | [(0,-20),(30,-20)]
+ [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]
+ [(0,0),(6,6)]                 | [(1,2),(3,4)]
+ [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]
+ [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)]
+ [(0,0),(6,6)]                 | [(11,22),(33,44)]
+ [(0,0),(6,6)]                 | [(-10,2),(-10,3)]
+ [(0,0),(6,6)]                 | [(0,-20),(30,-20)]
+ [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]
+ [(10,-10),(-3,-4)]            | [(1,2),(3,4)]
+ [(10,-10),(-3,-4)]            | [(0,0),(6,6)]
+ [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)]
+ [(10,-10),(-3,-4)]            | [(11,22),(33,44)]
+ [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]
+ [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]
+ [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]
+ [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]
+ [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]
+ [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]
+ [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]
+ [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]
+ [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]
+ [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]
+ [(11,22),(33,44)]             | [(1,2),(3,4)]
+ [(11,22),(33,44)]             | [(0,0),(6,6)]
+ [(11,22),(33,44)]             | [(10,-10),(-3,-4)]
+ [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)]
+ [(11,22),(33,44)]             | [(-10,2),(-10,3)]
+ [(11,22),(33,44)]             | [(0,-20),(30,-20)]
+ [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]
+ [(-10,2),(-10,3)]             | [(1,2),(3,4)]
+ [(-10,2),(-10,3)]             | [(0,0),(6,6)]
+ [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]
+ [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)]
+ [(-10,2),(-10,3)]             | [(11,22),(33,44)]
+ [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]
+ [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]
+ [(0,-20),(30,-20)]            | [(1,2),(3,4)]
+ [(0,-20),(30,-20)]            | [(0,0),(6,6)]
+ [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]
+ [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)]
+ [(0,-20),(30,-20)]            | [(11,22),(33,44)]
+ [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]
+ [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]
+ [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]
+ [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]
+ [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]
+ [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)]
+ [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]
+ [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]
+ [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]
+(56 rows)
+
+-- Parallel with line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?|| l2.s;
+               s               |               s               
+-------------------------------+-------------------------------
+ [(1,2),(3,4)]                 | [(1,2),(3,4)]
+ [(1,2),(3,4)]                 | [(0,0),(6,6)]
+ [(1,2),(3,4)]                 | [(11,22),(33,44)]
+ [(0,0),(6,6)]                 | [(1,2),(3,4)]
+ [(0,0),(6,6)]                 | [(0,0),(6,6)]
+ [(0,0),(6,6)]                 | [(11,22),(33,44)]
+ [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]
+ [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)]
+ [(11,22),(33,44)]             | [(1,2),(3,4)]
+ [(11,22),(33,44)]             | [(0,0),(6,6)]
+ [(11,22),(33,44)]             | [(11,22),(33,44)]
+ [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]
+ [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]
+(13 rows)
+
+-- Perpendicular with line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?-| l2.s;
+         s          |         s          
+--------------------+--------------------
+ [(-10,2),(-10,3)]  | [(0,-20),(30,-20)]
+ [(0,-20),(30,-20)] | [(-10,2),(-10,3)]
+(2 rows)
+
+-- Distance to line
+SELECT l.s, l1.s, l.s <-> l1.s FROM LSEG_TBL l, LINE_TBL l1;
+               s               |                   s                   |    ?column?    
+-------------------------------+---------------------------------------+----------------
+ [(1,2),(3,4)]                 | {0,-1,5}                              |              1
+ [(0,0),(6,6)]                 | {0,-1,5}                              |              0
+ [(10,-10),(-3,-4)]            | {0,-1,5}                              |              9
+ [(-1000000,200),(300000,-40)] | {0,-1,5}                              |              0
+ [(11,22),(33,44)]             | {0,-1,5}                              |             17
+ [(-10,2),(-10,3)]             | {0,-1,5}                              |              2
+ [(0,-20),(30,-20)]            | {0,-1,5}                              |             25
+ [(NaN,1),(NaN,90)]            | {0,-1,5}                              |            NaN
+ [(1,2),(3,4)]                 | {1,0,5}                               |              6
+ [(0,0),(6,6)]                 | {1,0,5}                               |              5
+ [(10,-10),(-3,-4)]            | {1,0,5}                               |              2
+ [(-1000000,200),(300000,-40)] | {1,0,5}                               |              0
+ [(11,22),(33,44)]             | {1,0,5}                               |             16
+ [(-10,2),(-10,3)]             | {1,0,5}                               |              5
+ [(0,-20),(30,-20)]            | {1,0,5}                               |              5
+ [(NaN,1),(NaN,90)]            | {1,0,5}                               |            NaN
+ [(1,2),(3,4)]                 | {0,3,0}                               |              2
+ [(0,0),(6,6)]                 | {0,3,0}                               |              0
+ [(10,-10),(-3,-4)]            | {0,3,0}                               |              4
+ [(-1000000,200),(300000,-40)] | {0,3,0}                               |              0
+ [(11,22),(33,44)]             | {0,3,0}                               |             22
+ [(-10,2),(-10,3)]             | {0,3,0}                               |              2
+ [(0,-20),(30,-20)]            | {0,3,0}                               |             20
+ [(NaN,1),(NaN,90)]            | {0,3,0}                               |            NaN
+ [(1,2),(3,4)]                 | {1,-1,0}                              | 0.707106781187
+ [(0,0),(6,6)]                 | {1,-1,0}                              |              0
+ [(10,-10),(-3,-4)]            | {1,-1,0}                              | 0.707106781187
+ [(-1000000,200),(300000,-40)] | {1,-1,0}                              |              0
+ [(11,22),(33,44)]             | {1,-1,0}                              |  7.77817459305
+ [(-10,2),(-10,3)]             | {1,-1,0}                              |  8.48528137424
+ [(0,-20),(30,-20)]            | {1,-1,0}                              |  14.1421356237
+ [(NaN,1),(NaN,90)]            | {1,-1,0}                              |            NaN
+ [(1,2),(3,4)]                 | {-0.4,-1,-6}                          |  7.79920420344
+ [(0,0),(6,6)]                 | {-0.4,-1,-6}                          |  5.57086014531
+ [(10,-10),(-3,-4)]            | {-0.4,-1,-6}                          |              0
+ [(-1000000,200),(300000,-40)] | {-0.4,-1,-6}                          |              0
+ [(11,22),(33,44)]             | {-0.4,-1,-6}                          |  30.0826447847
+ [(-10,2),(-10,3)]             | {-0.4,-1,-6}                          |  3.71390676354
+ [(0,-20),(30,-20)]            | {-0.4,-1,-6}                          |  1.85695338177
+ [(NaN,1),(NaN,90)]            | {-0.4,-1,-6}                          |            NaN
+ [(1,2),(3,4)]                 | {-0.000184615384615,-1,15.3846153846} |  11.3840613445
+ [(0,0),(6,6)]                 | {-0.000184615384615,-1,15.3846153846} |   9.3835075324
+ [(10,-10),(-3,-4)]            | {-0.000184615384615,-1,15.3846153846} |  19.3851689004
+ [(-1000000,200),(300000,-40)] | {-0.000184615384615,-1,15.3846153846} |              0
+ [(11,22),(33,44)]             | {-0.000184615384615,-1,15.3846153846} |  6.61741527185
+ [(-10,2),(-10,3)]             | {-0.000184615384615,-1,15.3846153846} |  12.3864613274
+ [(0,-20),(30,-20)]            | {-0.000184615384615,-1,15.3846153846} |  35.3790763202
+ [(NaN,1),(NaN,90)]            | {-0.000184615384615,-1,15.3846153846} |            NaN
+ [(1,2),(3,4)]                 | {3,NaN,5}                             |            NaN
+ [(0,0),(6,6)]                 | {3,NaN,5}                             |            NaN
+ [(10,-10),(-3,-4)]            | {3,NaN,5}                             |            NaN
+ [(-1000000,200),(300000,-40)] | {3,NaN,5}                             |            NaN
+ [(11,22),(33,44)]             | {3,NaN,5}                             |            NaN
+ [(-10,2),(-10,3)]             | {3,NaN,5}                             |            NaN
+ [(0,-20),(30,-20)]            | {3,NaN,5}                             |            NaN
+ [(NaN,1),(NaN,90)]            | {3,NaN,5}                             |            NaN
+ [(1,2),(3,4)]                 | {NaN,NaN,NaN}                         |            NaN
+ [(0,0),(6,6)]                 | {NaN,NaN,NaN}                         |            NaN
+ [(10,-10),(-3,-4)]            | {NaN,NaN,NaN}                         |            NaN
+ [(-1000000,200),(300000,-40)] | {NaN,NaN,NaN}                         |            NaN
+ [(11,22),(33,44)]             | {NaN,NaN,NaN}                         |            NaN
+ [(-10,2),(-10,3)]             | {NaN,NaN,NaN}                         |            NaN
+ [(0,-20),(30,-20)]            | {NaN,NaN,NaN}                         |            NaN
+ [(NaN,1),(NaN,90)]            | {NaN,NaN,NaN}                         |            NaN
+ [(1,2),(3,4)]                 | {0,-1,3}                              |              0
+ [(0,0),(6,6)]                 | {0,-1,3}                              |              0
+ [(10,-10),(-3,-4)]            | {0,-1,3}                              |              7
+ [(-1000000,200),(300000,-40)] | {0,-1,3}                              |              0
+ [(11,22),(33,44)]             | {0,-1,3}                              |             19
+ [(-10,2),(-10,3)]             | {0,-1,3}                              |              0
+ [(0,-20),(30,-20)]            | {0,-1,3}                              |             23
+ [(NaN,1),(NaN,90)]            | {0,-1,3}                              |            NaN
+ [(1,2),(3,4)]                 | {-1,0,3}                              |              0
+ [(0,0),(6,6)]                 | {-1,0,3}                              |              0
+ [(10,-10),(-3,-4)]            | {-1,0,3}                              |              0
+ [(-1000000,200),(300000,-40)] | {-1,0,3}                              |              0
+ [(11,22),(33,44)]             | {-1,0,3}                              |              8
+ [(-10,2),(-10,3)]             | {-1,0,3}                              |             13
+ [(0,-20),(30,-20)]            | {-1,0,3}                              |              0
+ [(NaN,1),(NaN,90)]            | {-1,0,3}                              |            NaN
+(80 rows)
+
+-- Distance to line segment
+SELECT l1.s, l2.s, l1.s <-> l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
+               s               |               s               |    ?column?    
+-------------------------------+-------------------------------+----------------
+ [(1,2),(3,4)]                 | [(1,2),(3,4)]                 |              0
+ [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 0.707106781187
+ [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            |  7.12398901685
+ [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] |  11.3840613445
+ [(1,2),(3,4)]                 | [(11,22),(33,44)]             |  19.6977156036
+ [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             |             11
+ [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            |             22
+ [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            |            NaN
+ [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 0.707106781187
+ [(0,0),(6,6)]                 | [(0,0),(6,6)]                 |              0
+ [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            |  4.88901207039
+ [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] |   9.3835075324
+ [(0,0),(6,6)]                 | [(11,22),(33,44)]             |  16.7630546142
+ [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             |  10.1980390272
+ [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            |             20
+ [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            |            NaN
+ [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 |  7.12398901685
+ [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 |  4.88901207039
+ [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            |              0
+ [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] |  19.3851689004
+ [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             |  29.4737584815
+ [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             |  9.21954445729
+ [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            |             10
+ [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            |            NaN
+ [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 |  11.3840613445
+ [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 |   9.3835075324
+ [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            |  19.3851689004
+ [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] |              0
+ [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             |  6.61741527185
+ [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             |  12.3864613274
+ [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            |  35.3790763202
+ [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            |            NaN
+ [(11,22),(33,44)]             | [(1,2),(3,4)]                 |  19.6977156036
+ [(11,22),(33,44)]             | [(0,0),(6,6)]                 |  16.7630546142
+ [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            |  29.4737584815
+ [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] |  6.61741527185
+ [(11,22),(33,44)]             | [(11,22),(33,44)]             |              0
+ [(11,22),(33,44)]             | [(-10,2),(-10,3)]             |   28.319604517
+ [(11,22),(33,44)]             | [(0,-20),(30,-20)]            |             42
+ [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            |            NaN
+ [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 |             11
+ [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 |  10.1980390272
+ [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            |  9.21954445729
+ [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] |  12.3864613274
+ [(-10,2),(-10,3)]             | [(11,22),(33,44)]             |   28.319604517
+ [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             |              0
+ [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            |  24.1660919472
+ [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            |            NaN
+ [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 |             22
+ [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 |             20
+ [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            |             10
+ [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] |  35.3790763202
+ [(0,-20),(30,-20)]            | [(11,22),(33,44)]             |             42
+ [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             |  24.1660919472
+ [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            |              0
+ [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            |            NaN
+ [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 |            NaN
+ [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 |            NaN
+ [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            |            NaN
+ [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] |            NaN
+ [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             |            NaN
+ [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             |            NaN
+ [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            |            NaN
+ [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            |            NaN
+(64 rows)
+
+-- Distance to box
+SELECT l.s, b.f1, l.s <-> b.f1 FROM LSEG_TBL l, BOX_TBL b;
+               s               |         f1          |    ?column?    
+-------------------------------+---------------------+----------------
+ [(1,2),(3,4)]                 | (2,2),(0,0)         |              0
+ [(1,2),(3,4)]                 | (3,3),(1,1)         |              0
+ [(1,2),(3,4)]                 | (-2,2),(-8,-10)     |              3
+ [(1,2),(3,4)]                 | (2.5,3.5),(2.5,2.5) |              0
+ [(1,2),(3,4)]                 | (3,3),(3,3)         | 0.707106781187
+ [(0,0),(6,6)]                 | (2,2),(0,0)         |              0
+ [(0,0),(6,6)]                 | (3,3),(1,1)         |              0
+ [(0,0),(6,6)]                 | (-2,2),(-8,-10)     |              2
+ [(0,0),(6,6)]                 | (2.5,3.5),(2.5,2.5) |              0
+ [(0,0),(6,6)]                 | (3,3),(3,3)         |              0
+ [(10,-10),(-3,-4)]            | (2,2),(0,0)         |  4.88901207039
+ [(10,-10),(-3,-4)]            | (3,3),(1,1)         |  6.21602963235
+ [(10,-10),(-3,-4)]            | (-2,2),(-8,-10)     |              0
+ [(10,-10),(-3,-4)]            | (2.5,3.5),(2.5,2.5) |  8.20655597529
+ [(10,-10),(-3,-4)]            | (3,3),(3,3)         |  8.87006475627
+ [(-1000000,200),(300000,-40)] | (2,2),(0,0)         |  13.3842459258
+ [(-1000000,200),(300000,-40)] | (3,3),(1,1)         |  12.3840613274
+ [(-1000000,200),(300000,-40)] | (-2,2),(-8,-10)     |  13.3849843873
+ [(-1000000,200),(300000,-40)] | (2.5,3.5),(2.5,2.5) |  11.8841536436
+ [(-1000000,200),(300000,-40)] | (3,3),(3,3)         |  12.3840613274
+ [(11,22),(33,44)]             | (2,2),(0,0)         |  21.9317121995
+ [(11,22),(33,44)]             | (3,3),(1,1)         |  20.6155281281
+ [(11,22),(33,44)]             | (-2,2),(-8,-10)     |  23.8537208838
+ [(11,22),(33,44)]             | (2.5,3.5),(2.5,2.5) |  20.3592730715
+ [(11,22),(33,44)]             | (3,3),(3,3)         |  20.6155281281
+ [(-10,2),(-10,3)]             | (2,2),(0,0)         |             10
+ [(-10,2),(-10,3)]             | (3,3),(1,1)         |             11
+ [(-10,2),(-10,3)]             | (-2,2),(-8,-10)     |              2
+ [(-10,2),(-10,3)]             | (2.5,3.5),(2.5,2.5) |           12.5
+ [(-10,2),(-10,3)]             | (3,3),(3,3)         |             13
+ [(0,-20),(30,-20)]            | (2,2),(0,0)         |             20
+ [(0,-20),(30,-20)]            | (3,3),(1,1)         |             21
+ [(0,-20),(30,-20)]            | (-2,2),(-8,-10)     |  10.1980390272
+ [(0,-20),(30,-20)]            | (2.5,3.5),(2.5,2.5) |           22.5
+ [(0,-20),(30,-20)]            | (3,3),(3,3)         |             23
+ [(NaN,1),(NaN,90)]            | (2,2),(0,0)         |            NaN
+ [(NaN,1),(NaN,90)]            | (3,3),(1,1)         |            NaN
+ [(NaN,1),(NaN,90)]            | (-2,2),(-8,-10)     |            NaN
+ [(NaN,1),(NaN,90)]            | (2.5,3.5),(2.5,2.5) |            NaN
+ [(NaN,1),(NaN,90)]            | (3,3),(3,3)         |            NaN
+(40 rows)
+
+-- Intersect with line segment
+SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s ?# l1.s;
+               s               |      s       
+-------------------------------+--------------
+ [(0,0),(6,6)]                 | {0,-1,5}
+ [(-1000000,200),(300000,-40)] | {0,-1,5}
+ [(-1000000,200),(300000,-40)] | {1,0,5}
+ [(0,0),(6,6)]                 | {0,3,0}
+ [(-1000000,200),(300000,-40)] | {0,3,0}
+ [(-1000000,200),(300000,-40)] | {1,-1,0}
+ [(10,-10),(-3,-4)]            | {-0.4,-1,-6}
+ [(-1000000,200),(300000,-40)] | {-0.4,-1,-6}
+ [(1,2),(3,4)]                 | {0,-1,3}
+ [(0,0),(6,6)]                 | {0,-1,3}
+ [(-1000000,200),(300000,-40)] | {0,-1,3}
+ [(-10,2),(-10,3)]             | {0,-1,3}
+ [(1,2),(3,4)]                 | {-1,0,3}
+ [(0,0),(6,6)]                 | {-1,0,3}
+ [(10,-10),(-3,-4)]            | {-1,0,3}
+ [(-1000000,200),(300000,-40)] | {-1,0,3}
+ [(0,-20),(30,-20)]            | {-1,0,3}
+(17 rows)
+
+-- Intersect with box
+SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
+         s          |         f1          
+--------------------+---------------------
+ [(1,2),(3,4)]      | (2,2),(0,0)
+ [(1,2),(3,4)]      | (3,3),(1,1)
+ [(1,2),(3,4)]      | (2.5,3.5),(2.5,2.5)
+ [(0,0),(6,6)]      | (2,2),(0,0)
+ [(0,0),(6,6)]      | (3,3),(1,1)
+ [(0,0),(6,6)]      | (2.5,3.5),(2.5,2.5)
+ [(0,0),(6,6)]      | (3,3),(3,3)
+ [(10,-10),(-3,-4)] | (-2,2),(-8,-10)
+(8 rows)
+
+-- Intersection point with line segment
+SELECT l1.s, l2.s, l1.s # l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
+               s               |               s               | ?column? 
+-------------------------------+-------------------------------+----------
+ [(1,2),(3,4)]                 | [(1,2),(3,4)]                 | 
+ [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 
+ [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            | 
+ [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] | 
+ [(1,2),(3,4)]                 | [(11,22),(33,44)]             | 
+ [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             | 
+ [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            | 
+ [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            | 
+ [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 
+ [(0,0),(6,6)]                 | [(0,0),(6,6)]                 | 
+ [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            | 
+ [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] | 
+ [(0,0),(6,6)]                 | [(11,22),(33,44)]             | 
+ [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             | 
+ [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            | 
+ [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            | 
+ [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 | 
+ [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 | 
+ [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            | 
+ [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] | 
+ [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             | 
+ [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             | 
+ [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            | 
+ [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            | 
+ [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 | 
+ [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 | 
+ [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            | 
+ [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] | 
+ [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             | 
+ [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             | 
+ [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            | 
+ [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            | 
+ [(11,22),(33,44)]             | [(1,2),(3,4)]                 | 
+ [(11,22),(33,44)]             | [(0,0),(6,6)]                 | 
+ [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            | 
+ [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] | 
+ [(11,22),(33,44)]             | [(11,22),(33,44)]             | 
+ [(11,22),(33,44)]             | [(-10,2),(-10,3)]             | 
+ [(11,22),(33,44)]             | [(0,-20),(30,-20)]            | 
+ [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            | 
+ [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 | 
+ [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 | 
+ [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            | 
+ [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] | 
+ [(-10,2),(-10,3)]             | [(11,22),(33,44)]             | 
+ [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             | 
+ [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            | 
+ [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            | 
+ [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 | 
+ [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 | 
+ [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            | 
+ [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] | 
+ [(0,-20),(30,-20)]            | [(11,22),(33,44)]             | 
+ [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             | 
+ [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            | 
+ [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            | 
+ [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 | 
+ [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 | 
+ [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            | 
+ [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] | 
+ [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             | 
+ [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             | 
+ [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            | 
+ [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            | 
+(64 rows)
+
+-- Closest point to line
+SELECT l.s, l1.s, l.s ## l1.s FROM LSEG_TBL l, LINE_TBL l1;
+ERROR:  function "close_sl" not implemented
+-- Closest point to line segment
+SELECT l1.s, l2.s, l1.s ## l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
+               s               |               s               |            ?column?             
+-------------------------------+-------------------------------+---------------------------------
+ [(1,2),(3,4)]                 | [(1,2),(3,4)]                 | 
+ [(1,2),(3,4)]                 | [(0,0),(6,6)]                 | 
+ [(1,2),(3,4)]                 | [(10,-10),(-3,-4)]            | (-1.98536585366,-4.46829268293)
+ [(1,2),(3,4)]                 | [(-1000000,200),(300000,-40)] | (3.00210167283,15.3840611505)
+ [(1,2),(3,4)]                 | [(11,22),(33,44)]             | 
+ [(1,2),(3,4)]                 | [(-10,2),(-10,3)]             | (-10,2)
+ [(1,2),(3,4)]                 | [(0,-20),(30,-20)]            | (1,-20)
+ [(1,2),(3,4)]                 | [(NaN,1),(NaN,90)]            | 
+ [(0,0),(6,6)]                 | [(1,2),(3,4)]                 | 
+ [(0,0),(6,6)]                 | [(0,0),(6,6)]                 | 
+ [(0,0),(6,6)]                 | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
+ [(0,0),(6,6)]                 | [(-1000000,200),(300000,-40)] | (6.00173233982,15.3835073725)
+ [(0,0),(6,6)]                 | [(11,22),(33,44)]             | 
+ [(0,0),(6,6)]                 | [(-10,2),(-10,3)]             | (-10,2)
+ [(0,0),(6,6)]                 | [(0,-20),(30,-20)]            | (0,-20)
+ [(0,0),(6,6)]                 | [(NaN,1),(NaN,90)]            | 
+ [(10,-10),(-3,-4)]            | [(1,2),(3,4)]                 | (1,2)
+ [(10,-10),(-3,-4)]            | [(0,0),(6,6)]                 | (0,0)
+ [(10,-10),(-3,-4)]            | [(10,-10),(-3,-4)]            | 
+ [(10,-10),(-3,-4)]            | [(-1000000,200),(300000,-40)] | (-2.99642119965,15.3851685701)
+ [(10,-10),(-3,-4)]            | [(11,22),(33,44)]             | (11,22)
+ [(10,-10),(-3,-4)]            | [(-10,2),(-10,3)]             | (-10,2)
+ [(10,-10),(-3,-4)]            | [(0,-20),(30,-20)]            | (10,-20)
+ [(10,-10),(-3,-4)]            | [(NaN,1),(NaN,90)]            | 
+ [(-1000000,200),(300000,-40)] | [(1,2),(3,4)]                 | (3,4)
+ [(-1000000,200),(300000,-40)] | [(0,0),(6,6)]                 | (6,6)
+ [(-1000000,200),(300000,-40)] | [(10,-10),(-3,-4)]            | (-3,-4)
+ [(-1000000,200),(300000,-40)] | [(-1000000,200),(300000,-40)] | 
+ [(-1000000,200),(300000,-40)] | [(11,22),(33,44)]             | (11,22)
+ [(-1000000,200),(300000,-40)] | [(-10,2),(-10,3)]             | (-10,3)
+ [(-1000000,200),(300000,-40)] | [(0,-20),(30,-20)]            | (30,-20)
+ [(-1000000,200),(300000,-40)] | [(NaN,1),(NaN,90)]            | 
+ [(11,22),(33,44)]             | [(1,2),(3,4)]                 | 
+ [(11,22),(33,44)]             | [(0,0),(6,6)]                 | 
+ [(11,22),(33,44)]             | [(10,-10),(-3,-4)]            | (-1.3512195122,-4.76097560976)
+ [(11,22),(33,44)]             | [(-1000000,200),(300000,-40)] | (10.9987783234,15.3825848409)
+ [(11,22),(33,44)]             | [(11,22),(33,44)]             | 
+ [(11,22),(33,44)]             | [(-10,2),(-10,3)]             | (-10,3)
+ [(11,22),(33,44)]             | [(0,-20),(30,-20)]            | (11,-20)
+ [(11,22),(33,44)]             | [(NaN,1),(NaN,90)]            | 
+ [(-10,2),(-10,3)]             | [(1,2),(3,4)]                 | (1,2)
+ [(-10,2),(-10,3)]             | [(0,0),(6,6)]                 | (0,0)
+ [(-10,2),(-10,3)]             | [(10,-10),(-3,-4)]            | (-3,-4)
+ [(-10,2),(-10,3)]             | [(-1000000,200),(300000,-40)] | (-9.99771326872,15.3864611163)
+ [(-10,2),(-10,3)]             | [(11,22),(33,44)]             | (11,22)
+ [(-10,2),(-10,3)]             | [(-10,2),(-10,3)]             | 
+ [(-10,2),(-10,3)]             | [(0,-20),(30,-20)]            | (0,-20)
+ [(-10,2),(-10,3)]             | [(NaN,1),(NaN,90)]            | 
+ [(0,-20),(30,-20)]            | [(1,2),(3,4)]                 | (1,2)
+ [(0,-20),(30,-20)]            | [(0,0),(6,6)]                 | (0,0)
+ [(0,-20),(30,-20)]            | [(10,-10),(-3,-4)]            | (10,-10)
+ [(0,-20),(30,-20)]            | [(-1000000,200),(300000,-40)] | (30.0065315217,15.3790757173)
+ [(0,-20),(30,-20)]            | [(11,22),(33,44)]             | (11,22)
+ [(0,-20),(30,-20)]            | [(-10,2),(-10,3)]             | (-10,2)
+ [(0,-20),(30,-20)]            | [(0,-20),(30,-20)]            | 
+ [(0,-20),(30,-20)]            | [(NaN,1),(NaN,90)]            | 
+ [(NaN,1),(NaN,90)]            | [(1,2),(3,4)]                 | 
+ [(NaN,1),(NaN,90)]            | [(0,0),(6,6)]                 | 
+ [(NaN,1),(NaN,90)]            | [(10,-10),(-3,-4)]            | 
+ [(NaN,1),(NaN,90)]            | [(-1000000,200),(300000,-40)] | 
+ [(NaN,1),(NaN,90)]            | [(11,22),(33,44)]             | 
+ [(NaN,1),(NaN,90)]            | [(-10,2),(-10,3)]             | 
+ [(NaN,1),(NaN,90)]            | [(0,-20),(30,-20)]            | 
+ [(NaN,1),(NaN,90)]            | [(NaN,1),(NaN,90)]            | 
+(64 rows)
+
+-- Closest point to box
+SELECT l.s, b.f1, l.s ## b.f1 FROM LSEG_TBL l, BOX_TBL b;
+               s               |         f1          |  ?column?   
+-------------------------------+---------------------+-------------
+ [(1,2),(3,4)]                 | (2,2),(0,0)         | (1,2)
+ [(1,2),(3,4)]                 | (3,3),(1,1)         | (1.5,2.5)
+ [(1,2),(3,4)]                 | (-2,2),(-8,-10)     | (-2,2)
+ [(1,2),(3,4)]                 | (2.5,3.5),(2.5,2.5) | (2.25,3.25)
+ [(1,2),(3,4)]                 | (3,3),(3,3)         | (3,3)
+ [(0,0),(6,6)]                 | (2,2),(0,0)         | (1,1)
+ [(0,0),(6,6)]                 | (3,3),(1,1)         | (2,2)
+ [(0,0),(6,6)]                 | (-2,2),(-8,-10)     | (-2,0)
+ [(0,0),(6,6)]                 | (2.5,3.5),(2.5,2.5) | (2.75,2.75)
+ [(0,0),(6,6)]                 | (3,3),(3,3)         | (3,3)
+ [(10,-10),(-3,-4)]            | (2,2),(0,0)         | (0,0)
+ [(10,-10),(-3,-4)]            | (3,3),(1,1)         | (1,1)
+ [(10,-10),(-3,-4)]            | (-2,2),(-8,-10)     | (-3,-4)
+ [(10,-10),(-3,-4)]            | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
+ [(10,-10),(-3,-4)]            | (3,3),(3,3)         | (3,3)
+ [(-1000000,200),(300000,-40)] | (2,2),(0,0)         | (2,2)
+ [(-1000000,200),(300000,-40)] | (3,3),(1,1)         | (3,3)
+ [(-1000000,200),(300000,-40)] | (-2,2),(-8,-10)     | (-2,2)
+ [(-1000000,200),(300000,-40)] | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
+ [(-1000000,200),(300000,-40)] | (3,3),(3,3)         | (3,3)
+ [(11,22),(33,44)]             | (2,2),(0,0)         | (2,2)
+ [(11,22),(33,44)]             | (3,3),(1,1)         | (3,3)
+ [(11,22),(33,44)]             | (-2,2),(-8,-10)     | (-2,2)
+ [(11,22),(33,44)]             | (2.5,3.5),(2.5,2.5) | (2.5,3.5)
+ [(11,22),(33,44)]             | (3,3),(3,3)         | (3,3)
+ [(-10,2),(-10,3)]             | (2,2),(0,0)         | (0,2)
+ [(-10,2),(-10,3)]             | (3,3),(1,1)         | (1,2)
+ [(-10,2),(-10,3)]             | (-2,2),(-8,-10)     | (-8,2)
+ [(-10,2),(-10,3)]             | (2.5,3.5),(2.5,2.5) | (2.5,3)
+ [(-10,2),(-10,3)]             | (3,3),(3,3)         | (3,3)
+ [(0,-20),(30,-20)]            | (2,2),(0,0)         | (0,0)
+ [(0,-20),(30,-20)]            | (3,3),(1,1)         | (1,1)
+ [(0,-20),(30,-20)]            | (-2,2),(-8,-10)     | (-2,-10)
+ [(0,-20),(30,-20)]            | (2.5,3.5),(2.5,2.5) | (2.5,2.5)
+ [(0,-20),(30,-20)]            | (3,3),(3,3)         | (3,3)
+ [(NaN,1),(NaN,90)]            | (2,2),(0,0)         | 
+ [(NaN,1),(NaN,90)]            | (3,3),(1,1)         | 
+ [(NaN,1),(NaN,90)]            | (-2,2),(-8,-10)     | 
+ [(NaN,1),(NaN,90)]            | (2.5,3.5),(2.5,2.5) | 
+ [(NaN,1),(NaN,90)]            | (3,3),(3,3)         | 
+(40 rows)
+
+-- On line
+SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s <@ l1.s;
+               s               |                   s                   
+-------------------------------+---------------------------------------
+ [(0,0),(6,6)]                 | {1,-1,0}
+ [(-1000000,200),(300000,-40)] | {-0.000184615384615,-1,15.3846153846}
+(2 rows)
+
+-- On box
+SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s <@ b.f1;
+ s | f1 
+---+----
+(0 rows)
 
 --
 -- Boxes
 --
 SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;
  six |                              box                               
 -----+----------------------------------------------------------------
      | (7.12132034356,3.12132034356),(2.87867965644,-1.12132034356)
      | (71.7106781187,72.7106781187),(-69.7106781187,-68.7106781187)
      | (4.53553390593,6.53553390593),(-2.53553390593,-0.535533905933)
      | (3.12132034356,4.12132034356),(-1.12132034356,-0.12132034356)
      | (107.071067812,207.071067812),(92.9289321881,192.928932188)
      | (181.317279836,82.3172798365),(18.6827201635,-80.3172798365)
-(6 rows)
+     | (3,5),(3,5)
+     | (NaN,NaN),(NaN,NaN)
+(8 rows)
 
 -- translation
 SELECT '' AS twentyfour, b.f1 + p.f1 AS translation
    FROM BOX_TBL b, POINT_TBL p;
- twentyfour |       translation       
-------------+-------------------------
+ twentyfour |             translation             
+------------+-------------------------------------
             | (2,2),(0,0)
             | (3,3),(1,1)
+            | (-2,2),(-8,-10)
             | (2.5,3.5),(2.5,2.5)
             | (3,3),(3,3)
             | (-8,2),(-10,0)
             | (-7,3),(-9,1)
+            | (-12,2),(-18,-10)
             | (-7.5,3.5),(-7.5,2.5)
             | (-7,3),(-7,3)
             | (-1,6),(-3,4)
             | (0,7),(-2,5)
+            | (-5,6),(-11,-6)
             | (-0.5,7.5),(-0.5,6.5)
             | (0,7),(0,7)
             | (7.1,36.5),(5.1,34.5)
             | (8.1,37.5),(6.1,35.5)
+            | (3.1,36.5),(-2.9,24.5)
             | (7.6,38),(7.6,37)
             | (8.1,37.5),(8.1,37.5)
             | (-3,-10),(-5,-12)
             | (-2,-9),(-4,-11)
+            | (-7,-10),(-13,-22)
             | (-2.5,-8.5),(-2.5,-9.5)
             | (-2,-9),(-2,-9)
+            | (2,2),(1e-300,-1e-300)
+            | (3,3),(1,1)
+            | (-2,2),(-8,-10)
+            | (2.5,3.5),(2.5,2.5)
+            | (3,3),(3,3)
+            | (1e+300,Infinity),(1e+300,Infinity)
+            | (1e+300,Infinity),(1e+300,Infinity)
+            | (1e+300,Infinity),(1e+300,Infinity)
+            | (1e+300,Infinity),(1e+300,Infinity)
+            | (1e+300,Infinity),(1e+300,Infinity)
+            | (NaN,NaN),(NaN,NaN)
+            | (NaN,NaN),(NaN,NaN)
+            | (NaN,NaN),(NaN,NaN)
+            | (NaN,NaN),(NaN,NaN)
+            | (NaN,NaN),(NaN,NaN)
             | (12,12),(10,10)
             | (13,13),(11,11)
+            | (8,12),(2,0)
             | (12.5,13.5),(12.5,12.5)
             | (13,13),(13,13)
-(24 rows)
+(45 rows)
 
 SELECT '' AS twentyfour, b.f1 - p.f1 AS translation
    FROM BOX_TBL b, POINT_TBL p;
- twentyfour |        translation        
-------------+---------------------------
+ twentyfour |               translation               
+------------+-----------------------------------------
             | (2,2),(0,0)
             | (3,3),(1,1)
+            | (-2,2),(-8,-10)
             | (2.5,3.5),(2.5,2.5)
             | (3,3),(3,3)
             | (12,2),(10,0)
             | (13,3),(11,1)
+            | (8,2),(2,-10)
             | (12.5,3.5),(12.5,2.5)
             | (13,3),(13,3)
             | (5,-2),(3,-4)
             | (6,-1),(4,-3)
+            | (1,-2),(-5,-14)
             | (5.5,-0.5),(5.5,-1.5)
             | (6,-1),(6,-1)
             | (-3.1,-32.5),(-5.1,-34.5)
             | (-2.1,-31.5),(-4.1,-33.5)
+            | (-7.1,-32.5),(-13.1,-44.5)
             | (-2.6,-31),(-2.6,-32)
             | (-2.1,-31.5),(-2.1,-31.5)
             | (7,14),(5,12)
             | (8,15),(6,13)
+            | (3,14),(-3,2)
             | (7.5,15.5),(7.5,14.5)
             | (8,15),(8,15)
+            | (2,2),(-1e-300,1e-300)
+            | (3,3),(1,1)
+            | (-2,2),(-8,-10)
+            | (2.5,3.5),(2.5,2.5)
+            | (3,3),(3,3)
+            | (-1e+300,-Infinity),(-1e+300,-Infinity)
+            | (-1e+300,-Infinity),(-1e+300,-Infinity)
+            | (-1e+300,-Infinity),(-1e+300,-Infinity)
+            | (-1e+300,-Infinity),(-1e+300,-Infinity)
+            | (-1e+300,-Infinity),(-1e+300,-Infinity)
+            | (NaN,NaN),(NaN,NaN)
+            | (NaN,NaN),(NaN,NaN)
+            | (NaN,NaN),(NaN,NaN)
+            | (NaN,NaN),(NaN,NaN)
+            | (NaN,NaN),(NaN,NaN)
             | (-8,-8),(-10,-10)
             | (-7,-7),(-9,-9)
+            | (-12,-8),(-18,-20)
             | (-7.5,-6.5),(-7.5,-7.5)
             | (-7,-7),(-7,-7)
-(24 rows)
+(45 rows)
 
--- scaling and rotation
-SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation
-   FROM BOX_TBL b, POINT_TBL p;
- twentyfour |          rotation           
-------------+-----------------------------
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (-0,0),(-20,-20)
-            | (-10,-10),(-30,-30)
-            | (-25,-25),(-25,-35)
-            | (-30,-30),(-30,-30)
-            | (-0,2),(-14,0)
-            | (-7,3),(-21,1)
-            | (-17.5,2.5),(-21.5,-0.5)
-            | (-21,3),(-21,3)
-            | (0,79.2),(-58.8,0)
-            | (-29.4,118.8),(-88.2,39.6)
-            | (-73.5,104.1),(-108,99)
-            | (-88.2,118.8),(-88.2,118.8)
-            | (14,-0),(0,-34)
-            | (21,-17),(7,-51)
-            | (29.5,-42.5),(17.5,-47.5)
-            | (21,-51),(21,-51)
-            | (0,40),(0,0)
-            | (0,60),(0,20)
-            | (0,60),(-10,50)
-            | (0,60),(0,60)
-(24 rows)
+-- Multiply with point
+SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
+         f1          |     f1     |          ?column?           
+---------------------+------------+-----------------------------
+ (2,2),(0,0)         | (5.1,34.5) | (0,79.2),(-58.8,0)
+ (2,2),(0,0)         | (10,10)    | (0,40),(0,0)
+ (3,3),(1,1)         | (5.1,34.5) | (-29.4,118.8),(-88.2,39.6)
+ (3,3),(1,1)         | (10,10)    | (0,60),(0,20)
+ (-2,2),(-8,-10)     | (5.1,34.5) | (304.2,-58.8),(-79.2,-327)
+ (-2,2),(-8,-10)     | (10,10)    | (20,0),(-40,-180)
+ (2.5,3.5),(2.5,2.5) | (5.1,34.5) | (-73.5,104.1),(-108,99)
+ (2.5,3.5),(2.5,2.5) | (10,10)    | (0,60),(-10,50)
+ (3,3),(3,3)         | (5.1,34.5) | (-88.2,118.8),(-88.2,118.8)
+ (3,3),(3,3)         | (10,10)    | (0,60),(0,60)
+(10 rows)
 
-SELECT '' AS twenty, b.f1 / p.f1 AS rotation
-   FROM BOX_TBL b, POINT_TBL p
-   WHERE (p.f1 <-> point '(0,0)') >= 1;
- twenty |                               rotation                               
---------+----------------------------------------------------------------------
-        | (0,-0),(-0.2,-0.2)
-        | (0.08,-0),(0,-0.56)
-        | (0.0651176557644,0),(0,-0.0483449262493)
-        | (-0,0.0828402366864),(-0.201183431953,0)
-        | (0.2,0),(0,0)
-        | (-0.1,-0.1),(-0.3,-0.3)
-        | (0.12,-0.28),(0.04,-0.84)
-        | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374)
-        | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432)
-        | (0.3,0),(0.1,0)
-        | (-0.25,-0.25),(-0.25,-0.35)
-        | (0.26,-0.7),(0.1,-0.82)
-        | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117)
-        | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414)
-        | (0.3,0.05),(0.25,0)
-        | (-0.3,-0.3),(-0.3,-0.3)
-        | (0.12,-0.84),(0.12,-0.84)
-        | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374)
-        | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503)
-        | (0.3,0),(0.3,0)
-(20 rows)
+-- Overflow error
+SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] > 1000;
+         f1          |        f1         |                  ?column?                  
+---------------------+-------------------+--------------------------------------------
+ (2,2),(0,0)         | (1e+300,Infinity) | (NaN,NaN),(-Infinity,Infinity)
+ (2,2),(0,0)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
+ (3,3),(1,1)         | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
+ (3,3),(1,1)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
+ (-2,2),(-8,-10)     | (1e+300,Infinity) | (Infinity,-Infinity),(-Infinity,-Infinity)
+ (-2,2),(-8,-10)     | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
+ (2.5,3.5),(2.5,2.5) | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
+ (2.5,3.5),(2.5,2.5) | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
+ (3,3),(3,3)         | (1e+300,Infinity) | (-Infinity,Infinity),(-Infinity,Infinity)
+ (3,3),(3,3)         | (NaN,NaN)         | (NaN,NaN),(NaN,NaN)
+(10 rows)
 
+-- Divide by point
+SELECT b.f1, p.f1, b.f1 / p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
+         f1          |     f1     |                               ?column?                               
+---------------------+------------+----------------------------------------------------------------------
+ (2,2),(0,0)         | (5.1,34.5) | (0.0651176557644,0),(0,-0.0483449262493)
+ (2,2),(0,0)         | (10,10)    | (0.2,0),(0,0)
+ (3,3),(1,1)         | (5.1,34.5) | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374)
+ (3,3),(1,1)         | (10,10)    | (0.3,0),(0.1,0)
+ (-2,2),(-8,-10)     | (5.1,34.5) | (0.0483449262493,0.18499334024),(-0.317201914064,0.0651176557644)
+ (-2,2),(-8,-10)     | (10,10)    | (0,0.2),(-0.9,-0.1)
+ (2.5,3.5),(2.5,2.5) | (5.1,34.5) | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117)
+ (2.5,3.5),(2.5,2.5) | (10,10)    | (0.3,0.05),(0.25,0)
+ (3,3),(3,3)         | (5.1,34.5) | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374)
+ (3,3),(3,3)         | (10,10)    | (0.3,0),(0.3,0)
+(10 rows)
+
+-- To box
 SELECT f1::box
 	FROM POINT_TBL;
-          f1           
------------------------
+                 f1                  
+-------------------------------------
  (0,0),(0,0)
  (-10,0),(-10,0)
  (-3,4),(-3,4)
  (5.1,34.5),(5.1,34.5)
  (-5,-12),(-5,-12)
+ (1e-300,-1e-300),(1e-300,-1e-300)
+ (1e+300,Infinity),(1e+300,Infinity)
+ (NaN,NaN),(NaN,NaN)
  (10,10),(10,10)
-(6 rows)
+(9 rows)
 
 SELECT bound_box(a.f1, b.f1)
 	FROM BOX_TBL a, BOX_TBL b;
       bound_box      
 ---------------------
  (2,2),(0,0)
  (3,3),(0,0)
+ (2,2),(-8,-10)
  (2.5,3.5),(0,0)
  (3,3),(0,0)
  (3,3),(0,0)
  (3,3),(1,1)
+ (3,3),(-8,-10)
  (3,3.5),(1,1)
  (3,3),(1,1)
+ (2,2),(-8,-10)
+ (3,3),(-8,-10)
+ (-2,2),(-8,-10)
+ (2.5,3.5),(-8,-10)
+ (3,3),(-8,-10)
  (2.5,3.5),(0,0)
  (3,3.5),(1,1)
+ (2.5,3.5),(-8,-10)
  (2.5,3.5),(2.5,2.5)
  (3,3.5),(2.5,2.5)
  (3,3),(0,0)
  (3,3),(1,1)
+ (3,3),(-8,-10)
  (3,3.5),(2.5,2.5)
  (3,3),(3,3)
-(16 rows)
+(25 rows)
+
+-- Below box
+SELECT b1.f1, b2.f1, b1.f1 <^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
+         f1          |         f1          | ?column? 
+---------------------+---------------------+----------
+ (2,2),(0,0)         | (2,2),(0,0)         | f
+ (2,2),(0,0)         | (3,3),(1,1)         | f
+ (2,2),(0,0)         | (-2,2),(-8,-10)     | f
+ (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | t
+ (2,2),(0,0)         | (3,3),(3,3)         | t
+ (3,3),(1,1)         | (2,2),(0,0)         | f
+ (3,3),(1,1)         | (3,3),(1,1)         | f
+ (3,3),(1,1)         | (-2,2),(-8,-10)     | f
+ (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | f
+ (3,3),(1,1)         | (3,3),(3,3)         | t
+ (-2,2),(-8,-10)     | (2,2),(0,0)         | f
+ (-2,2),(-8,-10)     | (3,3),(1,1)         | f
+ (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | f
+ (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | t
+ (-2,2),(-8,-10)     | (3,3),(3,3)         | t
+ (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | f
+ (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | f
+ (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | f
+ (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | f
+ (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | f
+ (3,3),(3,3)         | (2,2),(0,0)         | f
+ (3,3),(3,3)         | (3,3),(1,1)         | f
+ (3,3),(3,3)         | (-2,2),(-8,-10)     | f
+ (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | f
+ (3,3),(3,3)         | (3,3),(3,3)         | t
+(25 rows)
+
+-- Above box
+SELECT b1.f1, b2.f1, b1.f1 >^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
+         f1          |         f1          | ?column? 
+---------------------+---------------------+----------
+ (2,2),(0,0)         | (2,2),(0,0)         | f
+ (2,2),(0,0)         | (3,3),(1,1)         | f
+ (2,2),(0,0)         | (-2,2),(-8,-10)     | f
+ (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | f
+ (2,2),(0,0)         | (3,3),(3,3)         | f
+ (3,3),(1,1)         | (2,2),(0,0)         | f
+ (3,3),(1,1)         | (3,3),(1,1)         | f
+ (3,3),(1,1)         | (-2,2),(-8,-10)     | f
+ (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | f
+ (3,3),(1,1)         | (3,3),(3,3)         | f
+ (-2,2),(-8,-10)     | (2,2),(0,0)         | f
+ (-2,2),(-8,-10)     | (3,3),(1,1)         | f
+ (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | f
+ (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | f
+ (-2,2),(-8,-10)     | (3,3),(3,3)         | f
+ (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | t
+ (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | f
+ (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | t
+ (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | f
+ (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | f
+ (3,3),(3,3)         | (2,2),(0,0)         | t
+ (3,3),(3,3)         | (3,3),(1,1)         | t
+ (3,3),(3,3)         | (-2,2),(-8,-10)     | t
+ (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | f
+ (3,3),(3,3)         | (3,3),(3,3)         | t
+(25 rows)
+
+-- Intersection point with box
+SELECT b1.f1, b2.f1, b1.f1 # b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
+         f1          |         f1          |      ?column?       
+---------------------+---------------------+---------------------
+ (2,2),(0,0)         | (2,2),(0,0)         | (2,2),(0,0)
+ (2,2),(0,0)         | (3,3),(1,1)         | (2,2),(1,1)
+ (2,2),(0,0)         | (-2,2),(-8,-10)     | 
+ (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) | 
+ (2,2),(0,0)         | (3,3),(3,3)         | 
+ (3,3),(1,1)         | (2,2),(0,0)         | (2,2),(1,1)
+ (3,3),(1,1)         | (3,3),(1,1)         | (3,3),(1,1)
+ (3,3),(1,1)         | (-2,2),(-8,-10)     | 
+ (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | (2.5,3),(2.5,2.5)
+ (3,3),(1,1)         | (3,3),(3,3)         | (3,3),(3,3)
+ (-2,2),(-8,-10)     | (2,2),(0,0)         | 
+ (-2,2),(-8,-10)     | (3,3),(1,1)         | 
+ (-2,2),(-8,-10)     | (-2,2),(-8,-10)     | (-2,2),(-8,-10)
+ (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | 
+ (-2,2),(-8,-10)     | (3,3),(3,3)         | 
+ (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         | 
+ (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | (2.5,3),(2.5,2.5)
+ (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | 
+ (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5)
+ (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         | 
+ (3,3),(3,3)         | (2,2),(0,0)         | 
+ (3,3),(3,3)         | (3,3),(1,1)         | (3,3),(3,3)
+ (3,3),(3,3)         | (-2,2),(-8,-10)     | 
+ (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) | 
+ (3,3),(3,3)         | (3,3),(3,3)         | (3,3),(3,3)
+(25 rows)
+
+-- Diagonal
+SELECT f1, diagonal(f1) FROM BOX_TBL;
+         f1          |       diagonal        
+---------------------+-----------------------
+ (2,2),(0,0)         | [(2,2),(0,0)]
+ (3,3),(1,1)         | [(3,3),(1,1)]
+ (-2,2),(-8,-10)     | [(-2,2),(-8,-10)]
+ (2.5,3.5),(2.5,2.5) | [(2.5,3.5),(2.5,2.5)]
+ (3,3),(3,3)         | [(3,3),(3,3)]
+(5 rows)
+
+-- Distance to box
+SELECT b1.f1, b2.f1, b1.f1 <-> b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
+         f1          |         f1          |   ?column?    
+---------------------+---------------------+---------------
+ (2,2),(0,0)         | (2,2),(0,0)         |             0
+ (2,2),(0,0)         | (3,3),(1,1)         | 1.41421356237
+ (2,2),(0,0)         | (-2,2),(-8,-10)     | 7.81024967591
+ (2,2),(0,0)         | (2.5,3.5),(2.5,2.5) |           2.5
+ (2,2),(0,0)         | (3,3),(3,3)         | 2.82842712475
+ (3,3),(1,1)         | (2,2),(0,0)         | 1.41421356237
+ (3,3),(1,1)         | (3,3),(1,1)         |             0
+ (3,3),(1,1)         | (-2,2),(-8,-10)     | 9.21954445729
+ (3,3),(1,1)         | (2.5,3.5),(2.5,2.5) | 1.11803398875
+ (3,3),(1,1)         | (3,3),(3,3)         | 1.41421356237
+ (-2,2),(-8,-10)     | (2,2),(0,0)         | 7.81024967591
+ (-2,2),(-8,-10)     | (3,3),(1,1)         | 9.21954445729
+ (-2,2),(-8,-10)     | (-2,2),(-8,-10)     |             0
+ (-2,2),(-8,-10)     | (2.5,3.5),(2.5,2.5) | 10.2591422643
+ (-2,2),(-8,-10)     | (3,3),(3,3)         | 10.6301458127
+ (2.5,3.5),(2.5,2.5) | (2,2),(0,0)         |           2.5
+ (2.5,3.5),(2.5,2.5) | (3,3),(1,1)         | 1.11803398875
+ (2.5,3.5),(2.5,2.5) | (-2,2),(-8,-10)     | 10.2591422643
+ (2.5,3.5),(2.5,2.5) | (2.5,3.5),(2.5,2.5) |             0
+ (2.5,3.5),(2.5,2.5) | (3,3),(3,3)         |           0.5
+ (3,3),(3,3)         | (2,2),(0,0)         | 2.82842712475
+ (3,3),(3,3)         | (3,3),(1,1)         | 1.41421356237
+ (3,3),(3,3)         | (-2,2),(-8,-10)     | 10.6301458127
+ (3,3),(3,3)         | (2.5,3.5),(2.5,2.5) |           0.5
+ (3,3),(3,3)         | (3,3),(3,3)         |             0
+(25 rows)
 
 --
 -- Paths
 --
-SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL;
- eight | npoints |           path            
--------+---------+---------------------------
-       |       2 | [(1,2),(3,4)]
-       |       2 | ((1,2),(3,4))
-       |       4 | [(0,0),(3,0),(4,5),(1,6)]
-       |       2 | ((1,2),(3,4))
-       |       2 | ((1,2),(3,4))
-       |       2 | [(1,2),(3,4)]
-       |       2 | [(11,12),(13,14)]
-       |       2 | ((11,12),(13,14))
-(8 rows)
+-- Points
+SELECT f1, npoints(f1) FROM PATH_TBL;
+            f1             | npoints 
+---------------------------+---------
+ [(1,2),(3,4)]             |       2
+ ((1,2),(3,4))             |       2
+ [(0,0),(3,0),(4,5),(1,6)] |       4
+ ((1,2),(3,4))             |       2
+ ((1,2),(3,4))             |       2
+ [(1,2),(3,4)]             |       2
+ ((10,20))                 |       1
+ [(11,12),(13,14)]         |       2
+ ((11,12),(13,14))         |       2
+(9 rows)
 
-SELECT '' AS four, path(f1) FROM POLYGON_TBL;
- four |        path         
-------+---------------------
-      | ((2,0),(2,4),(0,0))
-      | ((3,1),(3,3),(1,0))
-      | ((0,0))
-      | ((0,1),(0,1))
-(4 rows)
+-- Area
+SELECT f1, area(f1) FROM PATH_TBL;
+            f1             | area 
+---------------------------+------
+ [(1,2),(3,4)]             |     
+ ((1,2),(3,4))             |    0
+ [(0,0),(3,0),(4,5),(1,6)] |     
+ ((1,2),(3,4))             |    0
+ ((1,2),(3,4))             |    0
+ [(1,2),(3,4)]             |     
+ ((10,20))                 |    0
+ [(11,12),(13,14)]         |     
+ ((11,12),(13,14))         |    0
+(9 rows)
 
--- translation
-SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add
-   FROM PATH_TBL p1;
- eight |             dist_add              
--------+-----------------------------------
-       | [(11,12),(13,14)]
-       | ((11,12),(13,14))
-       | [(10,10),(13,10),(14,15),(11,16)]
-       | ((11,12),(13,14))
-       | ((11,12),(13,14))
-       | [(11,12),(13,14)]
-       | [(21,22),(23,24)]
-       | ((21,22),(23,24))
-(8 rows)
+-- Length
+SELECT f1, @-@ f1 FROM PATH_TBL;
+            f1             |   ?column?    
+---------------------------+---------------
+ [(1,2),(3,4)]             | 2.82842712475
+ ((1,2),(3,4))             | 5.65685424949
+ [(0,0),(3,0),(4,5),(1,6)] | 11.2612971738
+ ((1,2),(3,4))             | 5.65685424949
+ ((1,2),(3,4))             | 5.65685424949
+ [(1,2),(3,4)]             | 2.82842712475
+ ((10,20))                 |             0
+ [(11,12),(13,14)]         | 2.82842712475
+ ((11,12),(13,14))         | 5.65685424949
+(9 rows)
 
--- scaling and rotation
-SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul
-   FROM PATH_TBL p1;
- eight |           dist_mul           
--------+------------------------------
-       | [(4,3),(10,5)]
-       | ((4,3),(10,5))
-       | [(0,0),(6,-3),(13,6),(8,11)]
-       | ((4,3),(10,5))
-       | ((4,3),(10,5))
-       | [(4,3),(10,5)]
-       | [(34,13),(40,15)]
-       | ((34,13),(40,15))
-(8 rows)
+-- Center
+SELECT f1, @@ f1 FROM PATH_TBL;
+ERROR:  function "path_center" not implemented
+-- To polygon
+SELECT f1, f1::polygon FROM PATH_TBL WHERE isclosed(f1);
+        f1         |        f1         
+-------------------+-------------------
+ ((1,2),(3,4))     | ((1,2),(3,4))
+ ((1,2),(3,4))     | ((1,2),(3,4))
+ ((1,2),(3,4))     | ((1,2),(3,4))
+ ((10,20))         | ((10,20))
+ ((11,12),(13,14)) | ((11,12),(13,14))
+(5 rows)
+
+-- Open path cannot be converted to polygon error
+SELECT f1, f1::polygon FROM PATH_TBL WHERE isopen(f1);
+ERROR:  open path cannot be converted to polygon
+-- Has points less than path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 < p2.f1;
+        f1         |            f1             
+-------------------+---------------------------
+ [(1,2),(3,4)]     | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))     | [(0,0),(3,0),(4,5),(1,6)]
+ [(1,2),(3,4)]     | [(0,0),(3,0),(4,5),(1,6)]
+ ((10,20))         | [(1,2),(3,4)]
+ ((10,20))         | ((1,2),(3,4))
+ ((10,20))         | [(0,0),(3,0),(4,5),(1,6)]
+ ((10,20))         | ((1,2),(3,4))
+ ((10,20))         | ((1,2),(3,4))
+ ((10,20))         | [(1,2),(3,4)]
+ ((10,20))         | [(11,12),(13,14)]
+ ((10,20))         | ((11,12),(13,14))
+ [(11,12),(13,14)] | [(0,0),(3,0),(4,5),(1,6)]
+ ((11,12),(13,14)) | [(0,0),(3,0),(4,5),(1,6)]
+(15 rows)
+
+-- Has points less than or equal to path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 <= p2.f1;
+            f1             |            f1             
+---------------------------+---------------------------
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | [(11,12),(13,14)]
+ [(1,2),(3,4)]             | ((11,12),(13,14))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | [(11,12),(13,14)]
+ [(1,2),(3,4)]             | ((11,12),(13,14))
+ ((10,20))                 | [(1,2),(3,4)]
+ ((10,20))                 | ((1,2),(3,4))
+ ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)]
+ ((10,20))                 | ((1,2),(3,4))
+ ((10,20))                 | ((1,2),(3,4))
+ ((10,20))                 | [(1,2),(3,4)]
+ ((10,20))                 | ((10,20))
+ ((10,20))                 | [(11,12),(13,14)]
+ ((10,20))                 | ((11,12),(13,14))
+ [(11,12),(13,14)]         | [(1,2),(3,4)]
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)]
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | [(1,2),(3,4)]
+ [(11,12),(13,14)]         | [(11,12),(13,14)]
+ [(11,12),(13,14)]         | ((11,12),(13,14))
+ ((11,12),(13,14))         | [(1,2),(3,4)]
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)]
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | [(1,2),(3,4)]
+ ((11,12),(13,14))         | [(11,12),(13,14)]
+ ((11,12),(13,14))         | ((11,12),(13,14))
+(66 rows)
+
+-- Has points equal to path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 = p2.f1;
+            f1             |            f1             
+---------------------------+---------------------------
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | [(11,12),(13,14)]
+ [(1,2),(3,4)]             | ((11,12),(13,14))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | [(11,12),(13,14)]
+ [(1,2),(3,4)]             | ((11,12),(13,14))
+ ((10,20))                 | ((10,20))
+ [(11,12),(13,14)]         | [(1,2),(3,4)]
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | [(1,2),(3,4)]
+ [(11,12),(13,14)]         | [(11,12),(13,14)]
+ [(11,12),(13,14)]         | ((11,12),(13,14))
+ ((11,12),(13,14))         | [(1,2),(3,4)]
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | [(1,2),(3,4)]
+ ((11,12),(13,14))         | [(11,12),(13,14)]
+ ((11,12),(13,14))         | ((11,12),(13,14))
+(51 rows)
+
+-- Has points greater than or equal to path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 >= p2.f1;
+            f1             |            f1             
+---------------------------+---------------------------
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((10,20))
+ [(1,2),(3,4)]             | [(11,12),(13,14)]
+ [(1,2),(3,4)]             | ((11,12),(13,14))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((10,20))
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((10,20))
+ [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((10,20))
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | ((1,2),(3,4))
+ ((1,2),(3,4))             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | ((10,20))
+ ((1,2),(3,4))             | [(11,12),(13,14)]
+ ((1,2),(3,4))             | ((11,12),(13,14))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | [(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((10,20))
+ [(1,2),(3,4)]             | [(11,12),(13,14)]
+ [(1,2),(3,4)]             | ((11,12),(13,14))
+ ((10,20))                 | ((10,20))
+ [(11,12),(13,14)]         | [(1,2),(3,4)]
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | ((1,2),(3,4))
+ [(11,12),(13,14)]         | [(1,2),(3,4)]
+ [(11,12),(13,14)]         | ((10,20))
+ [(11,12),(13,14)]         | [(11,12),(13,14)]
+ [(11,12),(13,14)]         | ((11,12),(13,14))
+ ((11,12),(13,14))         | [(1,2),(3,4)]
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | ((1,2),(3,4))
+ ((11,12),(13,14))         | [(1,2),(3,4)]
+ ((11,12),(13,14))         | ((10,20))
+ ((11,12),(13,14))         | [(11,12),(13,14)]
+ ((11,12),(13,14))         | ((11,12),(13,14))
+(66 rows)
+
+-- Has points greater than path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 > p2.f1;
+            f1             |        f1         
+---------------------------+-------------------
+ [(1,2),(3,4)]             | ((10,20))
+ ((1,2),(3,4))             | ((10,20))
+ [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((10,20))
+ [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))
+ ((1,2),(3,4))             | ((10,20))
+ ((1,2),(3,4))             | ((10,20))
+ [(1,2),(3,4)]             | ((10,20))
+ [(11,12),(13,14)]         | ((10,20))
+ ((11,12),(13,14))         | ((10,20))
+(15 rows)
+
+-- Add path
+SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM PATH_TBL p1, PATH_TBL p2;
+            f1             |            f1             |                     ?column?                      
+---------------------------+---------------------------+---------------------------------------------------
+ [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))             | 
+ [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4),(0,0),(3,0),(4,5),(1,6)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))             | 
+ [(1,2),(3,4)]             | ((1,2),(3,4))             | 
+ [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((10,20))                 | 
+ [(1,2),(3,4)]             | [(11,12),(13,14)]         | [(1,2),(3,4),(11,12),(13,14)]
+ [(1,2),(3,4)]             | ((11,12),(13,14))         | 
+ ((1,2),(3,4))             | [(1,2),(3,4)]             | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | [(1,2),(3,4)]             | 
+ ((1,2),(3,4))             | ((10,20))                 | 
+ ((1,2),(3,4))             | [(11,12),(13,14)]         | 
+ ((1,2),(3,4))             | ((11,12),(13,14))         | 
+ [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6),(1,2),(3,4)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
+ [(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)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 
+ [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6),(1,2),(3,4)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((10,20))                 | 
+ [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6),(11,12),(13,14)]
+ [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))         | 
+ ((1,2),(3,4))             | [(1,2),(3,4)]             | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | [(1,2),(3,4)]             | 
+ ((1,2),(3,4))             | ((10,20))                 | 
+ ((1,2),(3,4))             | [(11,12),(13,14)]         | 
+ ((1,2),(3,4))             | ((11,12),(13,14))         | 
+ ((1,2),(3,4))             | [(1,2),(3,4)]             | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | ((1,2),(3,4))             | 
+ ((1,2),(3,4))             | [(1,2),(3,4)]             | 
+ ((1,2),(3,4))             | ((10,20))                 | 
+ ((1,2),(3,4))             | [(11,12),(13,14)]         | 
+ ((1,2),(3,4))             | ((11,12),(13,14))         | 
+ [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))             | 
+ [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4),(0,0),(3,0),(4,5),(1,6)]
+ [(1,2),(3,4)]             | ((1,2),(3,4))             | 
+ [(1,2),(3,4)]             | ((1,2),(3,4))             | 
+ [(1,2),(3,4)]             | [(1,2),(3,4)]             | [(1,2),(3,4),(1,2),(3,4)]
+ [(1,2),(3,4)]             | ((10,20))                 | 
+ [(1,2),(3,4)]             | [(11,12),(13,14)]         | [(1,2),(3,4),(11,12),(13,14)]
+ [(1,2),(3,4)]             | ((11,12),(13,14))         | 
+ ((10,20))                 | [(1,2),(3,4)]             | 
+ ((10,20))                 | ((1,2),(3,4))             | 
+ ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)] | 
+ ((10,20))                 | ((1,2),(3,4))             | 
+ ((10,20))                 | ((1,2),(3,4))             | 
+ ((10,20))                 | [(1,2),(3,4)]             | 
+ ((10,20))                 | ((10,20))                 | 
+ ((10,20))                 | [(11,12),(13,14)]         | 
+ ((10,20))                 | ((11,12),(13,14))         | 
+ [(11,12),(13,14)]         | [(1,2),(3,4)]             | [(11,12),(13,14),(1,2),(3,4)]
+ [(11,12),(13,14)]         | ((1,2),(3,4))             | 
+ [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14),(0,0),(3,0),(4,5),(1,6)]
+ [(11,12),(13,14)]         | ((1,2),(3,4))             | 
+ [(11,12),(13,14)]         | ((1,2),(3,4))             | 
+ [(11,12),(13,14)]         | [(1,2),(3,4)]             | [(11,12),(13,14),(1,2),(3,4)]
+ [(11,12),(13,14)]         | ((10,20))                 | 
+ [(11,12),(13,14)]         | [(11,12),(13,14)]         | [(11,12),(13,14),(11,12),(13,14)]
+ [(11,12),(13,14)]         | ((11,12),(13,14))         | 
+ ((11,12),(13,14))         | [(1,2),(3,4)]             | 
+ ((11,12),(13,14))         | ((1,2),(3,4))             | 
+ ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)] | 
+ ((11,12),(13,14))         | ((1,2),(3,4))             | 
+ ((11,12),(13,14))         | ((1,2),(3,4))             | 
+ ((11,12),(13,14))         | [(1,2),(3,4)]             | 
+ ((11,12),(13,14))         | ((10,20))                 | 
+ ((11,12),(13,14))         | [(11,12),(13,14)]         | 
+ ((11,12),(13,14))         | ((11,12),(13,14))         | 
+(81 rows)
+
+-- Add point
+SELECT p.f1, p1.f1, p.f1 + p1.f1 FROM PATH_TBL p, POINT_TBL p1;
+            f1             |        f1         |                                 ?column?                                  
+---------------------------+-------------------+---------------------------------------------------------------------------
+ [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
+ ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
+ ((10,20))                 | (0,0)             | ((10,20))
+ [(11,12),(13,14)]         | (0,0)             | [(11,12),(13,14)]
+ ((11,12),(13,14))         | (0,0)             | ((11,12),(13,14))
+ [(1,2),(3,4)]             | (-10,0)           | [(-9,2),(-7,4)]
+ ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
+ [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(-10,0),(-7,0),(-6,5),(-9,6)]
+ ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
+ ((1,2),(3,4))             | (-10,0)           | ((-9,2),(-7,4))
+ [(1,2),(3,4)]             | (-10,0)           | [(-9,2),(-7,4)]
+ ((10,20))                 | (-10,0)           | ((0,20))
+ [(11,12),(13,14)]         | (-10,0)           | [(1,12),(3,14)]
+ ((11,12),(13,14))         | (-10,0)           | ((1,12),(3,14))
+ [(1,2),(3,4)]             | (-3,4)            | [(-2,6),(0,8)]
+ ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
+ [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(-3,4),(0,4),(1,9),(-2,10)]
+ ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
+ ((1,2),(3,4))             | (-3,4)            | ((-2,6),(0,8))
+ [(1,2),(3,4)]             | (-3,4)            | [(-2,6),(0,8)]
+ ((10,20))                 | (-3,4)            | ((7,24))
+ [(11,12),(13,14)]         | (-3,4)            | [(8,16),(10,18)]
+ ((11,12),(13,14))         | (-3,4)            | ((8,16),(10,18))
+ [(1,2),(3,4)]             | (5.1,34.5)        | [(6.1,36.5),(8.1,38.5)]
+ ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
+ [(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)]
+ ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
+ ((1,2),(3,4))             | (5.1,34.5)        | ((6.1,36.5),(8.1,38.5))
+ [(1,2),(3,4)]             | (5.1,34.5)        | [(6.1,36.5),(8.1,38.5)]
+ ((10,20))                 | (5.1,34.5)        | ((15.1,54.5))
+ [(11,12),(13,14)]         | (5.1,34.5)        | [(16.1,46.5),(18.1,48.5)]
+ ((11,12),(13,14))         | (5.1,34.5)        | ((16.1,46.5),(18.1,48.5))
+ [(1,2),(3,4)]             | (-5,-12)          | [(-4,-10),(-2,-8)]
+ ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
+ [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(-5,-12),(-2,-12),(-1,-7),(-4,-6)]
+ ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
+ ((1,2),(3,4))             | (-5,-12)          | ((-4,-10),(-2,-8))
+ [(1,2),(3,4)]             | (-5,-12)          | [(-4,-10),(-2,-8)]
+ ((10,20))                 | (-5,-12)          | ((5,8))
+ [(11,12),(13,14)]         | (-5,-12)          | [(6,0),(8,2)]
+ ((11,12),(13,14))         | (-5,-12)          | ((6,0),(8,2))
+ [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | (1e-300,-1e-300)  | [(1e-300,-1e-300),(3,-1e-300),(4,5),(1,6)]
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
+ [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
+ ((10,20))                 | (1e-300,-1e-300)  | ((10,20))
+ [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(11,12),(13,14)]
+ ((11,12),(13,14))         | (1e-300,-1e-300)  | ((11,12),(13,14))
+ [(1,2),(3,4)]             | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
+ [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity),(1e+300,Infinity),(1e+300,Infinity)]
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
+ [(1,2),(3,4)]             | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
+ ((10,20))                 | (1e+300,Infinity) | ((1e+300,Infinity))
+ [(11,12),(13,14)]         | (1e+300,Infinity) | [(1e+300,Infinity),(1e+300,Infinity)]
+ ((11,12),(13,14))         | (1e+300,Infinity) | ((1e+300,Infinity),(1e+300,Infinity))
+ [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
+ [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(1,2),(3,4)]             | (10,10)           | [(11,12),(13,14)]
+ ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
+ [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(10,10),(13,10),(14,15),(11,16)]
+ ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
+ ((1,2),(3,4))             | (10,10)           | ((11,12),(13,14))
+ [(1,2),(3,4)]             | (10,10)           | [(11,12),(13,14)]
+ ((10,20))                 | (10,10)           | ((20,30))
+ [(11,12),(13,14)]         | (10,10)           | [(21,22),(23,24)]
+ ((11,12),(13,14))         | (10,10)           | ((21,22),(23,24))
+(81 rows)
+
+-- Subtract point
+SELECT p.f1, p1.f1, p.f1 - p1.f1 FROM PATH_TBL p, POINT_TBL p1;
+            f1             |        f1         |                                     ?column?                                      
+---------------------------+-------------------+-----------------------------------------------------------------------------------
+ [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
+ ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(3,0),(4,5),(1,6)]
+ ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
+ ((1,2),(3,4))             | (0,0)             | ((1,2),(3,4))
+ [(1,2),(3,4)]             | (0,0)             | [(1,2),(3,4)]
+ ((10,20))                 | (0,0)             | ((10,20))
+ [(11,12),(13,14)]         | (0,0)             | [(11,12),(13,14)]
+ ((11,12),(13,14))         | (0,0)             | ((11,12),(13,14))
+ [(1,2),(3,4)]             | (-10,0)           | [(11,2),(13,4)]
+ ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
+ [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(10,0),(13,0),(14,5),(11,6)]
+ ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
+ ((1,2),(3,4))             | (-10,0)           | ((11,2),(13,4))
+ [(1,2),(3,4)]             | (-10,0)           | [(11,2),(13,4)]
+ ((10,20))                 | (-10,0)           | ((20,20))
+ [(11,12),(13,14)]         | (-10,0)           | [(21,12),(23,14)]
+ ((11,12),(13,14))         | (-10,0)           | ((21,12),(23,14))
+ [(1,2),(3,4)]             | (-3,4)            | [(4,-2),(6,0)]
+ ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
+ [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(3,-4),(6,-4),(7,1),(4,2)]
+ ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
+ ((1,2),(3,4))             | (-3,4)            | ((4,-2),(6,0))
+ [(1,2),(3,4)]             | (-3,4)            | [(4,-2),(6,0)]
+ ((10,20))                 | (-3,4)            | ((13,16))
+ [(11,12),(13,14)]         | (-3,4)            | [(14,8),(16,10)]
+ ((11,12),(13,14))         | (-3,4)            | ((14,8),(16,10))
+ [(1,2),(3,4)]             | (5.1,34.5)        | [(-4.1,-32.5),(-2.1,-30.5)]
+ ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
+ [(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)]
+ ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
+ ((1,2),(3,4))             | (5.1,34.5)        | ((-4.1,-32.5),(-2.1,-30.5))
+ [(1,2),(3,4)]             | (5.1,34.5)        | [(-4.1,-32.5),(-2.1,-30.5)]
+ ((10,20))                 | (5.1,34.5)        | ((4.9,-14.5))
+ [(11,12),(13,14)]         | (5.1,34.5)        | [(5.9,-22.5),(7.9,-20.5)]
+ ((11,12),(13,14))         | (5.1,34.5)        | ((5.9,-22.5),(7.9,-20.5))
+ [(1,2),(3,4)]             | (-5,-12)          | [(6,14),(8,16)]
+ ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
+ [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(5,12),(8,12),(9,17),(6,18)]
+ ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
+ ((1,2),(3,4))             | (-5,-12)          | ((6,14),(8,16))
+ [(1,2),(3,4)]             | (-5,-12)          | [(6,14),(8,16)]
+ ((10,20))                 | (-5,-12)          | ((15,32))
+ [(11,12),(13,14)]         | (-5,-12)          | [(16,24),(18,26)]
+ ((11,12),(13,14))         | (-5,-12)          | ((16,24),(18,26))
+ [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
+ [(0,0),(3,0),(4,5),(1,6)] | (1e-300,-1e-300)  | [(-1e-300,1e-300),(3,1e-300),(4,5),(1,6)]
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((1,2),(3,4))
+ [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(1,2),(3,4)]
+ ((10,20))                 | (1e-300,-1e-300)  | ((10,20))
+ [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(11,12),(13,14)]
+ ((11,12),(13,14))         | (1e-300,-1e-300)  | ((11,12),(13,14))
+ [(1,2),(3,4)]             | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
+ [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity),(-1e+300,-Infinity),(-1e+300,-Infinity)]
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
+ [(1,2),(3,4)]             | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
+ ((10,20))                 | (1e+300,Infinity) | ((-1e+300,-Infinity))
+ [(11,12),(13,14)]         | (1e+300,Infinity) | [(-1e+300,-Infinity),(-1e+300,-Infinity)]
+ ((11,12),(13,14))         | (1e+300,Infinity) | ((-1e+300,-Infinity),(-1e+300,-Infinity))
+ [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
+ [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(1,2),(3,4)]             | (10,10)           | [(-9,-8),(-7,-6)]
+ ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
+ [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(-10,-10),(-7,-10),(-6,-5),(-9,-4)]
+ ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
+ ((1,2),(3,4))             | (10,10)           | ((-9,-8),(-7,-6))
+ [(1,2),(3,4)]             | (10,10)           | [(-9,-8),(-7,-6)]
+ ((10,20))                 | (10,10)           | ((0,10))
+ [(11,12),(13,14)]         | (10,10)           | [(1,2),(3,4)]
+ ((11,12),(13,14))         | (10,10)           | ((1,2),(3,4))
+(81 rows)
+
+-- Multiply with point
+SELECT p.f1, p1.f1, p.f1 * p1.f1 FROM PATH_TBL p, POINT_TBL p1;
+            f1             |        f1         |                               ?column?                               
+---------------------------+-------------------+----------------------------------------------------------------------
+ [(1,2),(3,4)]             | (0,0)             | [(0,0),(0,0)]
+ ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
+ [(0,0),(3,0),(4,5),(1,6)] | (0,0)             | [(0,0),(0,0),(0,0),(0,0)]
+ ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
+ ((1,2),(3,4))             | (0,0)             | ((0,0),(0,0))
+ [(1,2),(3,4)]             | (0,0)             | [(0,0),(0,0)]
+ ((10,20))                 | (0,0)             | ((0,0))
+ [(11,12),(13,14)]         | (0,0)             | [(0,0),(0,0)]
+ ((11,12),(13,14))         | (0,0)             | ((0,0),(0,0))
+ [(1,2),(3,4)]             | (-10,0)           | [(-10,-20),(-30,-40)]
+ ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
+ [(0,0),(3,0),(4,5),(1,6)] | (-10,0)           | [(0,0),(-30,0),(-40,-50),(-10,-60)]
+ ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
+ ((1,2),(3,4))             | (-10,0)           | ((-10,-20),(-30,-40))
+ [(1,2),(3,4)]             | (-10,0)           | [(-10,-20),(-30,-40)]
+ ((10,20))                 | (-10,0)           | ((-100,-200))
+ [(11,12),(13,14)]         | (-10,0)           | [(-110,-120),(-130,-140)]
+ ((11,12),(13,14))         | (-10,0)           | ((-110,-120),(-130,-140))
+ [(1,2),(3,4)]             | (-3,4)            | [(-11,-2),(-25,0)]
+ ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
+ [(0,0),(3,0),(4,5),(1,6)] | (-3,4)            | [(0,0),(-9,12),(-32,1),(-27,-14)]
+ ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
+ ((1,2),(3,4))             | (-3,4)            | ((-11,-2),(-25,0))
+ [(1,2),(3,4)]             | (-3,4)            | [(-11,-2),(-25,0)]
+ ((10,20))                 | (-3,4)            | ((-110,-20))
+ [(11,12),(13,14)]         | (-3,4)            | [(-81,8),(-95,10)]
+ ((11,12),(13,14))         | (-3,4)            | ((-81,8),(-95,10))
+ [(1,2),(3,4)]             | (5.1,34.5)        | [(-63.9,44.7),(-122.7,123.9)]
+ ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
+ [(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)]
+ ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
+ ((1,2),(3,4))             | (5.1,34.5)        | ((-63.9,44.7),(-122.7,123.9))
+ [(1,2),(3,4)]             | (5.1,34.5)        | [(-63.9,44.7),(-122.7,123.9)]
+ ((10,20))                 | (5.1,34.5)        | ((-639,447))
+ [(11,12),(13,14)]         | (5.1,34.5)        | [(-357.9,440.7),(-416.7,519.9)]
+ ((11,12),(13,14))         | (5.1,34.5)        | ((-357.9,440.7),(-416.7,519.9))
+ [(1,2),(3,4)]             | (-5,-12)          | [(19,-22),(33,-56)]
+ ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
+ [(0,0),(3,0),(4,5),(1,6)] | (-5,-12)          | [(0,0),(-15,-36),(40,-73),(67,-42)]
+ ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
+ ((1,2),(3,4))             | (-5,-12)          | ((19,-22),(33,-56))
+ [(1,2),(3,4)]             | (-5,-12)          | [(19,-22),(33,-56)]
+ ((10,20))                 | (-5,-12)          | ((190,-220))
+ [(11,12),(13,14)]         | (-5,-12)          | [(89,-192),(103,-226)]
+ ((11,12),(13,14))         | (-5,-12)          | ((89,-192),(103,-226))
+ [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(3e-300,1e-300),(7e-300,1e-300)]
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
+ [(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)]
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
+ ((1,2),(3,4))             | (1e-300,-1e-300)  | ((3e-300,1e-300),(7e-300,1e-300))
+ [(1,2),(3,4)]             | (1e-300,-1e-300)  | [(3e-300,1e-300),(7e-300,1e-300)]
+ ((10,20))                 | (1e-300,-1e-300)  | ((3e-299,1e-299))
+ [(11,12),(13,14)]         | (1e-300,-1e-300)  | [(2.3e-299,1e-300),(2.7e-299,1e-300)]
+ ((11,12),(13,14))         | (1e-300,-1e-300)  | ((2.3e-299,1e-300),(2.7e-299,1e-300))
+ [(1,2),(3,4)]             | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
+ [(0,0),(3,0),(4,5),(1,6)] | (1e+300,Infinity) | [(NaN,NaN),(NaN,Infinity),(-Infinity,Infinity),(-Infinity,Infinity)]
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
+ ((1,2),(3,4))             | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
+ [(1,2),(3,4)]             | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
+ ((10,20))                 | (1e+300,Infinity) | ((-Infinity,Infinity))
+ [(11,12),(13,14)]         | (1e+300,Infinity) | [(-Infinity,Infinity),(-Infinity,Infinity)]
+ ((11,12),(13,14))         | (1e+300,Infinity) | ((-Infinity,Infinity),(-Infinity,Infinity))
+ [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(0,0),(3,0),(4,5),(1,6)] | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN),(NaN,NaN),(NaN,NaN)]
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ ((1,2),(3,4))             | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(1,2),(3,4)]             | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((10,20))                 | (NaN,NaN)         | ((NaN,NaN))
+ [(11,12),(13,14)]         | (NaN,NaN)         | [(NaN,NaN),(NaN,NaN)]
+ ((11,12),(13,14))         | (NaN,NaN)         | ((NaN,NaN),(NaN,NaN))
+ [(1,2),(3,4)]             | (10,10)           | [(-10,30),(-10,70)]
+ ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
+ [(0,0),(3,0),(4,5),(1,6)] | (10,10)           | [(0,0),(30,30),(-10,90),(-50,70)]
+ ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
+ ((1,2),(3,4))             | (10,10)           | ((-10,30),(-10,70))
+ [(1,2),(3,4)]             | (10,10)           | [(-10,30),(-10,70)]
+ ((10,20))                 | (10,10)           | ((-100,300))
+ [(11,12),(13,14)]         | (10,10)           | [(-10,230),(-10,270)]
+ ((11,12),(13,14))         | (10,10)           | ((-10,230),(-10,270))
+(81 rows)
+
+-- Divide by point
+SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1[0] BETWEEN 1 AND 1000;
+            f1             |     f1     |                                                    ?column?                                                     
+---------------------------+------------+-----------------------------------------------------------------------------------------------------------------
+ [(1,2),(3,4)]             | (5.1,34.5) | [(0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952)]
+ [(1,2),(3,4)]             | (10,10)    | [(0.15,0.05),(0.35,0.05)]
+ ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
+ ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
+ [(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)]
+ [(0,0),(3,0),(4,5),(1,6)] | (10,10)    | [(0,0),(0.15,-0.15),(0.45,0.05),(0.35,0.25)]
+ ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
+ ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
+ ((1,2),(3,4))             | (5.1,34.5) | ((0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952))
+ ((1,2),(3,4))             | (10,10)    | ((0.15,0.05),(0.35,0.05))
+ [(1,2),(3,4)]             | (5.1,34.5) | [(0.0609244733856,-0.0199792807459),(0.12604212915,-0.0683242069952)]
+ [(1,2),(3,4)]             | (10,10)    | [(0.15,0.05),(0.35,0.05)]
+ ((10,20))                 | (5.1,34.5) | ((0.609244733856,-0.199792807459))
+ ((10,20))                 | (10,10)    | ((1.5,0.5))
+ [(11,12),(13,14)]         | (5.1,34.5) | [(0.386512752208,-0.261703911993),(0.451630407972,-0.310048838242)]
+ [(11,12),(13,14)]         | (10,10)    | [(1.15,0.05),(1.35,0.05)]
+ ((11,12),(13,14))         | (5.1,34.5) | ((0.386512752208,-0.261703911993),(0.451630407972,-0.310048838242))
+ ((11,12),(13,14))         | (10,10)    | ((1.15,0.05),(1.35,0.05))
+(18 rows)
+
+-- Division by 0 error
+SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1 ~= '(0,0)'::point;
+ERROR:  division by zero
+-- Distance to path
+SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM PATH_TBL p1, PATH_TBL p2;
+            f1             |            f1             |    ?column?    
+---------------------------+---------------------------+----------------
+ [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
+ [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
+ [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
+ [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
+ [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
+ [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
+ [(1,2),(3,4)]             | ((10,20))                 |  17.4642491966
+ [(1,2),(3,4)]             | [(11,12),(13,14)]         |   11.313708499
+ [(1,2),(3,4)]             | ((11,12),(13,14))         |   11.313708499
+ ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
+ ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
+ ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
+ ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
+ [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | 0.784464540553
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
+ [(0,0),(3,0),(4,5),(1,6)] | [(0,0),(3,0),(4,5),(1,6)] |              0
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
+ [(0,0),(3,0),(4,5),(1,6)] | ((1,2),(3,4))             | 0.784464540553
+ [(0,0),(3,0),(4,5),(1,6)] | [(1,2),(3,4)]             | 0.784464540553
+ [(0,0),(3,0),(4,5),(1,6)] | ((10,20))                 |  16.1554944214
+ [(0,0),(3,0),(4,5),(1,6)] | [(11,12),(13,14)]         |  9.89949493661
+ [(0,0),(3,0),(4,5),(1,6)] | ((11,12),(13,14))         |  9.89949493661
+ ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
+ ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
+ ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
+ ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
+ ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | ((1,2),(3,4))             |              0
+ ((1,2),(3,4))             | [(1,2),(3,4)]             |              0
+ ((1,2),(3,4))             | ((10,20))                 |  17.4642491966
+ ((1,2),(3,4))             | [(11,12),(13,14)]         |   11.313708499
+ ((1,2),(3,4))             | ((11,12),(13,14))         |   11.313708499
+ [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
+ [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
+ [(1,2),(3,4)]             | [(0,0),(3,0),(4,5),(1,6)] | 0.784464540553
+ [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
+ [(1,2),(3,4)]             | ((1,2),(3,4))             |              0
+ [(1,2),(3,4)]             | [(1,2),(3,4)]             |              0
+ [(1,2),(3,4)]             | ((10,20))                 |  17.4642491966
+ [(1,2),(3,4)]             | [(11,12),(13,14)]         |   11.313708499
+ [(1,2),(3,4)]             | ((11,12),(13,14))         |   11.313708499
+ ((10,20))                 | [(1,2),(3,4)]             |  17.4642491966
+ ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
+ ((10,20))                 | [(0,0),(3,0),(4,5),(1,6)] |  16.1554944214
+ ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
+ ((10,20))                 | ((1,2),(3,4))             |  17.4642491966
+ ((10,20))                 | [(1,2),(3,4)]             |  17.4642491966
+ ((10,20))                 | ((10,20))                 |              0
+ ((10,20))                 | [(11,12),(13,14)]         |   6.7082039325
+ ((10,20))                 | ((11,12),(13,14))         |   6.7082039325
+ [(11,12),(13,14)]         | [(1,2),(3,4)]             |   11.313708499
+ [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
+ [(11,12),(13,14)]         | [(0,0),(3,0),(4,5),(1,6)] |  9.89949493661
+ [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
+ [(11,12),(13,14)]         | ((1,2),(3,4))             |   11.313708499
+ [(11,12),(13,14)]         | [(1,2),(3,4)]             |   11.313708499
+ [(11,12),(13,14)]         | ((10,20))                 |   6.7082039325
+ [(11,12),(13,14)]         | [(11,12),(13,14)]         |              0
+ [(11,12),(13,14)]         | ((11,12),(13,14))         |              0
+ ((11,12),(13,14))         | [(1,2),(3,4)]             |   11.313708499
+ ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
+ ((11,12),(13,14))         | [(0,0),(3,0),(4,5),(1,6)] |  9.89949493661
+ ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
+ ((11,12),(13,14))         | ((1,2),(3,4))             |   11.313708499
+ ((11,12),(13,14))         | [(1,2),(3,4)]             |   11.313708499
+ ((11,12),(13,14))         | ((10,20))                 |   6.7082039325
+ ((11,12),(13,14))         | [(11,12),(13,14)]         |              0
+ ((11,12),(13,14))         | ((11,12),(13,14))         |              0
+(81 rows)
 
 --
 -- Polygons
 --
 -- containment
 SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 @> p.f1 AS contains
    FROM POLYGON_TBL poly, POINT_TBL p;
- twentyfour |     f1     |         f1          | contains 
-------------+------------+---------------------+----------
-            | (0,0)      | ((2,0),(2,4),(0,0)) | t
-            | (0,0)      | ((3,1),(3,3),(1,0)) | f
-            | (0,0)      | ((0,0))             | t
-            | (0,0)      | ((0,1),(0,1))       | f
-            | (-10,0)    | ((2,0),(2,4),(0,0)) | f
-            | (-10,0)    | ((3,1),(3,3),(1,0)) | f
-            | (-10,0)    | ((0,0))             | f
-            | (-10,0)    | ((0,1),(0,1))       | f
-            | (-3,4)     | ((2,0),(2,4),(0,0)) | f
-            | (-3,4)     | ((3,1),(3,3),(1,0)) | f
-            | (-3,4)     | ((0,0))             | f
-            | (-3,4)     | ((0,1),(0,1))       | f
-            | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
-            | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
-            | (5.1,34.5) | ((0,0))             | f
-            | (5.1,34.5) | ((0,1),(0,1))       | f
-            | (-5,-12)   | ((2,0),(2,4),(0,0)) | f
-            | (-5,-12)   | ((3,1),(3,3),(1,0)) | f
-            | (-5,-12)   | ((0,0))             | f
-            | (-5,-12)   | ((0,1),(0,1))       | f
-            | (10,10)    | ((2,0),(2,4),(0,0)) | f
-            | (10,10)    | ((3,1),(3,3),(1,0)) | f
-            | (10,10)    | ((0,0))             | f
-            | (10,10)    | ((0,1),(0,1))       | f
-(24 rows)
+ twentyfour |        f1         |             f1             | contains 
+------------+-------------------+----------------------------+----------
+            | (0,0)             | ((2,0),(2,4),(0,0))        | t
+            | (0,0)             | ((3,1),(3,3),(1,0))        | f
+            | (0,0)             | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (0,0)             | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (0,0)             | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (0,0)             | ((0,0))                    | t
+            | (0,0)             | ((0,1),(0,1))              | f
+            | (-10,0)           | ((2,0),(2,4),(0,0))        | f
+            | (-10,0)           | ((3,1),(3,3),(1,0))        | f
+            | (-10,0)           | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (-10,0)           | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (-10,0)           | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (-10,0)           | ((0,0))                    | f
+            | (-10,0)           | ((0,1),(0,1))              | f
+            | (-3,4)            | ((2,0),(2,4),(0,0))        | f
+            | (-3,4)            | ((3,1),(3,3),(1,0))        | f
+            | (-3,4)            | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (-3,4)            | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (-3,4)            | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (-3,4)            | ((0,0))                    | f
+            | (-3,4)            | ((0,1),(0,1))              | f
+            | (5.1,34.5)        | ((2,0),(2,4),(0,0))        | f
+            | (5.1,34.5)        | ((3,1),(3,3),(1,0))        | f
+            | (5.1,34.5)        | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (5.1,34.5)        | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (5.1,34.5)        | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (5.1,34.5)        | ((0,0))                    | f
+            | (5.1,34.5)        | ((0,1),(0,1))              | f
+            | (-5,-12)          | ((2,0),(2,4),(0,0))        | f
+            | (-5,-12)          | ((3,1),(3,3),(1,0))        | f
+            | (-5,-12)          | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (-5,-12)          | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (-5,-12)          | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (-5,-12)          | ((0,0))                    | f
+            | (-5,-12)          | ((0,1),(0,1))              | f
+            | (1e-300,-1e-300)  | ((2,0),(2,4),(0,0))        | t
+            | (1e-300,-1e-300)  | ((3,1),(3,3),(1,0))        | f
+            | (1e-300,-1e-300)  | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (1e-300,-1e-300)  | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (1e-300,-1e-300)  | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (1e-300,-1e-300)  | ((0,0))                    | t
+            | (1e-300,-1e-300)  | ((0,1),(0,1))              | f
+            | (1e+300,Infinity) | ((2,0),(2,4),(0,0))        | f
+            | (1e+300,Infinity) | ((3,1),(3,3),(1,0))        | f
+            | (1e+300,Infinity) | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (1e+300,Infinity) | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (1e+300,Infinity) | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (1e+300,Infinity) | ((0,0))                    | f
+            | (1e+300,Infinity) | ((0,1),(0,1))              | f
+            | (NaN,NaN)         | ((2,0),(2,4),(0,0))        | t
+            | (NaN,NaN)         | ((3,1),(3,3),(1,0))        | t
+            | (NaN,NaN)         | ((1,2),(3,4),(5,6),(7,8))  | t
+            | (NaN,NaN)         | ((7,8),(5,6),(3,4),(1,2))  | t
+            | (NaN,NaN)         | ((1,2),(7,8),(5,6),(3,-4)) | t
+            | (NaN,NaN)         | ((0,0))                    | t
+            | (NaN,NaN)         | ((0,1),(0,1))              | t
+            | (10,10)           | ((2,0),(2,4),(0,0))        | f
+            | (10,10)           | ((3,1),(3,3),(1,0))        | f
+            | (10,10)           | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (10,10)           | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (10,10)           | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (10,10)           | ((0,0))                    | f
+            | (10,10)           | ((0,1),(0,1))              | f
+(63 rows)
 
 SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 <@ poly.f1 AS contained
    FROM POLYGON_TBL poly, POINT_TBL p;
- twentyfour |     f1     |         f1          | contained 
-------------+------------+---------------------+-----------
-            | (0,0)      | ((2,0),(2,4),(0,0)) | t
-            | (0,0)      | ((3,1),(3,3),(1,0)) | f
-            | (0,0)      | ((0,0))             | t
-            | (0,0)      | ((0,1),(0,1))       | f
-            | (-10,0)    | ((2,0),(2,4),(0,0)) | f
-            | (-10,0)    | ((3,1),(3,3),(1,0)) | f
-            | (-10,0)    | ((0,0))             | f
-            | (-10,0)    | ((0,1),(0,1))       | f
-            | (-3,4)     | ((2,0),(2,4),(0,0)) | f
-            | (-3,4)     | ((3,1),(3,3),(1,0)) | f
-            | (-3,4)     | ((0,0))             | f
-            | (-3,4)     | ((0,1),(0,1))       | f
-            | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
-            | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
-            | (5.1,34.5) | ((0,0))             | f
-            | (5.1,34.5) | ((0,1),(0,1))       | f
-            | (-5,-12)   | ((2,0),(2,4),(0,0)) | f
-            | (-5,-12)   | ((3,1),(3,3),(1,0)) | f
-            | (-5,-12)   | ((0,0))             | f
-            | (-5,-12)   | ((0,1),(0,1))       | f
-            | (10,10)    | ((2,0),(2,4),(0,0)) | f
-            | (10,10)    | ((3,1),(3,3),(1,0)) | f
-            | (10,10)    | ((0,0))             | f
-            | (10,10)    | ((0,1),(0,1))       | f
-(24 rows)
+ twentyfour |        f1         |             f1             | contained 
+------------+-------------------+----------------------------+-----------
+            | (0,0)             | ((2,0),(2,4),(0,0))        | t
+            | (0,0)             | ((3,1),(3,3),(1,0))        | f
+            | (0,0)             | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (0,0)             | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (0,0)             | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (0,0)             | ((0,0))                    | t
+            | (0,0)             | ((0,1),(0,1))              | f
+            | (-10,0)           | ((2,0),(2,4),(0,0))        | f
+            | (-10,0)           | ((3,1),(3,3),(1,0))        | f
+            | (-10,0)           | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (-10,0)           | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (-10,0)           | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (-10,0)           | ((0,0))                    | f
+            | (-10,0)           | ((0,1),(0,1))              | f
+            | (-3,4)            | ((2,0),(2,4),(0,0))        | f
+            | (-3,4)            | ((3,1),(3,3),(1,0))        | f
+            | (-3,4)            | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (-3,4)            | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (-3,4)            | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (-3,4)            | ((0,0))                    | f
+            | (-3,4)            | ((0,1),(0,1))              | f
+            | (5.1,34.5)        | ((2,0),(2,4),(0,0))        | f
+            | (5.1,34.5)        | ((3,1),(3,3),(1,0))        | f
+            | (5.1,34.5)        | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (5.1,34.5)        | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (5.1,34.5)        | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (5.1,34.5)        | ((0,0))                    | f
+            | (5.1,34.5)        | ((0,1),(0,1))              | f
+            | (-5,-12)          | ((2,0),(2,4),(0,0))        | f
+            | (-5,-12)          | ((3,1),(3,3),(1,0))        | f
+            | (-5,-12)          | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (-5,-12)          | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (-5,-12)          | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (-5,-12)          | ((0,0))                    | f
+            | (-5,-12)          | ((0,1),(0,1))              | f
+            | (1e-300,-1e-300)  | ((2,0),(2,4),(0,0))        | t
+            | (1e-300,-1e-300)  | ((3,1),(3,3),(1,0))        | f
+            | (1e-300,-1e-300)  | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (1e-300,-1e-300)  | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (1e-300,-1e-300)  | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (1e-300,-1e-300)  | ((0,0))                    | t
+            | (1e-300,-1e-300)  | ((0,1),(0,1))              | f
+            | (1e+300,Infinity) | ((2,0),(2,4),(0,0))        | f
+            | (1e+300,Infinity) | ((3,1),(3,3),(1,0))        | f
+            | (1e+300,Infinity) | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (1e+300,Infinity) | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (1e+300,Infinity) | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (1e+300,Infinity) | ((0,0))                    | f
+            | (1e+300,Infinity) | ((0,1),(0,1))              | f
+            | (NaN,NaN)         | ((2,0),(2,4),(0,0))        | t
+            | (NaN,NaN)         | ((3,1),(3,3),(1,0))        | t
+            | (NaN,NaN)         | ((1,2),(3,4),(5,6),(7,8))  | t
+            | (NaN,NaN)         | ((7,8),(5,6),(3,4),(1,2))  | t
+            | (NaN,NaN)         | ((1,2),(7,8),(5,6),(3,-4)) | t
+            | (NaN,NaN)         | ((0,0))                    | t
+            | (NaN,NaN)         | ((0,1),(0,1))              | t
+            | (10,10)           | ((2,0),(2,4),(0,0))        | f
+            | (10,10)           | ((3,1),(3,3),(1,0))        | f
+            | (10,10)           | ((1,2),(3,4),(5,6),(7,8))  | f
+            | (10,10)           | ((7,8),(5,6),(3,4),(1,2))  | f
+            | (10,10)           | ((1,2),(7,8),(5,6),(3,-4)) | f
+            | (10,10)           | ((0,0))                    | f
+            | (10,10)           | ((0,1),(0,1))              | f
+(63 rows)
 
 SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon
    FROM POLYGON_TBL;
- four | npoints |       polygon       
-------+---------+---------------------
+ four | npoints |          polygon           
+------+---------+----------------------------
       |       3 | ((2,0),(2,4),(0,0))
       |       3 | ((3,1),(3,3),(1,0))
+      |       4 | ((1,2),(3,4),(5,6),(7,8))
+      |       4 | ((7,8),(5,6),(3,4),(1,2))
+      |       4 | ((1,2),(7,8),(5,6),(3,-4))
       |       1 | ((0,0))
       |       2 | ((0,1),(0,1))
-(4 rows)
+(7 rows)
 
 SELECT '' AS four, polygon(f1)
    FROM BOX_TBL;
  four |                  polygon                  
 ------+-------------------------------------------
       | ((0,0),(0,2),(2,2),(2,0))
       | ((1,1),(1,3),(3,3),(3,1))
+      | ((-8,-10),(-8,2),(-2,2),(-2,-10))
       | ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5))
       | ((3,3),(3,3),(3,3),(3,3))
-(4 rows)
+(5 rows)
 
 SELECT '' AS four, polygon(f1)
    FROM PATH_TBL WHERE isclosed(f1);
  four |      polygon      
 ------+-------------------
       | ((1,2),(3,4))
       | ((1,2),(3,4))
       | ((1,2),(3,4))
+      | ((10,20))
       | ((11,12),(13,14))
-(4 rows)
+(5 rows)
 
 SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon
    FROM PATH_TBL
    WHERE isopen(f1);
  four |         open_path         |          polygon          
 ------+---------------------------+---------------------------
       | [(1,2),(3,4)]             | ((1,2),(3,4))
       | [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6))
       | [(1,2),(3,4)]             | ((1,2),(3,4))
       | [(11,12),(13,14)]         | ((11,12),(13,14))
 (4 rows)
 
--- convert circles to polygons using the default number of points
-SELECT '' AS six, polygon(f1)
-   FROM CIRCLE_TBL;
- six |                                                                                                       polygon                                                                                                        
------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-     | ((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))
-     | ((-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))
-     | ((-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))
-     | ((-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))
-     | ((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))
-     | ((-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))
-(6 rows)
+-- To box
+SELECT f1, f1::box FROM POLYGON_TBL;
+             f1             |      f1      
+----------------------------+--------------
+ ((2,0),(2,4),(0,0))        | (2,4),(0,0)
+ ((3,1),(3,3),(1,0))        | (3,3),(1,0)
+ ((1,2),(3,4),(5,6),(7,8))  | (7,8),(1,2)
+ ((7,8),(5,6),(3,4),(1,2))  | (7,8),(1,2)
+ ((1,2),(7,8),(5,6),(3,-4)) | (7,8),(1,-4)
+ ((0,0))                    | (0,0),(0,0)
+ ((0,1),(0,1))              | (0,1),(0,1)
+(7 rows)
 
--- convert the circle to an 8-point polygon
-SELECT '' AS six, polygon(8, f1)
-   FROM CIRCLE_TBL;
- six |                                                                             polygon                                                                              
------+------------------------------------------------------------------------------------------------------------------------------------------------------------------
-     | ((2,1),(2.87867965644,3.12132034356),(5,4),(7.12132034356,3.12132034356),(8,1),(7.12132034356,-1.12132034356),(5,-2),(2.87867965644,-1.12132034356))
-     | ((-99,2),(-69.7106781187,72.7106781187),(1,102),(71.7106781187,72.7106781187),(101,2),(71.7106781187,-68.7106781187),(1,-98),(-69.7106781187,-68.7106781187))
-     | ((-4,3),(-2.53553390593,6.53553390593),(1,8),(4.53553390593,6.53553390593),(6,3),(4.53553390593,-0.535533905933),(1,-2),(-2.53553390593,-0.535533905933))
-     | ((-2,2),(-1.12132034356,4.12132034356),(1,5),(3.12132034356,4.12132034356),(4,2),(3.12132034356,-0.12132034356),(1,-1),(-1.12132034356,-0.12132034356))
-     | ((90,200),(92.9289321881,207.071067812),(100,210),(107.071067812,207.071067812),(110,200),(107.071067812,192.928932188),(100,190),(92.9289321881,192.928932188))
-     | ((-15,1),(18.6827201635,82.3172798365),(100,116),(181.317279836,82.3172798365),(215,1),(181.317279836,-80.3172798365),(100,-114),(18.6827201635,-80.3172798365))
-(6 rows)
+-- To path
+SELECT f1, f1::path FROM POLYGON_TBL;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((0,0))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(7 rows)
 
+-- Same as polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 ~= p2.f1;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((0,0))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(9 rows)
+
+-- Contained by polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <@ p2.f1;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((2,0),(2,4),(0,0))
+ ((0,0))                    | ((0,0))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(12 rows)
+
+-- Contains polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 @> p2.f1;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((2,0),(2,4),(0,0))        | ((0,0))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((0,0))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(12 rows)
+
+-- Overlap with polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 && p2.f1;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
+ ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
+ ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
+ ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((2,0),(2,4),(0,0))        | ((0,0))
+ ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((2,0),(2,4),(0,0))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((3,1),(3,3),(1,0))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((2,0),(2,4),(0,0))
+ ((0,0))                    | ((0,0))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(25 rows)
+
+-- Left of polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 << p2.f1;
+      f1       |             f1             
+---------------+----------------------------
+ ((0,0))       | ((3,1),(3,3),(1,0))
+ ((0,0))       | ((1,2),(3,4),(5,6),(7,8))
+ ((0,0))       | ((7,8),(5,6),(3,4),(1,2))
+ ((0,0))       | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,1),(0,1)) | ((3,1),(3,3),(1,0))
+ ((0,1),(0,1)) | ((1,2),(3,4),(5,6),(7,8))
+ ((0,1),(0,1)) | ((7,8),(5,6),(3,4),(1,2))
+ ((0,1),(0,1)) | ((1,2),(7,8),(5,6),(3,-4))
+(8 rows)
+
+-- Overlap of left of polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &< p2.f1;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
+ ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
+ ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
+ ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
+ ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
+ ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((2,0),(2,4),(0,0))
+ ((0,0))                    | ((3,1),(3,3),(1,0))
+ ((0,0))                    | ((1,2),(3,4),(5,6),(7,8))
+ ((0,0))                    | ((7,8),(5,6),(3,4),(1,2))
+ ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((0,0))
+ ((0,0))                    | ((0,1),(0,1))
+ ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
+ ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
+ ((0,1),(0,1))              | ((1,2),(3,4),(5,6),(7,8))
+ ((0,1),(0,1))              | ((7,8),(5,6),(3,4),(1,2))
+ ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,1),(0,1))              | ((0,0))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(32 rows)
+
+-- Right of polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 >> p2.f1;
+             f1             |      f1       
+----------------------------+---------------
+ ((3,1),(3,3),(1,0))        | ((0,0))
+ ((3,1),(3,3),(1,0))        | ((0,1),(0,1))
+ ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
+ ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
+ ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((0,0))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((0,1),(0,1))
+(8 rows)
+
+-- Overlap of right of polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &> p2.f1;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((2,0),(2,4),(0,0))        | ((0,0))
+ ((2,0),(2,4),(0,0))        | ((0,1),(0,1))
+ ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
+ ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
+ ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((3,1),(3,3),(1,0))        | ((0,0))
+ ((3,1),(3,3),(1,0))        | ((0,1),(0,1))
+ ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((3,1),(3,3),(1,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
+ ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
+ ((7,8),(5,6),(3,4),(1,2))  | ((3,1),(3,3),(1,0))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
+ ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((2,0),(2,4),(0,0))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((3,1),(3,3),(1,0))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((0,0))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((0,1),(0,1))
+ ((0,0))                    | ((2,0),(2,4),(0,0))
+ ((0,0))                    | ((0,0))
+ ((0,0))                    | ((0,1),(0,1))
+ ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
+ ((0,1),(0,1))              | ((0,0))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(37 rows)
+
+-- Below polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <<| p2.f1;
+      f1       |            f1             
+---------------+---------------------------
+ ((0,0))       | ((1,2),(3,4),(5,6),(7,8))
+ ((0,0))       | ((7,8),(5,6),(3,4),(1,2))
+ ((0,0))       | ((0,1),(0,1))
+ ((0,1),(0,1)) | ((1,2),(3,4),(5,6),(7,8))
+ ((0,1),(0,1)) | ((7,8),(5,6),(3,4),(1,2))
+(5 rows)
+
+-- Overlap or below polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &<| p2.f1;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((2,0),(2,4),(0,0))        | ((1,2),(3,4),(5,6),(7,8))
+ ((2,0),(2,4),(0,0))        | ((7,8),(5,6),(3,4),(1,2))
+ ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((3,1),(3,3),(1,0))        | ((1,2),(3,4),(5,6),(7,8))
+ ((3,1),(3,3),(1,0))        | ((7,8),(5,6),(3,4),(1,2))
+ ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((2,0),(2,4),(0,0))
+ ((0,0))                    | ((3,1),(3,3),(1,0))
+ ((0,0))                    | ((1,2),(3,4),(5,6),(7,8))
+ ((0,0))                    | ((7,8),(5,6),(3,4),(1,2))
+ ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((0,0))
+ ((0,0))                    | ((0,1),(0,1))
+ ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
+ ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
+ ((0,1),(0,1))              | ((1,2),(3,4),(5,6),(7,8))
+ ((0,1),(0,1))              | ((7,8),(5,6),(3,4),(1,2))
+ ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(31 rows)
+
+-- Above polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |>> p2.f1;
+            f1             |      f1       
+---------------------------+---------------
+ ((1,2),(3,4),(5,6),(7,8)) | ((0,0))
+ ((1,2),(3,4),(5,6),(7,8)) | ((0,1),(0,1))
+ ((7,8),(5,6),(3,4),(1,2)) | ((0,0))
+ ((7,8),(5,6),(3,4),(1,2)) | ((0,1),(0,1))
+ ((0,1),(0,1))             | ((0,0))
+(5 rows)
+
+-- Overlap or above polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |&> p2.f1;
+             f1             |             f1             
+----------------------------+----------------------------
+ ((2,0),(2,4),(0,0))        | ((2,0),(2,4),(0,0))
+ ((2,0),(2,4),(0,0))        | ((3,1),(3,3),(1,0))
+ ((2,0),(2,4),(0,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((2,0),(2,4),(0,0))        | ((0,0))
+ ((3,1),(3,3),(1,0))        | ((2,0),(2,4),(0,0))
+ ((3,1),(3,3),(1,0))        | ((3,1),(3,3),(1,0))
+ ((3,1),(3,3),(1,0))        | ((1,2),(7,8),(5,6),(3,-4))
+ ((3,1),(3,3),(1,0))        | ((0,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((2,0),(2,4),(0,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((3,1),(3,3),(1,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(3,4),(5,6),(7,8))
+ ((1,2),(3,4),(5,6),(7,8))  | ((7,8),(5,6),(3,4),(1,2))
+ ((1,2),(3,4),(5,6),(7,8))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((1,2),(3,4),(5,6),(7,8))  | ((0,0))
+ ((1,2),(3,4),(5,6),(7,8))  | ((0,1),(0,1))
+ ((7,8),(5,6),(3,4),(1,2))  | ((2,0),(2,4),(0,0))
+ ((7,8),(5,6),(3,4),(1,2))  | ((3,1),(3,3),(1,0))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(3,4),(5,6),(7,8))
+ ((7,8),(5,6),(3,4),(1,2))  | ((7,8),(5,6),(3,4),(1,2))
+ ((7,8),(5,6),(3,4),(1,2))  | ((1,2),(7,8),(5,6),(3,-4))
+ ((7,8),(5,6),(3,4),(1,2))  | ((0,0))
+ ((7,8),(5,6),(3,4),(1,2))  | ((0,1),(0,1))
+ ((1,2),(7,8),(5,6),(3,-4)) | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((2,0),(2,4),(0,0))
+ ((0,0))                    | ((3,1),(3,3),(1,0))
+ ((0,0))                    | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,0))                    | ((0,0))
+ ((0,1),(0,1))              | ((2,0),(2,4),(0,0))
+ ((0,1),(0,1))              | ((3,1),(3,3),(1,0))
+ ((0,1),(0,1))              | ((1,2),(7,8),(5,6),(3,-4))
+ ((0,1),(0,1))              | ((0,0))
+ ((0,1),(0,1))              | ((0,1),(0,1))
+(32 rows)
+
+-- Distance to polygon
+SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2;
+ERROR:  function "poly_distance" not implemented
 --
 -- Circles
 --
 SELECT '' AS six, circle(f1, 50.0)
    FROM POINT_TBL;
- six |     circle      
------+-----------------
+ six |         circle         
+-----+------------------------
      | <(0,0),50>
      | <(-10,0),50>
      | <(-3,4),50>
      | <(5.1,34.5),50>
      | <(-5,-12),50>
+     | <(1e-300,-1e-300),50>
+     | <(1e+300,Infinity),50>
+     | <(NaN,NaN),50>
      | <(10,10),50>
-(6 rows)
+(9 rows)
 
 SELECT '' AS four, circle(f1)
    FROM BOX_TBL;
- four |        circle         
-------+-----------------------
+ four |         circle         
+------+------------------------
       | <(1,1),1.41421356237>
       | <(2,2),1.41421356237>
+      | <(-5,-4),6.7082039325>
       | <(2.5,3),0.5>
       | <(3,3),0>
-(4 rows)
+(5 rows)
 
 SELECT '' AS two, circle(f1)
    FROM POLYGON_TBL
    WHERE (# f1) >= 3;
  two |                    circle                     
 -----+-----------------------------------------------
      | <(1.33333333333,1.33333333333),2.04168905064>
      | <(2.33333333333,1.33333333333),1.47534300379>
-(2 rows)
+     | <(4,5),2.82842712475>
+     | <(4,5),2.82842712475>
+     | <(4,3),4.80664375676>
+(5 rows)
 
 SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
    FROM CIRCLE_TBL c1, POINT_TBL p1
    WHERE (p1.f1 <-> c1.f1) > 0
    ORDER BY distance, area(c1.f1), p1.f1[0];
- twentyfour |     circle     |   point    |   distance    
-------------+----------------+------------+---------------
-            | <(1,2),3>      | (-3,4)     |   1.472135955
-            | <(5,1),3>      | (0,0)      | 2.09901951359
-            | <(5,1),3>      | (-3,4)     | 5.54400374532
-            | <(1,3),5>      | (-10,0)    | 6.40175425099
-            | <(1,3),5>      | (10,10)    | 6.40175425099
-            | <(5,1),3>      | (10,10)    | 7.29563014099
-            | <(1,2),3>      | (-10,0)    |  8.1803398875
-            | <(1,2),3>      | (10,10)    | 9.04159457879
-            | <(1,3),5>      | (-5,-12)   | 11.1554944214
-            | <(5,1),3>      | (-10,0)    | 12.0332963784
-            | <(1,2),3>      | (-5,-12)   | 12.2315462117
-            | <(5,1),3>      | (-5,-12)   | 13.4012194669
-            | <(1,3),5>      | (5.1,34.5) | 26.7657047773
-            | <(1,2),3>      | (5.1,34.5) | 29.7575945393
-            | <(5,1),3>      | (5.1,34.5) | 30.5001492534
-            | <(100,200),10> | (5.1,34.5) | 180.778038568
-            | <(100,200),10> | (10,10)    | 200.237960416
-            | <(100,200),10> | (-3,4)     | 211.415898255
-            | <(100,200),10> | (0,0)      |  213.60679775
-            | <(100,200),10> | (-10,0)    |  218.25424421
-            | <(100,200),10> | (-5,-12)   | 226.577682802
-(21 rows)
+ twentyfour |     circle     |       point       |   distance    
+------------+----------------+-------------------+---------------
+            | <(1,2),3>      | (-3,4)            |   1.472135955
+            | <(5,1),3>      | (0,0)             | 2.09901951359
+            | <(5,1),3>      | (1e-300,-1e-300)  | 2.09901951359
+            | <(5,1),3>      | (-3,4)            | 5.54400374532
+            | <(3,5),0>      | (0,0)             | 5.83095189485
+            | <(3,5),0>      | (1e-300,-1e-300)  | 5.83095189485
+            | <(3,5),0>      | (-3,4)            |  6.0827625303
+            | <(1,3),5>      | (-10,0)           | 6.40175425099
+            | <(1,3),5>      | (10,10)           | 6.40175425099
+            | <(5,1),3>      | (10,10)           | 7.29563014099
+            | <(1,2),3>      | (-10,0)           |  8.1803398875
+            | <(3,5),0>      | (10,10)           | 8.60232526704
+            | <(1,2),3>      | (10,10)           | 9.04159457879
+            | <(1,3),5>      | (-5,-12)          | 11.1554944214
+            | <(5,1),3>      | (-10,0)           | 12.0332963784
+            | <(1,2),3>      | (-5,-12)          | 12.2315462117
+            | <(5,1),3>      | (-5,-12)          | 13.4012194669
+            | <(3,5),0>      | (-10,0)           | 13.9283882772
+            | <(3,5),0>      | (-5,-12)          | 18.7882942281
+            | <(1,3),5>      | (5.1,34.5)        | 26.7657047773
+            | <(3,5),0>      | (5.1,34.5)        | 29.5746513082
+            | <(1,2),3>      | (5.1,34.5)        | 29.7575945393
+            | <(5,1),3>      | (5.1,34.5)        | 30.5001492534
+            | <(100,200),10> | (5.1,34.5)        | 180.778038568
+            | <(100,200),10> | (10,10)           | 200.237960416
+            | <(100,200),10> | (-3,4)            | 211.415898255
+            | <(100,200),10> | (0,0)             |  213.60679775
+            | <(100,200),10> | (1e-300,-1e-300)  |  213.60679775
+            | <(100,200),10> | (-10,0)           |  218.25424421
+            | <(100,200),10> | (-5,-12)          | 226.577682802
+            | <(3,5),0>      | (1e+300,Infinity) |      Infinity
+            | <(1,2),3>      | (1e+300,Infinity) |      Infinity
+            | <(5,1),3>      | (1e+300,Infinity) |      Infinity
+            | <(1,3),5>      | (1e+300,Infinity) |      Infinity
+            | <(100,200),10> | (1e+300,Infinity) |      Infinity
+            | <(1,2),100>    | (1e+300,Infinity) |      Infinity
+            | <(100,1),115>  | (1e+300,Infinity) |      Infinity
+            | <(3,5),0>      | (NaN,NaN)         |           NaN
+            | <(1,2),3>      | (NaN,NaN)         |           NaN
+            | <(5,1),3>      | (NaN,NaN)         |           NaN
+            | <(1,3),5>      | (NaN,NaN)         |           NaN
+            | <(100,200),10> | (NaN,NaN)         |           NaN
+            | <(1,2),100>    | (NaN,NaN)         |           NaN
+            | <(100,1),115>  | (NaN,NaN)         |           NaN
+            | <(3,5),NaN>    | (-10,0)           |           NaN
+            | <(3,5),NaN>    | (-5,-12)          |           NaN
+            | <(3,5),NaN>    | (-3,4)            |           NaN
+            | <(3,5),NaN>    | (0,0)             |           NaN
+            | <(3,5),NaN>    | (1e-300,-1e-300)  |           NaN
+            | <(3,5),NaN>    | (5.1,34.5)        |           NaN
+            | <(3,5),NaN>    | (10,10)           |           NaN
+            | <(3,5),NaN>    | (1e+300,Infinity) |           NaN
+            | <(3,5),NaN>    | (NaN,NaN)         |           NaN
+(53 rows)
+
+-- To polygon
+SELECT f1, f1::polygon FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
+       f1       |                                                                                                          f1                                                                                                          
+----------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ <(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))
+ <(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))
+ <(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))
+ <(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))
+ <(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))
+ <(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))
+(6 rows)
+
+-- To polygon with less points
+SELECT f1, polygon(8, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
+       f1       |                                                                             polygon                                                                              
+----------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------
+ <(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))
+ <(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))
+ <(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))
+ <(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))
+ <(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))
+ <(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))
+(6 rows)
+
+-- Too less points error
+SELECT f1, polygon(1, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
+ERROR:  must request at least 2 points
+-- Zero radius error
+SELECT f1, polygon(10, f1) FROM CIRCLE_TBL WHERE f1 < '<(0,0),1>';
+ERROR:  cannot convert circle with radius zero to polygon
+-- Same as circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 ~= c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(1,2),100>    | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,2),3>      | <(1,2),3>
+ <(100,200),10> | <(100,200),10>
+ <(100,1),115>  | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+ <(3,5),NaN>    | <(3,5),0>
+ <(3,5),NaN>    | <(3,5),NaN>
+(9 rows)
+
+-- Overlap with circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 && c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(1,2),3>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(5,1),3>
+ <(1,2),100>    | <(1,2),100>
+ <(1,2),100>    | <(1,3),5>
+ <(1,2),100>    | <(1,2),3>
+ <(1,2),100>    | <(100,1),115>
+ <(1,2),100>    | <(3,5),0>
+ <(1,3),5>      | <(5,1),3>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(1,2),3>
+ <(1,3),5>      | <(100,1),115>
+ <(1,3),5>      | <(3,5),0>
+ <(1,2),3>      | <(5,1),3>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(1,2),3>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(100,200),10>
+ <(100,1),115>  | <(5,1),3>
+ <(100,1),115>  | <(1,2),100>
+ <(100,1),115>  | <(1,3),5>
+ <(100,1),115>  | <(1,2),3>
+ <(100,1),115>  | <(100,1),115>
+ <(100,1),115>  | <(3,5),0>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+(33 rows)
+
+-- Overlap or left of circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &< c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(100,200),10>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(1,2),100>
+ <(1,2),100>    | <(100,200),10>
+ <(1,2),100>    | <(100,1),115>
+ <(1,3),5>      | <(5,1),3>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(100,200),10>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(5,1),3>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(1,2),3>
+ <(1,2),3>      | <(100,200),10>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(100,200),10>
+ <(100,200),10> | <(100,1),115>
+ <(100,1),115>  | <(100,1),115>
+ <(3,5),0>      | <(5,1),3>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,200),10>
+ <(3,5),0>      | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+(28 rows)
+
+-- Left of circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 << c2.f1;
+    f1     |       f1       
+-----------+----------------
+ <(5,1),3> | <(100,200),10>
+ <(1,3),5> | <(100,200),10>
+ <(1,2),3> | <(100,200),10>
+ <(3,5),0> | <(100,200),10>
+(4 rows)
+
+-- Right of circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >> c2.f1;
+       f1       |    f1     
+----------------+-----------
+ <(100,200),10> | <(5,1),3>
+ <(100,200),10> | <(1,3),5>
+ <(100,200),10> | <(1,2),3>
+ <(100,200),10> | <(3,5),0>
+(4 rows)
+
+-- Overlap or right of circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &> c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(1,2),3>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(1,2),100>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(1,2),3>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(5,1),3>
+ <(100,200),10> | <(1,2),100>
+ <(100,200),10> | <(1,3),5>
+ <(100,200),10> | <(1,2),3>
+ <(100,200),10> | <(100,200),10>
+ <(100,200),10> | <(100,1),115>
+ <(100,200),10> | <(3,5),0>
+ <(100,1),115>  | <(1,2),100>
+ <(100,1),115>  | <(100,1),115>
+ <(3,5),0>      | <(5,1),3>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+(28 rows)
+
+-- Contained by circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <@ c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(1,2),100>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(1,2),3>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(100,200),10>
+ <(100,1),115>  | <(100,1),115>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+(17 rows)
+
+-- Contain by circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 @> c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(1,2),100>    | <(5,1),3>
+ <(1,2),100>    | <(1,2),100>
+ <(1,2),100>    | <(1,3),5>
+ <(1,2),100>    | <(1,2),3>
+ <(1,2),100>    | <(3,5),0>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(1,2),3>
+ <(1,3),5>      | <(3,5),0>
+ <(1,2),3>      | <(1,2),3>
+ <(100,200),10> | <(100,200),10>
+ <(100,1),115>  | <(5,1),3>
+ <(100,1),115>  | <(1,3),5>
+ <(100,1),115>  | <(1,2),3>
+ <(100,1),115>  | <(100,1),115>
+ <(100,1),115>  | <(3,5),0>
+ <(3,5),0>      | <(3,5),0>
+(17 rows)
+
+-- Below circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <<| c2.f1;
+      f1       |       f1       
+---------------+----------------
+ <(5,1),3>     | <(100,200),10>
+ <(5,1),3>     | <(3,5),0>
+ <(1,2),100>   | <(100,200),10>
+ <(1,3),5>     | <(100,200),10>
+ <(1,2),3>     | <(100,200),10>
+ <(100,1),115> | <(100,200),10>
+ <(3,5),0>     | <(100,200),10>
+(7 rows)
+
+-- Above circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |>> c2.f1;
+       f1       |      f1       
+----------------+---------------
+ <(100,200),10> | <(5,1),3>
+ <(100,200),10> | <(1,2),100>
+ <(100,200),10> | <(1,3),5>
+ <(100,200),10> | <(1,2),3>
+ <(100,200),10> | <(100,1),115>
+ <(100,200),10> | <(3,5),0>
+ <(3,5),0>      | <(5,1),3>
+(7 rows)
+
+-- Overlap or below circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &<| c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(1,2),3>
+ <(5,1),3>      | <(100,200),10>
+ <(5,1),3>      | <(100,1),115>
+ <(5,1),3>      | <(3,5),0>
+ <(1,2),100>    | <(1,2),100>
+ <(1,2),100>    | <(100,200),10>
+ <(1,2),100>    | <(100,1),115>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(100,200),10>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(1,2),3>
+ <(1,2),3>      | <(100,200),10>
+ <(1,2),3>      | <(100,1),115>
+ <(1,2),3>      | <(3,5),0>
+ <(100,200),10> | <(100,200),10>
+ <(100,1),115>  | <(100,200),10>
+ <(100,1),115>  | <(100,1),115>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,200),10>
+ <(3,5),0>      | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+(29 rows)
+
+-- Overlap or above circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |&> c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(1,2),100>
+ <(1,2),100>    | <(100,1),115>
+ <(1,3),5>      | <(5,1),3>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(5,1),3>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(1,2),3>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(5,1),3>
+ <(100,200),10> | <(1,2),100>
+ <(100,200),10> | <(1,3),5>
+ <(100,200),10> | <(1,2),3>
+ <(100,200),10> | <(100,200),10>
+ <(100,200),10> | <(100,1),115>
+ <(100,200),10> | <(3,5),0>
+ <(100,1),115>  | <(100,1),115>
+ <(3,5),0>      | <(5,1),3>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+(29 rows)
+
+-- Area equal with circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 = c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),3>
+ <(1,2),100>    | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,2),3>      | <(5,1),3>
+ <(1,2),3>      | <(1,2),3>
+ <(100,200),10> | <(100,200),10>
+ <(100,1),115>  | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+(9 rows)
+
+-- Area not equal with circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 != c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(100,200),10>
+ <(5,1),3>      | <(100,1),115>
+ <(5,1),3>      | <(3,5),0>
+ <(1,2),100>    | <(5,1),3>
+ <(1,2),100>    | <(1,3),5>
+ <(1,2),100>    | <(1,2),3>
+ <(1,2),100>    | <(100,200),10>
+ <(1,2),100>    | <(100,1),115>
+ <(1,2),100>    | <(3,5),0>
+ <(1,3),5>      | <(5,1),3>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(1,2),3>
+ <(1,3),5>      | <(100,200),10>
+ <(1,3),5>      | <(100,1),115>
+ <(1,3),5>      | <(3,5),0>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(100,200),10>
+ <(1,2),3>      | <(100,1),115>
+ <(1,2),3>      | <(3,5),0>
+ <(100,200),10> | <(5,1),3>
+ <(100,200),10> | <(1,2),100>
+ <(100,200),10> | <(1,3),5>
+ <(100,200),10> | <(1,2),3>
+ <(100,200),10> | <(100,1),115>
+ <(100,200),10> | <(3,5),0>
+ <(100,1),115>  | <(5,1),3>
+ <(100,1),115>  | <(1,2),100>
+ <(100,1),115>  | <(1,3),5>
+ <(100,1),115>  | <(1,2),3>
+ <(100,1),115>  | <(100,200),10>
+ <(100,1),115>  | <(3,5),0>
+ <(3,5),0>      | <(5,1),3>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,200),10>
+ <(3,5),0>      | <(100,1),115>
+(40 rows)
+
+-- Area less than circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(100,200),10>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(100,1),115>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(100,200),10>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(100,200),10>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(1,2),100>
+ <(100,200),10> | <(100,1),115>
+ <(3,5),0>      | <(5,1),3>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,200),10>
+ <(3,5),0>      | <(100,1),115>
+(20 rows)
+
+-- Area greater than circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 > c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(3,5),0>
+ <(1,2),100>    | <(5,1),3>
+ <(1,2),100>    | <(1,3),5>
+ <(1,2),100>    | <(1,2),3>
+ <(1,2),100>    | <(100,200),10>
+ <(1,2),100>    | <(3,5),0>
+ <(1,3),5>      | <(5,1),3>
+ <(1,3),5>      | <(1,2),3>
+ <(1,3),5>      | <(3,5),0>
+ <(1,2),3>      | <(3,5),0>
+ <(100,200),10> | <(5,1),3>
+ <(100,200),10> | <(1,3),5>
+ <(100,200),10> | <(1,2),3>
+ <(100,200),10> | <(3,5),0>
+ <(100,1),115>  | <(5,1),3>
+ <(100,1),115>  | <(1,2),100>
+ <(100,1),115>  | <(1,3),5>
+ <(100,1),115>  | <(1,2),3>
+ <(100,1),115>  | <(100,200),10>
+ <(100,1),115>  | <(3,5),0>
+(20 rows)
+
+-- Area less than or equal circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <= c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(1,2),3>
+ <(5,1),3>      | <(100,200),10>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(1,2),100>
+ <(1,2),100>    | <(100,1),115>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(100,200),10>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(5,1),3>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(1,2),3>
+ <(1,2),3>      | <(100,200),10>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(1,2),100>
+ <(100,200),10> | <(100,200),10>
+ <(100,200),10> | <(100,1),115>
+ <(100,1),115>  | <(100,1),115>
+ <(3,5),0>      | <(5,1),3>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,200),10>
+ <(3,5),0>      | <(100,1),115>
+ <(3,5),0>      | <(3,5),0>
+(29 rows)
+
+-- Area greater than or equal circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >= c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(5,1),3>
+ <(5,1),3>      | <(1,2),3>
+ <(5,1),3>      | <(3,5),0>
+ <(1,2),100>    | <(5,1),3>
+ <(1,2),100>    | <(1,2),100>
+ <(1,2),100>    | <(1,3),5>
+ <(1,2),100>    | <(1,2),3>
+ <(1,2),100>    | <(100,200),10>
+ <(1,2),100>    | <(3,5),0>
+ <(1,3),5>      | <(5,1),3>
+ <(1,3),5>      | <(1,3),5>
+ <(1,3),5>      | <(1,2),3>
+ <(1,3),5>      | <(3,5),0>
+ <(1,2),3>      | <(5,1),3>
+ <(1,2),3>      | <(1,2),3>
+ <(1,2),3>      | <(3,5),0>
+ <(100,200),10> | <(5,1),3>
+ <(100,200),10> | <(1,3),5>
+ <(100,200),10> | <(1,2),3>
+ <(100,200),10> | <(100,200),10>
+ <(100,200),10> | <(3,5),0>
+ <(100,1),115>  | <(5,1),3>
+ <(100,1),115>  | <(1,2),100>
+ <(100,1),115>  | <(1,3),5>
+ <(100,1),115>  | <(1,2),3>
+ <(100,1),115>  | <(100,200),10>
+ <(100,1),115>  | <(100,1),115>
+ <(100,1),115>  | <(3,5),0>
+ <(3,5),0>      | <(3,5),0>
+(29 rows)
+
+-- Area less than circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(100,200),10>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(100,1),115>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(100,200),10>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(100,200),10>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(1,2),100>
+ <(100,200),10> | <(100,1),115>
+ <(3,5),0>      | <(5,1),3>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,200),10>
+ <(3,5),0>      | <(100,1),115>
+(20 rows)
+
+-- Area greater than circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
+       f1       |       f1       
+----------------+----------------
+ <(5,1),3>      | <(1,2),100>
+ <(5,1),3>      | <(1,3),5>
+ <(5,1),3>      | <(100,200),10>
+ <(5,1),3>      | <(100,1),115>
+ <(1,2),100>    | <(100,1),115>
+ <(1,3),5>      | <(1,2),100>
+ <(1,3),5>      | <(100,200),10>
+ <(1,3),5>      | <(100,1),115>
+ <(1,2),3>      | <(1,2),100>
+ <(1,2),3>      | <(1,3),5>
+ <(1,2),3>      | <(100,200),10>
+ <(1,2),3>      | <(100,1),115>
+ <(100,200),10> | <(1,2),100>
+ <(100,200),10> | <(100,1),115>
+ <(3,5),0>      | <(5,1),3>
+ <(3,5),0>      | <(1,2),100>
+ <(3,5),0>      | <(1,3),5>
+ <(3,5),0>      | <(1,2),3>
+ <(3,5),0>      | <(100,200),10>
+ <(3,5),0>      | <(100,1),115>
+(20 rows)
+
+-- Add point
+SELECT c.f1, p.f1, c.f1 + p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
+       f1       |        f1         |        ?column?         
+----------------+-------------------+-------------------------
+ <(5,1),3>      | (0,0)             | <(5,1),3>
+ <(1,2),100>    | (0,0)             | <(1,2),100>
+ <(1,3),5>      | (0,0)             | <(1,3),5>
+ <(1,2),3>      | (0,0)             | <(1,2),3>
+ <(100,200),10> | (0,0)             | <(100,200),10>
+ <(100,1),115>  | (0,0)             | <(100,1),115>
+ <(3,5),0>      | (0,0)             | <(3,5),0>
+ <(3,5),NaN>    | (0,0)             | <(3,5),NaN>
+ <(5,1),3>      | (-10,0)           | <(-5,1),3>
+ <(1,2),100>    | (-10,0)           | <(-9,2),100>
+ <(1,3),5>      | (-10,0)           | <(-9,3),5>
+ <(1,2),3>      | (-10,0)           | <(-9,2),3>
+ <(100,200),10> | (-10,0)           | <(90,200),10>
+ <(100,1),115>  | (-10,0)           | <(90,1),115>
+ <(3,5),0>      | (-10,0)           | <(-7,5),0>
+ <(3,5),NaN>    | (-10,0)           | <(-7,5),NaN>
+ <(5,1),3>      | (-3,4)            | <(2,5),3>
+ <(1,2),100>    | (-3,4)            | <(-2,6),100>
+ <(1,3),5>      | (-3,4)            | <(-2,7),5>
+ <(1,2),3>      | (-3,4)            | <(-2,6),3>
+ <(100,200),10> | (-3,4)            | <(97,204),10>
+ <(100,1),115>  | (-3,4)            | <(97,5),115>
+ <(3,5),0>      | (-3,4)            | <(0,9),0>
+ <(3,5),NaN>    | (-3,4)            | <(0,9),NaN>
+ <(5,1),3>      | (5.1,34.5)        | <(10.1,35.5),3>
+ <(1,2),100>    | (5.1,34.5)        | <(6.1,36.5),100>
+ <(1,3),5>      | (5.1,34.5)        | <(6.1,37.5),5>
+ <(1,2),3>      | (5.1,34.5)        | <(6.1,36.5),3>
+ <(100,200),10> | (5.1,34.5)        | <(105.1,234.5),10>
+ <(100,1),115>  | (5.1,34.5)        | <(105.1,35.5),115>
+ <(3,5),0>      | (5.1,34.5)        | <(8.1,39.5),0>
+ <(3,5),NaN>    | (5.1,34.5)        | <(8.1,39.5),NaN>
+ <(5,1),3>      | (-5,-12)          | <(0,-11),3>
+ <(1,2),100>    | (-5,-12)          | <(-4,-10),100>
+ <(1,3),5>      | (-5,-12)          | <(-4,-9),5>
+ <(1,2),3>      | (-5,-12)          | <(-4,-10),3>
+ <(100,200),10> | (-5,-12)          | <(95,188),10>
+ <(100,1),115>  | (-5,-12)          | <(95,-11),115>
+ <(3,5),0>      | (-5,-12)          | <(-2,-7),0>
+ <(3,5),NaN>    | (-5,-12)          | <(-2,-7),NaN>
+ <(5,1),3>      | (1e-300,-1e-300)  | <(5,1),3>
+ <(1,2),100>    | (1e-300,-1e-300)  | <(1,2),100>
+ <(1,3),5>      | (1e-300,-1e-300)  | <(1,3),5>
+ <(1,2),3>      | (1e-300,-1e-300)  | <(1,2),3>
+ <(100,200),10> | (1e-300,-1e-300)  | <(100,200),10>
+ <(100,1),115>  | (1e-300,-1e-300)  | <(100,1),115>
+ <(3,5),0>      | (1e-300,-1e-300)  | <(3,5),0>
+ <(3,5),NaN>    | (1e-300,-1e-300)  | <(3,5),NaN>
+ <(5,1),3>      | (1e+300,Infinity) | <(1e+300,Infinity),3>
+ <(1,2),100>    | (1e+300,Infinity) | <(1e+300,Infinity),100>
+ <(1,3),5>      | (1e+300,Infinity) | <(1e+300,Infinity),5>
+ <(1,2),3>      | (1e+300,Infinity) | <(1e+300,Infinity),3>
+ <(100,200),10> | (1e+300,Infinity) | <(1e+300,Infinity),10>
+ <(100,1),115>  | (1e+300,Infinity) | <(1e+300,Infinity),115>
+ <(3,5),0>      | (1e+300,Infinity) | <(1e+300,Infinity),0>
+ <(3,5),NaN>    | (1e+300,Infinity) | <(1e+300,Infinity),NaN>
+ <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),3>
+ <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),100>
+ <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),5>
+ <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),3>
+ <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),10>
+ <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),115>
+ <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),0>
+ <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(5,1),3>      | (10,10)           | <(15,11),3>
+ <(1,2),100>    | (10,10)           | <(11,12),100>
+ <(1,3),5>      | (10,10)           | <(11,13),5>
+ <(1,2),3>      | (10,10)           | <(11,12),3>
+ <(100,200),10> | (10,10)           | <(110,210),10>
+ <(100,1),115>  | (10,10)           | <(110,11),115>
+ <(3,5),0>      | (10,10)           | <(13,15),0>
+ <(3,5),NaN>    | (10,10)           | <(13,15),NaN>
+(72 rows)
+
+-- Subtract point
+SELECT c.f1, p.f1, c.f1 - p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
+       f1       |        f1         |         ?column?          
+----------------+-------------------+---------------------------
+ <(5,1),3>      | (0,0)             | <(5,1),3>
+ <(1,2),100>    | (0,0)             | <(1,2),100>
+ <(1,3),5>      | (0,0)             | <(1,3),5>
+ <(1,2),3>      | (0,0)             | <(1,2),3>
+ <(100,200),10> | (0,0)             | <(100,200),10>
+ <(100,1),115>  | (0,0)             | <(100,1),115>
+ <(3,5),0>      | (0,0)             | <(3,5),0>
+ <(3,5),NaN>    | (0,0)             | <(3,5),NaN>
+ <(5,1),3>      | (-10,0)           | <(15,1),3>
+ <(1,2),100>    | (-10,0)           | <(11,2),100>
+ <(1,3),5>      | (-10,0)           | <(11,3),5>
+ <(1,2),3>      | (-10,0)           | <(11,2),3>
+ <(100,200),10> | (-10,0)           | <(110,200),10>
+ <(100,1),115>  | (-10,0)           | <(110,1),115>
+ <(3,5),0>      | (-10,0)           | <(13,5),0>
+ <(3,5),NaN>    | (-10,0)           | <(13,5),NaN>
+ <(5,1),3>      | (-3,4)            | <(8,-3),3>
+ <(1,2),100>    | (-3,4)            | <(4,-2),100>
+ <(1,3),5>      | (-3,4)            | <(4,-1),5>
+ <(1,2),3>      | (-3,4)            | <(4,-2),3>
+ <(100,200),10> | (-3,4)            | <(103,196),10>
+ <(100,1),115>  | (-3,4)            | <(103,-3),115>
+ <(3,5),0>      | (-3,4)            | <(6,1),0>
+ <(3,5),NaN>    | (-3,4)            | <(6,1),NaN>
+ <(5,1),3>      | (5.1,34.5)        | <(-0.1,-33.5),3>
+ <(1,2),100>    | (5.1,34.5)        | <(-4.1,-32.5),100>
+ <(1,3),5>      | (5.1,34.5)        | <(-4.1,-31.5),5>
+ <(1,2),3>      | (5.1,34.5)        | <(-4.1,-32.5),3>
+ <(100,200),10> | (5.1,34.5)        | <(94.9,165.5),10>
+ <(100,1),115>  | (5.1,34.5)        | <(94.9,-33.5),115>
+ <(3,5),0>      | (5.1,34.5)        | <(-2.1,-29.5),0>
+ <(3,5),NaN>    | (5.1,34.5)        | <(-2.1,-29.5),NaN>
+ <(5,1),3>      | (-5,-12)          | <(10,13),3>
+ <(1,2),100>    | (-5,-12)          | <(6,14),100>
+ <(1,3),5>      | (-5,-12)          | <(6,15),5>
+ <(1,2),3>      | (-5,-12)          | <(6,14),3>
+ <(100,200),10> | (-5,-12)          | <(105,212),10>
+ <(100,1),115>  | (-5,-12)          | <(105,13),115>
+ <(3,5),0>      | (-5,-12)          | <(8,17),0>
+ <(3,5),NaN>    | (-5,-12)          | <(8,17),NaN>
+ <(5,1),3>      | (1e-300,-1e-300)  | <(5,1),3>
+ <(1,2),100>    | (1e-300,-1e-300)  | <(1,2),100>
+ <(1,3),5>      | (1e-300,-1e-300)  | <(1,3),5>
+ <(1,2),3>      | (1e-300,-1e-300)  | <(1,2),3>
+ <(100,200),10> | (1e-300,-1e-300)  | <(100,200),10>
+ <(100,1),115>  | (1e-300,-1e-300)  | <(100,1),115>
+ <(3,5),0>      | (1e-300,-1e-300)  | <(3,5),0>
+ <(3,5),NaN>    | (1e-300,-1e-300)  | <(3,5),NaN>
+ <(5,1),3>      | (1e+300,Infinity) | <(-1e+300,-Infinity),3>
+ <(1,2),100>    | (1e+300,Infinity) | <(-1e+300,-Infinity),100>
+ <(1,3),5>      | (1e+300,Infinity) | <(-1e+300,-Infinity),5>
+ <(1,2),3>      | (1e+300,Infinity) | <(-1e+300,-Infinity),3>
+ <(100,200),10> | (1e+300,Infinity) | <(-1e+300,-Infinity),10>
+ <(100,1),115>  | (1e+300,Infinity) | <(-1e+300,-Infinity),115>
+ <(3,5),0>      | (1e+300,Infinity) | <(-1e+300,-Infinity),0>
+ <(3,5),NaN>    | (1e+300,Infinity) | <(-1e+300,-Infinity),NaN>
+ <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),3>
+ <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),100>
+ <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),5>
+ <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),3>
+ <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),10>
+ <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),115>
+ <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),0>
+ <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(5,1),3>      | (10,10)           | <(-5,-9),3>
+ <(1,2),100>    | (10,10)           | <(-9,-8),100>
+ <(1,3),5>      | (10,10)           | <(-9,-7),5>
+ <(1,2),3>      | (10,10)           | <(-9,-8),3>
+ <(100,200),10> | (10,10)           | <(90,190),10>
+ <(100,1),115>  | (10,10)           | <(90,-9),115>
+ <(3,5),0>      | (10,10)           | <(-7,-5),0>
+ <(3,5),NaN>    | (10,10)           | <(-7,-5),NaN>
+(72 rows)
+
+-- Multiply with point
+SELECT c.f1, p.f1, c.f1 * p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
+       f1       |        f1         |                  ?column?                  
+----------------+-------------------+--------------------------------------------
+ <(5,1),3>      | (0,0)             | <(0,0),0>
+ <(1,2),100>    | (0,0)             | <(0,0),0>
+ <(1,3),5>      | (0,0)             | <(0,0),0>
+ <(1,2),3>      | (0,0)             | <(0,0),0>
+ <(100,200),10> | (0,0)             | <(0,0),0>
+ <(100,1),115>  | (0,0)             | <(0,0),0>
+ <(3,5),0>      | (0,0)             | <(0,0),0>
+ <(3,5),NaN>    | (0,0)             | <(0,0),NaN>
+ <(5,1),3>      | (-10,0)           | <(-50,-10),30>
+ <(1,2),100>    | (-10,0)           | <(-10,-20),1000>
+ <(1,3),5>      | (-10,0)           | <(-10,-30),50>
+ <(1,2),3>      | (-10,0)           | <(-10,-20),30>
+ <(100,200),10> | (-10,0)           | <(-1000,-2000),100>
+ <(100,1),115>  | (-10,0)           | <(-1000,-10),1150>
+ <(3,5),0>      | (-10,0)           | <(-30,-50),0>
+ <(3,5),NaN>    | (-10,0)           | <(-30,-50),NaN>
+ <(5,1),3>      | (-3,4)            | <(-19,17),15>
+ <(1,2),100>    | (-3,4)            | <(-11,-2),500>
+ <(1,3),5>      | (-3,4)            | <(-15,-5),25>
+ <(1,2),3>      | (-3,4)            | <(-11,-2),15>
+ <(100,200),10> | (-3,4)            | <(-1100,-200),50>
+ <(100,1),115>  | (-3,4)            | <(-304,397),575>
+ <(3,5),0>      | (-3,4)            | <(-29,-3),0>
+ <(3,5),NaN>    | (-3,4)            | <(-29,-3),NaN>
+ <(5,1),3>      | (5.1,34.5)        | <(-9,177.6),104.624758064>
+ <(1,2),100>    | (5.1,34.5)        | <(-63.9,44.7),3487.49193547>
+ <(1,3),5>      | (5.1,34.5)        | <(-98.4,49.8),174.374596774>
+ <(1,2),3>      | (5.1,34.5)        | <(-63.9,44.7),104.624758064>
+ <(100,200),10> | (5.1,34.5)        | <(-6390,4470),348.749193547>
+ <(100,1),115>  | (5.1,34.5)        | <(475.5,3455.1),4010.6157258>
+ <(3,5),0>      | (5.1,34.5)        | <(-157.2,129),0>
+ <(3,5),NaN>    | (5.1,34.5)        | <(-157.2,129),NaN>
+ <(5,1),3>      | (-5,-12)          | <(-13,-65),39>
+ <(1,2),100>    | (-5,-12)          | <(19,-22),1300>
+ <(1,3),5>      | (-5,-12)          | <(31,-27),65>
+ <(1,2),3>      | (-5,-12)          | <(19,-22),39>
+ <(100,200),10> | (-5,-12)          | <(1900,-2200),130>
+ <(100,1),115>  | (-5,-12)          | <(-488,-1205),1495>
+ <(3,5),0>      | (-5,-12)          | <(45,-61),0>
+ <(3,5),NaN>    | (-5,-12)          | <(45,-61),NaN>
+ <(5,1),3>      | (1e-300,-1e-300)  | <(6e-300,-4e-300),4.24264068712e-300>
+ <(1,2),100>    | (1e-300,-1e-300)  | <(3e-300,1e-300),1.41421356237e-298>
+ <(1,3),5>      | (1e-300,-1e-300)  | <(4e-300,2e-300),7.07106781187e-300>
+ <(1,2),3>      | (1e-300,-1e-300)  | <(3e-300,1e-300),4.24264068712e-300>
+ <(100,200),10> | (1e-300,-1e-300)  | <(3e-298,1e-298),1.41421356237e-299>
+ <(100,1),115>  | (1e-300,-1e-300)  | <(1.01e-298,-9.9e-299),1.62634559673e-298>
+ <(3,5),0>      | (1e-300,-1e-300)  | <(8e-300,2e-300),0>
+ <(3,5),NaN>    | (1e-300,-1e-300)  | <(8e-300,2e-300),NaN>
+ <(5,1),3>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
+ <(1,2),100>    | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
+ <(1,3),5>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
+ <(1,2),3>      | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
+ <(100,200),10> | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
+ <(100,1),115>  | (1e+300,Infinity) | <(-Infinity,Infinity),Infinity>
+ <(3,5),0>      | (1e+300,Infinity) | <(-Infinity,Infinity),NaN>
+ <(3,5),NaN>    | (1e+300,Infinity) | <(-Infinity,Infinity),NaN>
+ <(5,1),3>      | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(1,2),100>    | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(1,3),5>      | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(1,2),3>      | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(100,200),10> | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(100,1),115>  | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(3,5),0>      | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(3,5),NaN>    | (NaN,NaN)         | <(NaN,NaN),NaN>
+ <(5,1),3>      | (10,10)           | <(40,60),42.4264068712>
+ <(1,2),100>    | (10,10)           | <(-10,30),1414.21356237>
+ <(1,3),5>      | (10,10)           | <(-20,40),70.7106781187>
+ <(1,2),3>      | (10,10)           | <(-10,30),42.4264068712>
+ <(100,200),10> | (10,10)           | <(-1000,3000),141.421356237>
+ <(100,1),115>  | (10,10)           | <(990,1010),1626.34559673>
+ <(3,5),0>      | (10,10)           | <(-20,80),0>
+ <(3,5),NaN>    | (10,10)           | <(-20,80),NaN>
+(72 rows)
+
+-- Divide by point
+SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
+       f1       |     f1     |                       ?column?                       
+----------------+------------+------------------------------------------------------
+ <(5,1),3>      | (5.1,34.5) | <(0.0493315573973,-0.137635045138),0.0860217042937>
+ <(5,1),3>      | (10,10)    | <(0.3,-0.2),0.212132034356>
+ <(1,2),100>    | (5.1,34.5) | <(0.0609244733856,-0.0199792807459),2.86739014312>
+ <(1,2),100>    | (10,10)    | <(0.15,0.05),7.07106781187>
+ <(1,3),5>      | (5.1,34.5) | <(0.0892901188891,-0.0157860983671),0.143369507156>
+ <(1,3),5>      | (10,10)    | <(0.2,0.1),0.353553390593>
+ <(1,2),3>      | (5.1,34.5) | <(0.0609244733856,-0.0199792807459),0.0860217042937>
+ <(1,2),3>      | (10,10)    | <(0.15,0.05),0.212132034356>
+ <(100,200),10> | (5.1,34.5) | <(6.09244733856,-1.99792807459),0.286739014312>
+ <(100,200),10> | (10,10)    | <(15,5),0.707106781187>
+ <(100,1),115>  | (5.1,34.5) | <(0.44768388338,-2.83237136796),3.29749866459>
+ <(100,1),115>  | (10,10)    | <(5.05,-4.95),8.13172798365>
+ <(3,5),0>      | (5.1,34.5) | <(0.154407774653,-0.0641310246164),0>
+ <(3,5),0>      | (10,10)    | <(0.4,0.1),0>
+ <(3,5),NaN>    | (5.1,34.5) | <(0.154407774653,-0.0641310246164),NaN>
+ <(3,5),NaN>    | (10,10)    | <(0.4,0.1),NaN>
+(16 rows)
+
+-- Overflow error
+SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] > 1000;
+ERROR:  value out of range: overflow
+-- Division by 0 error
+SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1 ~= '(0,0)'::point;
+ERROR:  division by zero
+-- Distance to polygon
+SELECT c.f1, p.f1, c.f1 <-> p.f1 FROM CIRCLE_TBL c, POLYGON_TBL p;
+       f1       |             f1             |    ?column?    
+----------------+----------------------------+----------------
+ <(5,1),3>      | ((2,0),(2,4),(0,0))        |              0
+ <(5,1),3>      | ((3,1),(3,3),(1,0))        |              0
+ <(5,1),3>      | ((1,2),(3,4),(5,6),(7,8))  | 0.535533905933
+ <(5,1),3>      | ((7,8),(5,6),(3,4),(1,2))  | 0.535533905933
+ <(5,1),3>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
+ <(5,1),3>      | ((0,0))                    |  2.09901951359
+ <(5,1),3>      | ((0,1),(0,1))              |              2
+ <(1,2),100>    | ((2,0),(2,4),(0,0))        |              0
+ <(1,2),100>    | ((3,1),(3,3),(1,0))        |              0
+ <(1,2),100>    | ((1,2),(3,4),(5,6),(7,8))  |              0
+ <(1,2),100>    | ((7,8),(5,6),(3,4),(1,2))  |              0
+ <(1,2),100>    | ((1,2),(7,8),(5,6),(3,-4)) |              0
+ <(1,2),100>    | ((0,0))                    |              0
+ <(1,2),100>    | ((0,1),(0,1))              |              0
+ <(1,3),5>      | ((2,0),(2,4),(0,0))        |              0
+ <(1,3),5>      | ((3,1),(3,3),(1,0))        |              0
+ <(1,3),5>      | ((1,2),(3,4),(5,6),(7,8))  |              0
+ <(1,3),5>      | ((7,8),(5,6),(3,4),(1,2))  |              0
+ <(1,3),5>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
+ <(1,3),5>      | ((0,0))                    |              0
+ <(1,3),5>      | ((0,1),(0,1))              |              0
+ <(1,2),3>      | ((2,0),(2,4),(0,0))        |              0
+ <(1,2),3>      | ((3,1),(3,3),(1,0))        |              0
+ <(1,2),3>      | ((1,2),(3,4),(5,6),(7,8))  |              0
+ <(1,2),3>      | ((7,8),(5,6),(3,4),(1,2))  |              0
+ <(1,2),3>      | ((1,2),(7,8),(5,6),(3,-4)) |              0
+ <(1,2),3>      | ((0,0))                    |              0
+ <(1,2),3>      | ((0,1),(0,1))              |              0
+ <(100,200),10> | ((2,0),(2,4),(0,0))        |  209.134661795
+ <(100,200),10> | ((3,1),(3,3),(1,0))        |  209.585974051
+ <(100,200),10> | ((1,2),(3,4),(5,6),(7,8))  |  203.337760371
+ <(100,200),10> | ((7,8),(5,6),(3,4),(1,2))  |  203.337760371
+ <(100,200),10> | ((1,2),(7,8),(5,6),(3,-4)) |  203.337760371
+ <(100,200),10> | ((0,0))                    |   213.60679775
+ <(100,200),10> | ((0,1),(0,1))              |  212.712819568
+ <(100,1),115>  | ((2,0),(2,4),(0,0))        |              0
+ <(100,1),115>  | ((3,1),(3,3),(1,0))        |              0
+ <(100,1),115>  | ((1,2),(3,4),(5,6),(7,8))  |              0
+ <(100,1),115>  | ((7,8),(5,6),(3,4),(1,2))  |              0
+ <(100,1),115>  | ((1,2),(7,8),(5,6),(3,-4)) |              0
+ <(100,1),115>  | ((0,0))                    |              0
+ <(100,1),115>  | ((0,1),(0,1))              |              0
+ <(3,5),0>      | ((2,0),(2,4),(0,0))        |  1.41421356237
+ <(3,5),0>      | ((3,1),(3,3),(1,0))        |              2
+ <(3,5),0>      | ((1,2),(3,4),(5,6),(7,8))  | 0.707106781187
+ <(3,5),0>      | ((7,8),(5,6),(3,4),(1,2))  | 0.707106781187
+ <(3,5),0>      | ((1,2),(7,8),(5,6),(3,-4)) | 0.707106781187
+ <(3,5),0>      | ((0,0))                    |  5.83095189485
+ <(3,5),0>      | ((0,1),(0,1))              |              5
+ <(3,5),NaN>    | ((2,0),(2,4),(0,0))        |            NaN
+ <(3,5),NaN>    | ((3,1),(3,3),(1,0))        |            NaN
+ <(3,5),NaN>    | ((1,2),(3,4),(5,6),(7,8))  |            NaN
+ <(3,5),NaN>    | ((7,8),(5,6),(3,4),(1,2))  |            NaN
+ <(3,5),NaN>    | ((1,2),(7,8),(5,6),(3,-4)) |            NaN
+ <(3,5),NaN>    | ((0,0))                    |            NaN
+ <(3,5),NaN>    | ((0,1),(0,1))              |            NaN
+(56 rows)
 
diff --git a/src/test/regress/expected/geometry_1.out b/src/test/regress/expected/geometry_1.out
deleted file mode 100644
index 3b92e23059..0000000000
--- a/src/test/regress/expected/geometry_1.out
+++ /dev/null
@@ -1,563 +0,0 @@
---
--- GEOMETRY
---
--- Back off displayed precision a little bit to reduce platform-to-platform
--- variation in results.
-SET extra_float_digits TO -3;
---
--- Points
---
-SELECT '' AS four, center(f1) AS center
-   FROM BOX_TBL;
- four | center  
-------+---------
-      | (1,1)
-      | (2,2)
-      | (2.5,3)
-      | (3,3)
-(4 rows)
-
-SELECT '' AS four, (@@ f1) AS center
-   FROM BOX_TBL;
- four | center  
-------+---------
-      | (1,1)
-      | (2,2)
-      | (2.5,3)
-      | (3,3)
-(4 rows)
-
-SELECT '' AS six, point(f1) AS center
-   FROM CIRCLE_TBL;
- six |  center   
------+-----------
-     | (5,1)
-     | (1,2)
-     | (1,3)
-     | (1,2)
-     | (100,200)
-     | (100,1)
-(6 rows)
-
-SELECT '' AS six, (@@ f1) AS center
-   FROM CIRCLE_TBL;
- six |  center   
------+-----------
-     | (5,1)
-     | (1,2)
-     | (1,3)
-     | (1,2)
-     | (100,200)
-     | (100,1)
-(6 rows)
-
-SELECT '' AS two, (@@ f1) AS center
-   FROM POLYGON_TBL
-   WHERE (# f1) > 2;
- two |            center             
------+-------------------------------
-     | (1.33333333333,1.33333333333)
-     | (2.33333333333,1.33333333333)
-(2 rows)
-
--- "is horizontal" function
-SELECT '' AS two, p1.f1
-   FROM POINT_TBL p1
-   WHERE ishorizontal(p1.f1, point '(0,0)');
- two |   f1    
------+---------
-     | (0,0)
-     | (-10,0)
-(2 rows)
-
--- "is horizontal" operator
-SELECT '' AS two, p1.f1
-   FROM POINT_TBL p1
-   WHERE p1.f1 ?- point '(0,0)';
- two |   f1    
------+---------
-     | (0,0)
-     | (-10,0)
-(2 rows)
-
--- "is vertical" function
-SELECT '' AS one, p1.f1
-   FROM POINT_TBL p1
-   WHERE isvertical(p1.f1, point '(5.1,34.5)');
- one |     f1     
------+------------
-     | (5.1,34.5)
-(1 row)
-
--- "is vertical" operator
-SELECT '' AS one, p1.f1
-   FROM POINT_TBL p1
-   WHERE p1.f1 ?| point '(5.1,34.5)';
- one |     f1     
------+------------
-     | (5.1,34.5)
-(1 row)
-
---
--- Line segments
---
--- intersection
-SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
-   FROM LSEG_TBL l, POINT_TBL p;
-ERROR:  operator does not exist: lseg # point
-LINE 1: SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
-                                           ^
-HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
--- closest point
-SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
-   FROM LSEG_TBL l, POINT_TBL p;
- thirty |     f1     |               s               |             closest              
---------+------------+-------------------------------+----------------------------------
-        | (0,0)      | [(1,2),(3,4)]                 | (1,2)
-        | (0,0)      | [(0,0),(6,6)]                 | (0,0)
-        | (0,0)      | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
-        | (0,0)      | [(-1000000,200),(300000,-40)] | (0.00284023658959,15.3846148603)
-        | (0,0)      | [(11,22),(33,44)]             | (11,22)
-        | (-10,0)    | [(1,2),(3,4)]                 | (1,2)
-        | (-10,0)    | [(0,0),(6,6)]                 | (0,0)
-        | (-10,0)    | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (-10,0)    | [(-1000000,200),(300000,-40)] | (-9.99715942258,15.386461014)
-        | (-10,0)    | [(11,22),(33,44)]             | (11,22)
-        | (-3,4)     | [(1,2),(3,4)]                 | (1,2)
-        | (-3,4)     | [(0,0),(6,6)]                 | (0.5,0.5)
-        | (-3,4)     | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (-3,4)     | [(-1000000,200),(300000,-40)] | (-2.99789812268,15.3851688427)
-        | (-3,4)     | [(11,22),(33,44)]             | (11,22)
-        | (5.1,34.5) | [(1,2),(3,4)]                 | (3,4)
-        | (5.1,34.5) | [(0,0),(6,6)]                 | (6,6)
-        | (5.1,34.5) | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (5.1,34.5) | [(-1000000,200),(300000,-40)] | (5.09647083221,15.3836744977)
-        | (5.1,34.5) | [(11,22),(33,44)]             | (14.3,25.3)
-        | (-5,-12)   | [(1,2),(3,4)]                 | (1,2)
-        | (-5,-12)   | [(0,0),(6,6)]                 | (0,0)
-        | (-5,-12)   | [(10,-10),(-3,-4)]            | (-1.60487804878,-4.64390243902)
-        | (-5,-12)   | [(-1000000,200),(300000,-40)] | (-4.99494420846,15.3855375282)
-        | (-5,-12)   | [(11,22),(33,44)]             | (11,22)
-        | (10,10)    | [(1,2),(3,4)]                 | (3,4)
-        | (10,10)    | [(0,0),(6,6)]                 | (6,6)
-        | (10,10)    | [(10,-10),(-3,-4)]            | (2.39024390244,-6.48780487805)
-        | (10,10)    | [(-1000000,200),(300000,-40)] | (10.000993742,15.3827690473)
-        | (10,10)    | [(11,22),(33,44)]             | (11,22)
-(30 rows)
-
---
--- Boxes
---
-SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;
- six |                              box                               
------+----------------------------------------------------------------
-     | (7.12132034356,3.12132034356),(2.87867965644,-1.12132034356)
-     | (71.7106781187,72.7106781187),(-69.7106781187,-68.7106781187)
-     | (4.53553390593,6.53553390593),(-2.53553390593,-0.535533905933)
-     | (3.12132034356,4.12132034356),(-1.12132034356,-0.12132034356)
-     | (107.071067812,207.071067812),(92.9289321881,192.928932188)
-     | (181.317279836,82.3172798365),(18.6827201635,-80.3172798365)
-(6 rows)
-
--- translation
-SELECT '' AS twentyfour, b.f1 + p.f1 AS translation
-   FROM BOX_TBL b, POINT_TBL p;
- twentyfour |       translation       
-------------+-------------------------
-            | (2,2),(0,0)
-            | (3,3),(1,1)
-            | (2.5,3.5),(2.5,2.5)
-            | (3,3),(3,3)
-            | (-8,2),(-10,0)
-            | (-7,3),(-9,1)
-            | (-7.5,3.5),(-7.5,2.5)
-            | (-7,3),(-7,3)
-            | (-1,6),(-3,4)
-            | (0,7),(-2,5)
-            | (-0.5,7.5),(-0.5,6.5)
-            | (0,7),(0,7)
-            | (7.1,36.5),(5.1,34.5)
-            | (8.1,37.5),(6.1,35.5)
-            | (7.6,38),(7.6,37)
-            | (8.1,37.5),(8.1,37.5)
-            | (-3,-10),(-5,-12)
-            | (-2,-9),(-4,-11)
-            | (-2.5,-8.5),(-2.5,-9.5)
-            | (-2,-9),(-2,-9)
-            | (12,12),(10,10)
-            | (13,13),(11,11)
-            | (12.5,13.5),(12.5,12.5)
-            | (13,13),(13,13)
-(24 rows)
-
-SELECT '' AS twentyfour, b.f1 - p.f1 AS translation
-   FROM BOX_TBL b, POINT_TBL p;
- twentyfour |        translation        
-------------+---------------------------
-            | (2,2),(0,0)
-            | (3,3),(1,1)
-            | (2.5,3.5),(2.5,2.5)
-            | (3,3),(3,3)
-            | (12,2),(10,0)
-            | (13,3),(11,1)
-            | (12.5,3.5),(12.5,2.5)
-            | (13,3),(13,3)
-            | (5,-2),(3,-4)
-            | (6,-1),(4,-3)
-            | (5.5,-0.5),(5.5,-1.5)
-            | (6,-1),(6,-1)
-            | (-3.1,-32.5),(-5.1,-34.5)
-            | (-2.1,-31.5),(-4.1,-33.5)
-            | (-2.6,-31),(-2.6,-32)
-            | (-2.1,-31.5),(-2.1,-31.5)
-            | (7,14),(5,12)
-            | (8,15),(6,13)
-            | (7.5,15.5),(7.5,14.5)
-            | (8,15),(8,15)
-            | (-8,-8),(-10,-10)
-            | (-7,-7),(-9,-9)
-            | (-7.5,-6.5),(-7.5,-7.5)
-            | (-7,-7),(-7,-7)
-(24 rows)
-
--- scaling and rotation
-SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation
-   FROM BOX_TBL b, POINT_TBL p;
- twentyfour |          rotation           
-------------+-----------------------------
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (0,0),(-20,-20)
-            | (-10,-10),(-30,-30)
-            | (-25,-25),(-25,-35)
-            | (-30,-30),(-30,-30)
-            | (0,2),(-14,0)
-            | (-7,3),(-21,1)
-            | (-17.5,2.5),(-21.5,-0.5)
-            | (-21,3),(-21,3)
-            | (0,79.2),(-58.8,0)
-            | (-29.4,118.8),(-88.2,39.6)
-            | (-73.5,104.1),(-108,99)
-            | (-88.2,118.8),(-88.2,118.8)
-            | (14,0),(0,-34)
-            | (21,-17),(7,-51)
-            | (29.5,-42.5),(17.5,-47.5)
-            | (21,-51),(21,-51)
-            | (0,40),(0,0)
-            | (0,60),(0,20)
-            | (0,60),(-10,50)
-            | (0,60),(0,60)
-(24 rows)
-
-SELECT '' AS twenty, b.f1 / p.f1 AS rotation
-   FROM BOX_TBL b, POINT_TBL p
-   WHERE (p.f1 <-> point '(0,0)') >= 1;
- twenty |                               rotation                               
---------+----------------------------------------------------------------------
-        | (0,0),(-0.2,-0.2)
-        | (0.08,0),(0,-0.56)
-        | (0.0651176557644,0),(0,-0.0483449262493)
-        | (0,0.0828402366864),(-0.201183431953,0)
-        | (0.2,0),(0,0)
-        | (-0.1,-0.1),(-0.3,-0.3)
-        | (0.12,-0.28),(0.04,-0.84)
-        | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374)
-        | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432)
-        | (0.3,0),(0.1,0)
-        | (-0.25,-0.25),(-0.25,-0.35)
-        | (0.26,-0.7),(0.1,-0.82)
-        | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117)
-        | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414)
-        | (0.3,0.05),(0.25,0)
-        | (-0.3,-0.3),(-0.3,-0.3)
-        | (0.12,-0.84),(0.12,-0.84)
-        | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374)
-        | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503)
-        | (0.3,0),(0.3,0)
-(20 rows)
-
-SELECT f1::box
-	FROM POINT_TBL;
-          f1           
------------------------
- (0,0),(0,0)
- (-10,0),(-10,0)
- (-3,4),(-3,4)
- (5.1,34.5),(5.1,34.5)
- (-5,-12),(-5,-12)
- (10,10),(10,10)
-(6 rows)
-
-SELECT bound_box(a.f1, b.f1)
-	FROM BOX_TBL a, BOX_TBL b;
-      bound_box      
----------------------
- (2,2),(0,0)
- (3,3),(0,0)
- (2.5,3.5),(0,0)
- (3,3),(0,0)
- (3,3),(0,0)
- (3,3),(1,1)
- (3,3.5),(1,1)
- (3,3),(1,1)
- (2.5,3.5),(0,0)
- (3,3.5),(1,1)
- (2.5,3.5),(2.5,2.5)
- (3,3.5),(2.5,2.5)
- (3,3),(0,0)
- (3,3),(1,1)
- (3,3.5),(2.5,2.5)
- (3,3),(3,3)
-(16 rows)
-
---
--- Paths
---
-SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL;
- eight | npoints |           path            
--------+---------+---------------------------
-       |       2 | [(1,2),(3,4)]
-       |       2 | ((1,2),(3,4))
-       |       4 | [(0,0),(3,0),(4,5),(1,6)]
-       |       2 | ((1,2),(3,4))
-       |       2 | ((1,2),(3,4))
-       |       2 | [(1,2),(3,4)]
-       |       2 | [(11,12),(13,14)]
-       |       2 | ((11,12),(13,14))
-(8 rows)
-
-SELECT '' AS four, path(f1) FROM POLYGON_TBL;
- four |        path         
-------+---------------------
-      | ((2,0),(2,4),(0,0))
-      | ((3,1),(3,3),(1,0))
-      | ((0,0))
-      | ((0,1),(0,1))
-(4 rows)
-
--- translation
-SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add
-   FROM PATH_TBL p1;
- eight |             dist_add              
--------+-----------------------------------
-       | [(11,12),(13,14)]
-       | ((11,12),(13,14))
-       | [(10,10),(13,10),(14,15),(11,16)]
-       | ((11,12),(13,14))
-       | ((11,12),(13,14))
-       | [(11,12),(13,14)]
-       | [(21,22),(23,24)]
-       | ((21,22),(23,24))
-(8 rows)
-
--- scaling and rotation
-SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul
-   FROM PATH_TBL p1;
- eight |           dist_mul           
--------+------------------------------
-       | [(4,3),(10,5)]
-       | ((4,3),(10,5))
-       | [(0,0),(6,-3),(13,6),(8,11)]
-       | ((4,3),(10,5))
-       | ((4,3),(10,5))
-       | [(4,3),(10,5)]
-       | [(34,13),(40,15)]
-       | ((34,13),(40,15))
-(8 rows)
-
---
--- Polygons
---
--- containment
-SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 @> p.f1 AS contains
-   FROM POLYGON_TBL poly, POINT_TBL p;
- twentyfour |     f1     |         f1          | contains 
-------------+------------+---------------------+----------
-            | (0,0)      | ((2,0),(2,4),(0,0)) | t
-            | (0,0)      | ((3,1),(3,3),(1,0)) | f
-            | (0,0)      | ((0,0))             | t
-            | (0,0)      | ((0,1),(0,1))       | f
-            | (-10,0)    | ((2,0),(2,4),(0,0)) | f
-            | (-10,0)    | ((3,1),(3,3),(1,0)) | f
-            | (-10,0)    | ((0,0))             | f
-            | (-10,0)    | ((0,1),(0,1))       | f
-            | (-3,4)     | ((2,0),(2,4),(0,0)) | f
-            | (-3,4)     | ((3,1),(3,3),(1,0)) | f
-            | (-3,4)     | ((0,0))             | f
-            | (-3,4)     | ((0,1),(0,1))       | f
-            | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
-            | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
-            | (5.1,34.5) | ((0,0))             | f
-            | (5.1,34.5) | ((0,1),(0,1))       | f
-            | (-5,-12)   | ((2,0),(2,4),(0,0)) | f
-            | (-5,-12)   | ((3,1),(3,3),(1,0)) | f
-            | (-5,-12)   | ((0,0))             | f
-            | (-5,-12)   | ((0,1),(0,1))       | f
-            | (10,10)    | ((2,0),(2,4),(0,0)) | f
-            | (10,10)    | ((3,1),(3,3),(1,0)) | f
-            | (10,10)    | ((0,0))             | f
-            | (10,10)    | ((0,1),(0,1))       | f
-(24 rows)
-
-SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 <@ poly.f1 AS contained
-   FROM POLYGON_TBL poly, POINT_TBL p;
- twentyfour |     f1     |         f1          | contained 
-------------+------------+---------------------+-----------
-            | (0,0)      | ((2,0),(2,4),(0,0)) | t
-            | (0,0)      | ((3,1),(3,3),(1,0)) | f
-            | (0,0)      | ((0,0))             | t
-            | (0,0)      | ((0,1),(0,1))       | f
-            | (-10,0)    | ((2,0),(2,4),(0,0)) | f
-            | (-10,0)    | ((3,1),(3,3),(1,0)) | f
-            | (-10,0)    | ((0,0))             | f
-            | (-10,0)    | ((0,1),(0,1))       | f
-            | (-3,4)     | ((2,0),(2,4),(0,0)) | f
-            | (-3,4)     | ((3,1),(3,3),(1,0)) | f
-            | (-3,4)     | ((0,0))             | f
-            | (-3,4)     | ((0,1),(0,1))       | f
-            | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
-            | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
-            | (5.1,34.5) | ((0,0))             | f
-            | (5.1,34.5) | ((0,1),(0,1))       | f
-            | (-5,-12)   | ((2,0),(2,4),(0,0)) | f
-            | (-5,-12)   | ((3,1),(3,3),(1,0)) | f
-            | (-5,-12)   | ((0,0))             | f
-            | (-5,-12)   | ((0,1),(0,1))       | f
-            | (10,10)    | ((2,0),(2,4),(0,0)) | f
-            | (10,10)    | ((3,1),(3,3),(1,0)) | f
-            | (10,10)    | ((0,0))             | f
-            | (10,10)    | ((0,1),(0,1))       | f
-(24 rows)
-
-SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon
-   FROM POLYGON_TBL;
- four | npoints |       polygon       
-------+---------+---------------------
-      |       3 | ((2,0),(2,4),(0,0))
-      |       3 | ((3,1),(3,3),(1,0))
-      |       1 | ((0,0))
-      |       2 | ((0,1),(0,1))
-(4 rows)
-
-SELECT '' AS four, polygon(f1)
-   FROM BOX_TBL;
- four |                  polygon                  
-------+-------------------------------------------
-      | ((0,0),(0,2),(2,2),(2,0))
-      | ((1,1),(1,3),(3,3),(3,1))
-      | ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5))
-      | ((3,3),(3,3),(3,3),(3,3))
-(4 rows)
-
-SELECT '' AS four, polygon(f1)
-   FROM PATH_TBL WHERE isclosed(f1);
- four |      polygon      
-------+-------------------
-      | ((1,2),(3,4))
-      | ((1,2),(3,4))
-      | ((1,2),(3,4))
-      | ((11,12),(13,14))
-(4 rows)
-
-SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon
-   FROM PATH_TBL
-   WHERE isopen(f1);
- four |         open_path         |          polygon          
-------+---------------------------+---------------------------
-      | [(1,2),(3,4)]             | ((1,2),(3,4))
-      | [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6))
-      | [(1,2),(3,4)]             | ((1,2),(3,4))
-      | [(11,12),(13,14)]         | ((11,12),(13,14))
-(4 rows)
-
--- convert circles to polygons using the default number of points
-SELECT '' AS six, polygon(f1)
-   FROM CIRCLE_TBL;
- six |                                                                                                       polygon                                                                                                        
------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-     | ((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))
-     | ((-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))
-     | ((-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))
-     | ((-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))
-     | ((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))
-     | ((-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))
-(6 rows)
-
--- convert the circle to an 8-point polygon
-SELECT '' AS six, polygon(8, f1)
-   FROM CIRCLE_TBL;
- six |                                                                             polygon                                                                              
------+------------------------------------------------------------------------------------------------------------------------------------------------------------------
-     | ((2,1),(2.87867965644,3.12132034356),(5,4),(7.12132034356,3.12132034356),(8,1),(7.12132034356,-1.12132034356),(5,-2),(2.87867965644,-1.12132034356))
-     | ((-99,2),(-69.7106781187,72.7106781187),(1,102),(71.7106781187,72.7106781187),(101,2),(71.7106781187,-68.7106781187),(1,-98),(-69.7106781187,-68.7106781187))
-     | ((-4,3),(-2.53553390593,6.53553390593),(1,8),(4.53553390593,6.53553390593),(6,3),(4.53553390593,-0.535533905933),(1,-2),(-2.53553390593,-0.535533905933))
-     | ((-2,2),(-1.12132034356,4.12132034356),(1,5),(3.12132034356,4.12132034356),(4,2),(3.12132034356,-0.12132034356),(1,-1),(-1.12132034356,-0.12132034356))
-     | ((90,200),(92.9289321881,207.071067812),(100,210),(107.071067812,207.071067812),(110,200),(107.071067812,192.928932188),(100,190),(92.9289321881,192.928932188))
-     | ((-15,1),(18.6827201635,82.3172798365),(100,116),(181.317279836,82.3172798365),(215,1),(181.317279836,-80.3172798365),(100,-114),(18.6827201635,-80.3172798365))
-(6 rows)
-
---
--- Circles
---
-SELECT '' AS six, circle(f1, 50.0)
-   FROM POINT_TBL;
- six |     circle      
------+-----------------
-     | <(0,0),50>
-     | <(-10,0),50>
-     | <(-3,4),50>
-     | <(5.1,34.5),50>
-     | <(-5,-12),50>
-     | <(10,10),50>
-(6 rows)
-
-SELECT '' AS four, circle(f1)
-   FROM BOX_TBL;
- four |        circle         
-------+-----------------------
-      | <(1,1),1.41421356237>
-      | <(2,2),1.41421356237>
-      | <(2.5,3),0.5>
-      | <(3,3),0>
-(4 rows)
-
-SELECT '' AS two, circle(f1)
-   FROM POLYGON_TBL
-   WHERE (# f1) >= 3;
- two |                    circle                     
------+-----------------------------------------------
-     | <(1.33333333333,1.33333333333),2.04168905064>
-     | <(2.33333333333,1.33333333333),1.47534300379>
-(2 rows)
-
-SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
-   FROM CIRCLE_TBL c1, POINT_TBL p1
-   WHERE (p1.f1 <-> c1.f1) > 0
-   ORDER BY distance, area(c1.f1), p1.f1[0];
- twentyfour |     circle     |   point    |   distance    
-------------+----------------+------------+---------------
-            | <(1,2),3>      | (-3,4)     |   1.472135955
-            | <(5,1),3>      | (0,0)      | 2.09901951359
-            | <(5,1),3>      | (-3,4)     | 5.54400374532
-            | <(1,3),5>      | (-10,0)    | 6.40175425099
-            | <(1,3),5>      | (10,10)    | 6.40175425099
-            | <(5,1),3>      | (10,10)    | 7.29563014099
-            | <(1,2),3>      | (-10,0)    |  8.1803398875
-            | <(1,2),3>      | (10,10)    | 9.04159457879
-            | <(1,3),5>      | (-5,-12)   | 11.1554944214
-            | <(5,1),3>      | (-10,0)    | 12.0332963784
-            | <(1,2),3>      | (-5,-12)   | 12.2315462117
-            | <(5,1),3>      | (-5,-12)   | 13.4012194669
-            | <(1,3),5>      | (5.1,34.5) | 26.7657047773
-            | <(1,2),3>      | (5.1,34.5) | 29.7575945393
-            | <(5,1),3>      | (5.1,34.5) | 30.5001492534
-            | <(100,200),10> | (5.1,34.5) | 180.778038568
-            | <(100,200),10> | (10,10)    | 200.237960416
-            | <(100,200),10> | (-3,4)     | 211.415898255
-            | <(100,200),10> | (0,0)      |  213.60679775
-            | <(100,200),10> | (-10,0)    |  218.25424421
-            | <(100,200),10> | (-5,-12)   | 226.577682802
-(21 rows)
-
diff --git a/src/test/regress/expected/geometry_2.out b/src/test/regress/expected/geometry_2.out
deleted file mode 100644
index 5a922bcd3f..0000000000
--- a/src/test/regress/expected/geometry_2.out
+++ /dev/null
@@ -1,563 +0,0 @@
---
--- GEOMETRY
---
--- Back off displayed precision a little bit to reduce platform-to-platform
--- variation in results.
-SET extra_float_digits TO -3;
---
--- Points
---
-SELECT '' AS four, center(f1) AS center
-   FROM BOX_TBL;
- four | center  
-------+---------
-      | (1,1)
-      | (2,2)
-      | (2.5,3)
-      | (3,3)
-(4 rows)
-
-SELECT '' AS four, (@@ f1) AS center
-   FROM BOX_TBL;
- four | center  
-------+---------
-      | (1,1)
-      | (2,2)
-      | (2.5,3)
-      | (3,3)
-(4 rows)
-
-SELECT '' AS six, point(f1) AS center
-   FROM CIRCLE_TBL;
- six |  center   
------+-----------
-     | (5,1)
-     | (1,2)
-     | (1,3)
-     | (1,2)
-     | (100,200)
-     | (100,1)
-(6 rows)
-
-SELECT '' AS six, (@@ f1) AS center
-   FROM CIRCLE_TBL;
- six |  center   
------+-----------
-     | (5,1)
-     | (1,2)
-     | (1,3)
-     | (1,2)
-     | (100,200)
-     | (100,1)
-(6 rows)
-
-SELECT '' AS two, (@@ f1) AS center
-   FROM POLYGON_TBL
-   WHERE (# f1) > 2;
- two |            center             
------+-------------------------------
-     | (1.33333333333,1.33333333333)
-     | (2.33333333333,1.33333333333)
-(2 rows)
-
--- "is horizontal" function
-SELECT '' AS two, p1.f1
-   FROM POINT_TBL p1
-   WHERE ishorizontal(p1.f1, point '(0,0)');
- two |   f1    
------+---------
-     | (0,0)
-     | (-10,0)
-(2 rows)
-
--- "is horizontal" operator
-SELECT '' AS two, p1.f1
-   FROM POINT_TBL p1
-   WHERE p1.f1 ?- point '(0,0)';
- two |   f1    
------+---------
-     | (0,0)
-     | (-10,0)
-(2 rows)
-
--- "is vertical" function
-SELECT '' AS one, p1.f1
-   FROM POINT_TBL p1
-   WHERE isvertical(p1.f1, point '(5.1,34.5)');
- one |     f1     
------+------------
-     | (5.1,34.5)
-(1 row)
-
--- "is vertical" operator
-SELECT '' AS one, p1.f1
-   FROM POINT_TBL p1
-   WHERE p1.f1 ?| point '(5.1,34.5)';
- one |     f1     
------+------------
-     | (5.1,34.5)
-(1 row)
-
---
--- Line segments
---
--- intersection
-SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
-   FROM LSEG_TBL l, POINT_TBL p;
-ERROR:  operator does not exist: lseg # point
-LINE 1: SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
-                                           ^
-HINT:  No operator matches the given name and argument types. You might need to add explicit type casts.
--- closest point
-SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
-   FROM LSEG_TBL l, POINT_TBL p;
- thirty |     f1     |               s               |             closest              
---------+------------+-------------------------------+----------------------------------
-        | (0,0)      | [(1,2),(3,4)]                 | (1,2)
-        | (0,0)      | [(0,0),(6,6)]                 | (0,0)
-        | (0,0)      | [(10,-10),(-3,-4)]            | (-2.0487804878,-4.43902439024)
-        | (0,0)      | [(-1000000,200),(300000,-40)] | (0.00284023658959,15.3846148603)
-        | (0,0)      | [(11,22),(33,44)]             | (11,22)
-        | (-10,0)    | [(1,2),(3,4)]                 | (1,2)
-        | (-10,0)    | [(0,0),(6,6)]                 | (0,0)
-        | (-10,0)    | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (-10,0)    | [(-1000000,200),(300000,-40)] | (-9.99715942258,15.386461014)
-        | (-10,0)    | [(11,22),(33,44)]             | (11,22)
-        | (-3,4)     | [(1,2),(3,4)]                 | (1,2)
-        | (-3,4)     | [(0,0),(6,6)]                 | (0.5,0.5)
-        | (-3,4)     | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (-3,4)     | [(-1000000,200),(300000,-40)] | (-2.99789812268,15.3851688427)
-        | (-3,4)     | [(11,22),(33,44)]             | (11,22)
-        | (5.1,34.5) | [(1,2),(3,4)]                 | (3,4)
-        | (5.1,34.5) | [(0,0),(6,6)]                 | (6,6)
-        | (5.1,34.5) | [(10,-10),(-3,-4)]            | (-3,-4)
-        | (5.1,34.5) | [(-1000000,200),(300000,-40)] | (5.09647083221,15.3836744977)
-        | (5.1,34.5) | [(11,22),(33,44)]             | (14.3,25.3)
-        | (-5,-12)   | [(1,2),(3,4)]                 | (1,2)
-        | (-5,-12)   | [(0,0),(6,6)]                 | (0,0)
-        | (-5,-12)   | [(10,-10),(-3,-4)]            | (-1.60487804878,-4.64390243902)
-        | (-5,-12)   | [(-1000000,200),(300000,-40)] | (-4.99494420846,15.3855375282)
-        | (-5,-12)   | [(11,22),(33,44)]             | (11,22)
-        | (10,10)    | [(1,2),(3,4)]                 | (3,4)
-        | (10,10)    | [(0,0),(6,6)]                 | (6,6)
-        | (10,10)    | [(10,-10),(-3,-4)]            | (2.39024390244,-6.48780487805)
-        | (10,10)    | [(-1000000,200),(300000,-40)] | (10.000993742,15.3827690473)
-        | (10,10)    | [(11,22),(33,44)]             | (11,22)
-(30 rows)
-
---
--- Boxes
---
-SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;
- six |                              box                               
------+----------------------------------------------------------------
-     | (7.12132034356,3.12132034356),(2.87867965644,-1.12132034356)
-     | (71.7106781187,72.7106781187),(-69.7106781187,-68.7106781187)
-     | (4.53553390593,6.53553390593),(-2.53553390593,-0.535533905933)
-     | (3.12132034356,4.12132034356),(-1.12132034356,-0.12132034356)
-     | (107.071067812,207.071067812),(92.9289321881,192.928932188)
-     | (181.317279836,82.3172798365),(18.6827201635,-80.3172798365)
-(6 rows)
-
--- translation
-SELECT '' AS twentyfour, b.f1 + p.f1 AS translation
-   FROM BOX_TBL b, POINT_TBL p;
- twentyfour |       translation       
-------------+-------------------------
-            | (2,2),(0,0)
-            | (3,3),(1,1)
-            | (2.5,3.5),(2.5,2.5)
-            | (3,3),(3,3)
-            | (-8,2),(-10,0)
-            | (-7,3),(-9,1)
-            | (-7.5,3.5),(-7.5,2.5)
-            | (-7,3),(-7,3)
-            | (-1,6),(-3,4)
-            | (0,7),(-2,5)
-            | (-0.5,7.5),(-0.5,6.5)
-            | (0,7),(0,7)
-            | (7.1,36.5),(5.1,34.5)
-            | (8.1,37.5),(6.1,35.5)
-            | (7.6,38),(7.6,37)
-            | (8.1,37.5),(8.1,37.5)
-            | (-3,-10),(-5,-12)
-            | (-2,-9),(-4,-11)
-            | (-2.5,-8.5),(-2.5,-9.5)
-            | (-2,-9),(-2,-9)
-            | (12,12),(10,10)
-            | (13,13),(11,11)
-            | (12.5,13.5),(12.5,12.5)
-            | (13,13),(13,13)
-(24 rows)
-
-SELECT '' AS twentyfour, b.f1 - p.f1 AS translation
-   FROM BOX_TBL b, POINT_TBL p;
- twentyfour |        translation        
-------------+---------------------------
-            | (2,2),(0,0)
-            | (3,3),(1,1)
-            | (2.5,3.5),(2.5,2.5)
-            | (3,3),(3,3)
-            | (12,2),(10,0)
-            | (13,3),(11,1)
-            | (12.5,3.5),(12.5,2.5)
-            | (13,3),(13,3)
-            | (5,-2),(3,-4)
-            | (6,-1),(4,-3)
-            | (5.5,-0.5),(5.5,-1.5)
-            | (6,-1),(6,-1)
-            | (-3.1,-32.5),(-5.1,-34.5)
-            | (-2.1,-31.5),(-4.1,-33.5)
-            | (-2.6,-31),(-2.6,-32)
-            | (-2.1,-31.5),(-2.1,-31.5)
-            | (7,14),(5,12)
-            | (8,15),(6,13)
-            | (7.5,15.5),(7.5,14.5)
-            | (8,15),(8,15)
-            | (-8,-8),(-10,-10)
-            | (-7,-7),(-9,-9)
-            | (-7.5,-6.5),(-7.5,-7.5)
-            | (-7,-7),(-7,-7)
-(24 rows)
-
--- scaling and rotation
-SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation
-   FROM BOX_TBL b, POINT_TBL p;
- twentyfour |          rotation           
-------------+-----------------------------
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (0,0),(0,0)
-            | (-0,0),(-20,-20)
-            | (-10,-10),(-30,-30)
-            | (-25,-25),(-25,-35)
-            | (-30,-30),(-30,-30)
-            | (-0,2),(-14,0)
-            | (-7,3),(-21,1)
-            | (-17.5,2.5),(-21.5,-0.5)
-            | (-21,3),(-21,3)
-            | (0,79.2),(-58.8,0)
-            | (-29.4,118.8),(-88.2,39.6)
-            | (-73.5,104.1),(-108,99)
-            | (-88.2,118.8),(-88.2,118.8)
-            | (14,-0),(0,-34)
-            | (21,-17),(7,-51)
-            | (29.5,-42.5),(17.5,-47.5)
-            | (21,-51),(21,-51)
-            | (0,40),(0,0)
-            | (0,60),(0,20)
-            | (0,60),(-10,50)
-            | (0,60),(0,60)
-(24 rows)
-
-SELECT '' AS twenty, b.f1 / p.f1 AS rotation
-   FROM BOX_TBL b, POINT_TBL p
-   WHERE (p.f1 <-> point '(0,0)') >= 1;
- twenty |                               rotation                               
---------+----------------------------------------------------------------------
-        | (0,-0),(-0.2,-0.2)
-        | (0.08,-0),(0,-0.56)
-        | (0.0651176557644,0),(0,-0.0483449262493)
-        | (-0,0.0828402366864),(-0.201183431953,0)
-        | (0.2,0),(0,0)
-        | (-0.1,-0.1),(-0.3,-0.3)
-        | (0.12,-0.28),(0.04,-0.84)
-        | (0.0976764836466,-0.0241724631247),(0.0325588278822,-0.072517389374)
-        | (-0.100591715976,0.12426035503),(-0.301775147929,0.0414201183432)
-        | (0.3,0),(0.1,0)
-        | (-0.25,-0.25),(-0.25,-0.35)
-        | (0.26,-0.7),(0.1,-0.82)
-        | (0.109762715209,-0.0562379754329),(0.0813970697055,-0.0604311578117)
-        | (-0.251479289941,0.103550295858),(-0.322485207101,0.0739644970414)
-        | (0.3,0.05),(0.25,0)
-        | (-0.3,-0.3),(-0.3,-0.3)
-        | (0.12,-0.84),(0.12,-0.84)
-        | (0.0976764836466,-0.072517389374),(0.0976764836466,-0.072517389374)
-        | (-0.301775147929,0.12426035503),(-0.301775147929,0.12426035503)
-        | (0.3,0),(0.3,0)
-(20 rows)
-
-SELECT f1::box
-	FROM POINT_TBL;
-          f1           
------------------------
- (0,0),(0,0)
- (-10,0),(-10,0)
- (-3,4),(-3,4)
- (5.1,34.5),(5.1,34.5)
- (-5,-12),(-5,-12)
- (10,10),(10,10)
-(6 rows)
-
-SELECT bound_box(a.f1, b.f1)
-	FROM BOX_TBL a, BOX_TBL b;
-      bound_box      
----------------------
- (2,2),(0,0)
- (3,3),(0,0)
- (2.5,3.5),(0,0)
- (3,3),(0,0)
- (3,3),(0,0)
- (3,3),(1,1)
- (3,3.5),(1,1)
- (3,3),(1,1)
- (2.5,3.5),(0,0)
- (3,3.5),(1,1)
- (2.5,3.5),(2.5,2.5)
- (3,3.5),(2.5,2.5)
- (3,3),(0,0)
- (3,3),(1,1)
- (3,3.5),(2.5,2.5)
- (3,3),(3,3)
-(16 rows)
-
---
--- Paths
---
-SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL;
- eight | npoints |           path            
--------+---------+---------------------------
-       |       2 | [(1,2),(3,4)]
-       |       2 | ((1,2),(3,4))
-       |       4 | [(0,0),(3,0),(4,5),(1,6)]
-       |       2 | ((1,2),(3,4))
-       |       2 | ((1,2),(3,4))
-       |       2 | [(1,2),(3,4)]
-       |       2 | [(11,12),(13,14)]
-       |       2 | ((11,12),(13,14))
-(8 rows)
-
-SELECT '' AS four, path(f1) FROM POLYGON_TBL;
- four |        path         
-------+---------------------
-      | ((2,0),(2,4),(0,0))
-      | ((3,1),(3,3),(1,0))
-      | ((0,0))
-      | ((0,1),(0,1))
-(4 rows)
-
--- translation
-SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add
-   FROM PATH_TBL p1;
- eight |             dist_add              
--------+-----------------------------------
-       | [(11,12),(13,14)]
-       | ((11,12),(13,14))
-       | [(10,10),(13,10),(14,15),(11,16)]
-       | ((11,12),(13,14))
-       | ((11,12),(13,14))
-       | [(11,12),(13,14)]
-       | [(21,22),(23,24)]
-       | ((21,22),(23,24))
-(8 rows)
-
--- scaling and rotation
-SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul
-   FROM PATH_TBL p1;
- eight |           dist_mul           
--------+------------------------------
-       | [(4,3),(10,5)]
-       | ((4,3),(10,5))
-       | [(0,0),(6,-3),(13,6),(8,11)]
-       | ((4,3),(10,5))
-       | ((4,3),(10,5))
-       | [(4,3),(10,5)]
-       | [(34,13),(40,15)]
-       | ((34,13),(40,15))
-(8 rows)
-
---
--- Polygons
---
--- containment
-SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 @> p.f1 AS contains
-   FROM POLYGON_TBL poly, POINT_TBL p;
- twentyfour |     f1     |         f1          | contains 
-------------+------------+---------------------+----------
-            | (0,0)      | ((2,0),(2,4),(0,0)) | t
-            | (0,0)      | ((3,1),(3,3),(1,0)) | f
-            | (0,0)      | ((0,0))             | t
-            | (0,0)      | ((0,1),(0,1))       | f
-            | (-10,0)    | ((2,0),(2,4),(0,0)) | f
-            | (-10,0)    | ((3,1),(3,3),(1,0)) | f
-            | (-10,0)    | ((0,0))             | f
-            | (-10,0)    | ((0,1),(0,1))       | f
-            | (-3,4)     | ((2,0),(2,4),(0,0)) | f
-            | (-3,4)     | ((3,1),(3,3),(1,0)) | f
-            | (-3,4)     | ((0,0))             | f
-            | (-3,4)     | ((0,1),(0,1))       | f
-            | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
-            | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
-            | (5.1,34.5) | ((0,0))             | f
-            | (5.1,34.5) | ((0,1),(0,1))       | f
-            | (-5,-12)   | ((2,0),(2,4),(0,0)) | f
-            | (-5,-12)   | ((3,1),(3,3),(1,0)) | f
-            | (-5,-12)   | ((0,0))             | f
-            | (-5,-12)   | ((0,1),(0,1))       | f
-            | (10,10)    | ((2,0),(2,4),(0,0)) | f
-            | (10,10)    | ((3,1),(3,3),(1,0)) | f
-            | (10,10)    | ((0,0))             | f
-            | (10,10)    | ((0,1),(0,1))       | f
-(24 rows)
-
-SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 <@ poly.f1 AS contained
-   FROM POLYGON_TBL poly, POINT_TBL p;
- twentyfour |     f1     |         f1          | contained 
-------------+------------+---------------------+-----------
-            | (0,0)      | ((2,0),(2,4),(0,0)) | t
-            | (0,0)      | ((3,1),(3,3),(1,0)) | f
-            | (0,0)      | ((0,0))             | t
-            | (0,0)      | ((0,1),(0,1))       | f
-            | (-10,0)    | ((2,0),(2,4),(0,0)) | f
-            | (-10,0)    | ((3,1),(3,3),(1,0)) | f
-            | (-10,0)    | ((0,0))             | f
-            | (-10,0)    | ((0,1),(0,1))       | f
-            | (-3,4)     | ((2,0),(2,4),(0,0)) | f
-            | (-3,4)     | ((3,1),(3,3),(1,0)) | f
-            | (-3,4)     | ((0,0))             | f
-            | (-3,4)     | ((0,1),(0,1))       | f
-            | (5.1,34.5) | ((2,0),(2,4),(0,0)) | f
-            | (5.1,34.5) | ((3,1),(3,3),(1,0)) | f
-            | (5.1,34.5) | ((0,0))             | f
-            | (5.1,34.5) | ((0,1),(0,1))       | f
-            | (-5,-12)   | ((2,0),(2,4),(0,0)) | f
-            | (-5,-12)   | ((3,1),(3,3),(1,0)) | f
-            | (-5,-12)   | ((0,0))             | f
-            | (-5,-12)   | ((0,1),(0,1))       | f
-            | (10,10)    | ((2,0),(2,4),(0,0)) | f
-            | (10,10)    | ((3,1),(3,3),(1,0)) | f
-            | (10,10)    | ((0,0))             | f
-            | (10,10)    | ((0,1),(0,1))       | f
-(24 rows)
-
-SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon
-   FROM POLYGON_TBL;
- four | npoints |       polygon       
-------+---------+---------------------
-      |       3 | ((2,0),(2,4),(0,0))
-      |       3 | ((3,1),(3,3),(1,0))
-      |       1 | ((0,0))
-      |       2 | ((0,1),(0,1))
-(4 rows)
-
-SELECT '' AS four, polygon(f1)
-   FROM BOX_TBL;
- four |                  polygon                  
-------+-------------------------------------------
-      | ((0,0),(0,2),(2,2),(2,0))
-      | ((1,1),(1,3),(3,3),(3,1))
-      | ((2.5,2.5),(2.5,3.5),(2.5,3.5),(2.5,2.5))
-      | ((3,3),(3,3),(3,3),(3,3))
-(4 rows)
-
-SELECT '' AS four, polygon(f1)
-   FROM PATH_TBL WHERE isclosed(f1);
- four |      polygon      
-------+-------------------
-      | ((1,2),(3,4))
-      | ((1,2),(3,4))
-      | ((1,2),(3,4))
-      | ((11,12),(13,14))
-(4 rows)
-
-SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon
-   FROM PATH_TBL
-   WHERE isopen(f1);
- four |         open_path         |          polygon          
-------+---------------------------+---------------------------
-      | [(1,2),(3,4)]             | ((1,2),(3,4))
-      | [(0,0),(3,0),(4,5),(1,6)] | ((0,0),(3,0),(4,5),(1,6))
-      | [(1,2),(3,4)]             | ((1,2),(3,4))
-      | [(11,12),(13,14)]         | ((11,12),(13,14))
-(4 rows)
-
--- convert circles to polygons using the default number of points
-SELECT '' AS six, polygon(f1)
-   FROM CIRCLE_TBL;
- six |                                                                                                       polygon                                                                                                        
------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-     | ((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))
-     | ((-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))
-     | ((-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))
-     | ((-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))
-     | ((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))
-     | ((-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))
-(6 rows)
-
--- convert the circle to an 8-point polygon
-SELECT '' AS six, polygon(8, f1)
-   FROM CIRCLE_TBL;
- six |                                                                             polygon                                                                              
------+------------------------------------------------------------------------------------------------------------------------------------------------------------------
-     | ((2,1),(2.87867965644,3.12132034356),(5,4),(7.12132034356,3.12132034356),(8,1),(7.12132034356,-1.12132034356),(5,-2),(2.87867965644,-1.12132034356))
-     | ((-99,2),(-69.7106781187,72.7106781187),(1,102),(71.7106781187,72.7106781187),(101,2),(71.7106781187,-68.7106781187),(1,-98),(-69.7106781187,-68.7106781187))
-     | ((-4,3),(-2.53553390593,6.53553390593),(1,8),(4.53553390593,6.53553390593),(6,3),(4.53553390593,-0.535533905933),(1,-2),(-2.53553390593,-0.535533905933))
-     | ((-2,2),(-1.12132034356,4.12132034356),(1,5),(3.12132034356,4.12132034356),(4,2),(3.12132034356,-0.12132034356),(1,-1),(-1.12132034356,-0.12132034356))
-     | ((90,200),(92.9289321881,207.071067812),(100,210),(107.071067812,207.071067812),(110,200),(107.071067812,192.928932188),(100,190),(92.9289321881,192.928932188))
-     | ((-15,1),(18.6827201635,82.3172798365),(100,116),(181.317279836,82.3172798365),(215,1),(181.317279836,-80.3172798365),(100,-114),(18.6827201635,-80.3172798365))
-(6 rows)
-
---
--- Circles
---
-SELECT '' AS six, circle(f1, 50.0)
-   FROM POINT_TBL;
- six |     circle      
------+-----------------
-     | <(0,0),50>
-     | <(-10,0),50>
-     | <(-3,4),50>
-     | <(5.1,34.5),50>
-     | <(-5,-12),50>
-     | <(10,10),50>
-(6 rows)
-
-SELECT '' AS four, circle(f1)
-   FROM BOX_TBL;
- four |        circle         
-------+-----------------------
-      | <(1,1),1.41421356237>
-      | <(2,2),1.41421356237>
-      | <(2.5,3),0.5>
-      | <(3,3),0>
-(4 rows)
-
-SELECT '' AS two, circle(f1)
-   FROM POLYGON_TBL
-   WHERE (# f1) >= 3;
- two |                    circle                     
------+-----------------------------------------------
-     | <(1.33333333333,1.33333333333),2.04168905064>
-     | <(2.33333333333,1.33333333333),1.47534300379>
-(2 rows)
-
-SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
-   FROM CIRCLE_TBL c1, POINT_TBL p1
-   WHERE (p1.f1 <-> c1.f1) > 0
-   ORDER BY distance, area(c1.f1), p1.f1[0];
- twentyfour |     circle     |   point    |   distance    
-------------+----------------+------------+---------------
-            | <(1,2),3>      | (-3,4)     |   1.472135955
-            | <(5,1),3>      | (0,0)      | 2.09901951359
-            | <(5,1),3>      | (-3,4)     | 5.54400374532
-            | <(1,3),5>      | (-10,0)    | 6.40175425099
-            | <(1,3),5>      | (10,10)    | 6.40175425099
-            | <(5,1),3>      | (10,10)    | 7.29563014099
-            | <(1,2),3>      | (-10,0)    |  8.1803398875
-            | <(1,2),3>      | (10,10)    | 9.04159457879
-            | <(1,3),5>      | (-5,-12)   | 11.1554944214
-            | <(5,1),3>      | (-10,0)    | 12.0332963784
-            | <(1,2),3>      | (-5,-12)   | 12.2315462117
-            | <(5,1),3>      | (-5,-12)   | 13.4012194669
-            | <(1,3),5>      | (5.1,34.5) | 26.7657047773
-            | <(1,2),3>      | (5.1,34.5) | 29.7575945393
-            | <(5,1),3>      | (5.1,34.5) | 30.5001492534
-            | <(100,200),10> | (5.1,34.5) | 180.778038568
-            | <(100,200),10> | (10,10)    | 200.237960416
-            | <(100,200),10> | (-3,4)     | 211.415898255
-            | <(100,200),10> | (0,0)      |  213.60679775
-            | <(100,200),10> | (-10,0)    |  218.25424421
-            | <(100,200),10> | (-5,-12)   | 226.577682802
-(21 rows)
-
diff --git a/src/test/regress/expected/line.out b/src/test/regress/expected/line.out
index f20abdc430..02a10dbb78 100644
--- a/src/test/regress/expected/line.out
+++ b/src/test/regress/expected/line.out
@@ -1,271 +1,80 @@
 --
 -- LINE
 -- Infinite lines
 --
 --DROP TABLE LINE_TBL;
 CREATE TABLE LINE_TBL (s line);
-INSERT INTO LINE_TBL VALUES ('{1,-1,1}');
-INSERT INTO LINE_TBL VALUES ('(0,0),(6,6)');
+INSERT INTO LINE_TBL VALUES ('{0,-1,5}');	-- A == 0
+INSERT INTO LINE_TBL VALUES ('{1,0,5}');	-- B == 0
+INSERT INTO LINE_TBL VALUES ('{0,3,0}');	-- A == C == 0
+INSERT INTO LINE_TBL VALUES (' (0,0), (6,6)');
 INSERT INTO LINE_TBL VALUES ('10,-10 ,-5,-4');
 INSERT INTO LINE_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
-INSERT INTO LINE_TBL VALUES ('(11,22,33,44)');
-INSERT INTO LINE_TBL VALUES ('[(1,0),(1,0)]');
-ERROR:  invalid line specification: must be two distinct points
-LINE 1: INSERT INTO LINE_TBL VALUES ('[(1,0),(1,0)]');
-                                     ^
+INSERT INTO LINE_TBL VALUES ('{3,NaN,5}');
+INSERT INTO LINE_TBL VALUES ('{NaN,NaN,NaN}');
 -- horizontal
 INSERT INTO LINE_TBL VALUES ('[(1,3),(2,3)]');
 -- vertical
-INSERT INTO LINE_TBL VALUES ('[(3,1),(3,2)]');
+INSERT INTO LINE_TBL VALUES (line(point '(3,1)', point '(3,2)'));
 -- bad values for parser testing
+INSERT INTO LINE_TBL VALUES ('{}');
+ERROR:  invalid input syntax for type line: "{}"
+LINE 1: INSERT INTO LINE_TBL VALUES ('{}');
+                                     ^
+INSERT INTO LINE_TBL VALUES ('{0');
+ERROR:  invalid input syntax for type line: "{0"
+LINE 1: INSERT INTO LINE_TBL VALUES ('{0');
+                                     ^
+INSERT INTO LINE_TBL VALUES ('{0,0}');
+ERROR:  invalid input syntax for type line: "{0,0}"
+LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0}');
+                                     ^
+INSERT INTO LINE_TBL VALUES ('{0,0,1');
+ERROR:  invalid input syntax for type line: "{0,0,1"
+LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0,1');
+                                     ^
 INSERT INTO LINE_TBL VALUES ('{0,0,1}');
 ERROR:  invalid line specification: A and B cannot both be zero
 LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0,1}');
                                      ^
+INSERT INTO LINE_TBL VALUES ('{0,0,1} x');
+ERROR:  invalid input syntax for type line: "{0,0,1} x"
+LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0,1} x');
+                                     ^
 INSERT INTO LINE_TBL VALUES ('(3asdf,2 ,3,4r2)');
 ERROR:  invalid input syntax for type line: "(3asdf,2 ,3,4r2)"
 LINE 1: INSERT INTO LINE_TBL VALUES ('(3asdf,2 ,3,4r2)');
                                      ^
 INSERT INTO LINE_TBL VALUES ('[1,2,3, 4');
 ERROR:  invalid input syntax for type line: "[1,2,3, 4"
 LINE 1: INSERT INTO LINE_TBL VALUES ('[1,2,3, 4');
                                      ^
 INSERT INTO LINE_TBL VALUES ('[(,2),(3,4)]');
 ERROR:  invalid input syntax for type line: "[(,2),(3,4)]"
 LINE 1: INSERT INTO LINE_TBL VALUES ('[(,2),(3,4)]');
                                      ^
 INSERT INTO LINE_TBL VALUES ('[(1,2),(3,4)');
 ERROR:  invalid input syntax for type line: "[(1,2),(3,4)"
 LINE 1: INSERT INTO LINE_TBL VALUES ('[(1,2),(3,4)');
                                      ^
+INSERT INTO LINE_TBL VALUES ('[(1,2),(1,2)]');
+ERROR:  invalid line specification: must be two distinct points
+LINE 1: INSERT INTO LINE_TBL VALUES ('[(1,2),(1,2)]');
+                                     ^
+INSERT INTO LINE_TBL VALUES (line(point '(1,0)', point '(1,0)'));
+ERROR:  invalid line specification: must be two distinct points
 select * from LINE_TBL;
                       s                      
 ---------------------------------------------
- {1,-1,1}
+ {0,-1,5}
+ {1,0,5}
+ {0,3,0}
  {1,-1,0}
  {-0.4,-1,-6}
  {-0.000184615384615385,-1,15.3846153846154}
- {1,-1,11}
+ {3,NaN,5}
+ {NaN,NaN,NaN}
  {0,-1,3}
  {-1,0,3}
-(7 rows)
-
--- functions and operators
-SELECT * FROM LINE_TBL WHERE (s <-> line '[(1,2),(3,4)]') < 10;
-                      s                      
----------------------------------------------
- {1,-1,1}
- {1,-1,0}
- {-0.4,-1,-6}
- {-0.000184615384615385,-1,15.3846153846154}
- {1,-1,11}
- {0,-1,3}
- {-1,0,3}
-(7 rows)
-
-SELECT * FROM LINE_TBL WHERE (point '(0.1,0.1)' <-> s) < 1;
-    s     
-----------
- {1,-1,1}
- {1,-1,0}
-(2 rows)
-
-SELECT * FROM LINE_TBL WHERE (lseg '[(0.1,0.1),(0.2,0.2)]' <-> s) < 1;
-    s     
-----------
- {1,-1,1}
- {1,-1,0}
-(2 rows)
-
-SELECT line '[(1,1),(2,1)]' <-> line '[(-1,-1),(-2,-1)]';
- ?column? 
-----------
-        2
-(1 row)
-
-SELECT lseg '[(1,1),(2,1)]' <-> line '[(-1,-1),(-2,-1)]';
- ?column? 
-----------
-        2
-(1 row)
-
-SELECT point '(-1,1)' <-> line '[(-3,0),(-4,0)]';
- ?column? 
-----------
-        1
-(1 row)
-
-SELECT lseg '[(1,1),(5,5)]' ?# line '[(2,0),(0,2)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT lseg '[(1,1),(5,5)]' ?# line '[(0,0),(1,0)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' ?# box '(0,0,2,2)';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT line '[(3,0),(4,1)]' ?# box '(0,0,2,2)';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT point '(1,1)' <@ line '[(0,0),(2,2)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT point '(1,1)' <@ line '[(0,0),(1,0)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT point '(1,1)' @ line '[(0,0),(2,2)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT point '(1,1)' @ line '[(0,0),(1,0)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT lseg '[(1,1),(2,2)]' <@ line '[(0,0),(2,2)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT lseg '[(1,1),(2,1)]' <@ line '[(0,0),(1,0)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT lseg '[(1,1),(2,2)]' @ line '[(0,0),(2,2)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT lseg '[(1,1),(2,1)]' @ line '[(0,0),(1,0)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT point '(0,1)' ## line '[(0,0),(1,1)]';
- ?column?  
------------
- (0.5,0.5)
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' ## lseg '[(1,0),(2,0)]';
- ?column? 
-----------
- (1,0)
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' ?# line '[(1,0),(2,1)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' ?# line '[(1,0),(1,1)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' # line '[(1,0),(2,1)]';
- ?column? 
-----------
- 
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' # line '[(1,0),(1,1)]';
- ?column? 
-----------
- (1,1)
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' ?|| line '[(1,0),(2,1)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' ?|| line '[(1,0),(1,1)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT line '[(0,0),(1,0)]' ?-| line '[(0,0),(0,1)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT line '[(0,0),(1,1)]' ?-| line '[(1,0),(1,1)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT ?- line '[(0,0),(1,0)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT ?- line '[(0,0),(1,1)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT ?| line '[(0,0),(0,1)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT ?| line '[(0,0),(1,1)]';  -- false
- ?column? 
-----------
- f
-(1 row)
-
-SELECT line(point '(1,2)', point '(3,4)');
-   line   
-----------
- {1,-1,1}
-(1 row)
-
-SELECT line '[(1,2),(3,4)]' = line '[(3,4),(4,5)]';  -- true
- ?column? 
-----------
- t
-(1 row)
-
-SELECT line '[(1,2),(3,4)]' = line '[(3,4),(4,4)]';  -- false
- ?column? 
-----------
- f
-(1 row)
+(10 rows)
 
diff --git a/src/test/regress/expected/lseg.out b/src/test/regress/expected/lseg.out
index bba1f3ee80..7e878b5577 100644
--- a/src/test/regress/expected/lseg.out
+++ b/src/test/regress/expected/lseg.out
@@ -1,21 +1,24 @@
 --
 -- LSEG
 -- Line segments
 --
 --DROP TABLE LSEG_TBL;
 CREATE TABLE LSEG_TBL (s lseg);
 INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)]');
 INSERT INTO LSEG_TBL VALUES ('(0,0),(6,6)');
 INSERT INTO LSEG_TBL VALUES ('10,-10 ,-3,-4');
 INSERT INTO LSEG_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
-INSERT INTO LSEG_TBL VALUES ('(11,22,33,44)');
+INSERT INTO LSEG_TBL VALUES (lseg(point(11, 22), point(33,44)));
+INSERT INTO LSEG_TBL VALUES ('[(-10,2),(-10,3)]');	-- vertical
+INSERT INTO LSEG_TBL VALUES ('[(0,-20),(30,-20)]');	-- horizontal
+INSERT INTO LSEG_TBL VALUES ('[(NaN,1),(NaN,90)]');	-- NaN
 -- bad values for parser testing
 INSERT INTO LSEG_TBL VALUES ('(3asdf,2 ,3,4r2)');
 ERROR:  invalid input syntax for type lseg: "(3asdf,2 ,3,4r2)"
 LINE 1: INSERT INTO LSEG_TBL VALUES ('(3asdf,2 ,3,4r2)');
                                      ^
 INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4');
 ERROR:  invalid input syntax for type lseg: "[1,2,3, 4"
 LINE 1: INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4');
                                      ^
 INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]');
@@ -27,26 +30,15 @@ ERROR:  invalid input syntax for type lseg: "[(1,2),(3,4)"
 LINE 1: INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)');
                                      ^
 select * from LSEG_TBL;
                s               
 -------------------------------
  [(1,2),(3,4)]
  [(0,0),(6,6)]
  [(10,-10),(-3,-4)]
  [(-1000000,200),(300000,-40)]
  [(11,22),(33,44)]
-(5 rows)
-
-SELECT * FROM LSEG_TBL WHERE s <= lseg '[(1,2),(3,4)]';
-       s       
----------------
- [(1,2),(3,4)]
-(1 row)
-
-SELECT * FROM LSEG_TBL WHERE (s <-> lseg '[(1,2),(3,4)]') < 10;
-         s          
---------------------
- [(1,2),(3,4)]
- [(0,0),(6,6)]
- [(10,-10),(-3,-4)]
-(3 rows)
+ [(-10,2),(-10,3)]
+ [(0,-20),(30,-20)]
+ [(NaN,1),(NaN,90)]
+(8 rows)
 
diff --git a/src/test/regress/expected/path.out b/src/test/regress/expected/path.out
index 08d6d61dda..bd6e467752 100644
--- a/src/test/regress/expected/path.out
+++ b/src/test/regress/expected/path.out
@@ -1,79 +1,82 @@
 --
 -- PATH
 --
 --DROP TABLE PATH_TBL;
 CREATE TABLE PATH_TBL (f1 path);
 INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]');
-INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))');
-INSERT INTO PATH_TBL VALUES ('[(0,0),(3,0),(4,5),(1,6)]');
-INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))');
-INSERT INTO PATH_TBL VALUES ('1,2 ,3,4');
-INSERT INTO PATH_TBL VALUES ('[1,2,3, 4]');
-INSERT INTO PATH_TBL VALUES ('[11,12,13,14]');
-INSERT INTO PATH_TBL VALUES ('(11,12,13,14)');
+INSERT INTO PATH_TBL VALUES (' ( ( 1 , 2 ) , ( 3 , 4 ) ) ');
+INSERT INTO PATH_TBL VALUES ('[ (0,0),(3,0),(4,5),(1,6) ]');
+INSERT INTO PATH_TBL VALUES ('((1,2) ,(3,4 ))');
+INSERT INTO PATH_TBL VALUES ('1,2 ,3,4 ');
+INSERT INTO PATH_TBL VALUES (' [1,2,3, 4] ');
+INSERT INTO PATH_TBL VALUES ('((10,20))');	-- Only one point
+INSERT INTO PATH_TBL VALUES ('[ 11,12,13,14 ]');
+INSERT INTO PATH_TBL VALUES ('( 11,12,13,14) ');
 -- bad values for parser testing
+INSERT INTO PATH_TBL VALUES ('[]');
+ERROR:  invalid input syntax for type path: "[]"
+LINE 1: INSERT INTO PATH_TBL VALUES ('[]');
+                                     ^
 INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
 ERROR:  invalid input syntax for type path: "[(,2),(3,4)]"
 LINE 1: INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
                                      ^
 INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
 ERROR:  invalid input syntax for type path: "[(1,2),(3,4)"
 LINE 1: INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
                                      ^
-SELECT f1 FROM PATH_TBL;
-            f1             
----------------------------
- [(1,2),(3,4)]
- ((1,2),(3,4))
- [(0,0),(3,0),(4,5),(1,6)]
- ((1,2),(3,4))
- ((1,2),(3,4))
- [(1,2),(3,4)]
- [(11,12),(13,14)]
- ((11,12),(13,14))
-(8 rows)
-
+INSERT INTO PATH_TBL VALUES ('(1,2,3,4');
+ERROR:  invalid input syntax for type path: "(1,2,3,4"
+LINE 1: INSERT INTO PATH_TBL VALUES ('(1,2,3,4');
+                                     ^
+INSERT INTO PATH_TBL VALUES ('(1,2),(3,4)]');
+ERROR:  invalid input syntax for type path: "(1,2),(3,4)]"
+LINE 1: INSERT INTO PATH_TBL VALUES ('(1,2),(3,4)]');
+                                     ^
 SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1);
  count |         open_path         
 -------+---------------------------
        | [(1,2),(3,4)]
        | [(0,0),(3,0),(4,5),(1,6)]
        | [(1,2),(3,4)]
        | [(11,12),(13,14)]
 (4 rows)
 
 SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1);
  count |    closed_path    
 -------+-------------------
        | ((1,2),(3,4))
        | ((1,2),(3,4))
        | ((1,2),(3,4))
+       | ((10,20))
        | ((11,12),(13,14))
-(4 rows)
+(5 rows)
 
 SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL;
  count |        closed_path        
 -------+---------------------------
        | ((1,2),(3,4))
        | ((1,2),(3,4))
        | ((0,0),(3,0),(4,5),(1,6))
        | ((1,2),(3,4))
        | ((1,2),(3,4))
        | ((1,2),(3,4))
+       | ((10,20))
        | ((11,12),(13,14))
        | ((11,12),(13,14))
-(8 rows)
+(9 rows)
 
 SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL;
  count |         open_path         
 -------+---------------------------
        | [(1,2),(3,4)]
        | [(1,2),(3,4)]
        | [(0,0),(3,0),(4,5),(1,6)]
        | [(1,2),(3,4)]
        | [(1,2),(3,4)]
        | [(1,2),(3,4)]
+       | [(10,20)]
        | [(11,12),(13,14)]
        | [(11,12),(13,14)]
-(8 rows)
+(9 rows)
 
diff --git a/src/test/regress/expected/point.out b/src/test/regress/expected/point.out
index bfc0962749..c18e865370 100644
--- a/src/test/regress/expected/point.out
+++ b/src/test/regress/expected/point.out
@@ -1,43 +1,57 @@
 --
 -- POINT
 --
 CREATE TABLE POINT_TBL(f1 point);
 INSERT INTO POINT_TBL(f1) VALUES ('(0.0,0.0)');
 INSERT INTO POINT_TBL(f1) VALUES ('(-10.0,0.0)');
 INSERT INTO POINT_TBL(f1) VALUES ('(-3.0,4.0)');
 INSERT INTO POINT_TBL(f1) VALUES ('(5.1, 34.5)');
 INSERT INTO POINT_TBL(f1) VALUES ('(-5.0,-12.0)');
+INSERT INTO POINT_TBL(f1) VALUES ('(1e-300,-1e-300)');	-- To underflow
+INSERT INTO POINT_TBL(f1) VALUES ('(1e+300,Inf)');		-- To overflow
+INSERT INTO POINT_TBL(f1) VALUES (' ( Nan , NaN ) ');
 -- bad format points
 INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf');
 ERROR:  invalid input syntax for type point: "asdfasdf"
 LINE 1: INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf');
                                           ^
 INSERT INTO POINT_TBL(f1) VALUES ('10.0,10.0');
 INSERT INTO POINT_TBL(f1) VALUES ('(10.0 10.0)');
 ERROR:  invalid input syntax for type point: "(10.0 10.0)"
 LINE 1: INSERT INTO POINT_TBL(f1) VALUES ('(10.0 10.0)');
                                           ^
+INSERT INTO POINT_TBL(f1) VALUES ('(10.0, 10.0) x');
+ERROR:  invalid input syntax for type point: "(10.0, 10.0) x"
+LINE 1: INSERT INTO POINT_TBL(f1) VALUES ('(10.0, 10.0) x');
+                                          ^
 INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0');
 ERROR:  invalid input syntax for type point: "(10.0,10.0"
 LINE 1: INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0');
                                           ^
+INSERT INTO POINT_TBL(f1) VALUES ('(10.0, 1e+500)');	-- Out of range
+ERROR:  "1e+500" is out of range for type double precision
+LINE 1: INSERT INTO POINT_TBL(f1) VALUES ('(10.0, 1e+500)');
+                                          ^
 SELECT '' AS six, * FROM POINT_TBL;
- six |     f1     
------+------------
+ six |        f1         
+-----+-------------------
      | (0,0)
      | (-10,0)
      | (-3,4)
      | (5.1,34.5)
      | (-5,-12)
+     | (1e-300,-1e-300)
+     | (1e+300,Infinity)
+     | (NaN,NaN)
      | (10,10)
-(6 rows)
+(9 rows)
 
 -- left of
 SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)';
  three |    f1    
 -------+----------
        | (-10,0)
        | (-3,4)
        | (-5,-12)
 (3 rows)
 
@@ -85,172 +99,282 @@ SELECT '' AS three, p.* FROM POINT_TBL p
    WHERE box '(0,0,100,100)' @> p.f1;
  three |     f1     
 -------+------------
        | (0,0)
        | (5.1,34.5)
        | (10,10)
 (3 rows)
 
 SELECT '' AS three, p.* FROM POINT_TBL p
    WHERE not p.f1 <@ box '(0,0,100,100)';
- three |    f1    
--------+----------
+ three |        f1         
+-------+-------------------
        | (-10,0)
        | (-3,4)
        | (-5,-12)
-(3 rows)
+       | (1e-300,-1e-300)
+       | (1e+300,Infinity)
+       | (NaN,NaN)
+(6 rows)
 
 SELECT '' AS two, p.* FROM POINT_TBL p
    WHERE p.f1 <@ path '[(0,0),(-10,0),(-10,10)]';
- two |   f1    
------+---------
+ two |        f1        
+-----+------------------
      | (0,0)
      | (-10,0)
-(2 rows)
+     | (1e-300,-1e-300)
+(3 rows)
 
 SELECT '' AS three, p.* FROM POINT_TBL p
    WHERE not box '(0,0,100,100)' @> p.f1;
- three |    f1    
--------+----------
+ three |        f1         
+-------+-------------------
        | (-10,0)
        | (-3,4)
        | (-5,-12)
-(3 rows)
+       | (1e-300,-1e-300)
+       | (1e+300,Infinity)
+       | (NaN,NaN)
+(6 rows)
 
 SELECT '' AS six, p.f1, p.f1 <-> point '(0,0)' AS dist
    FROM POINT_TBL p
    ORDER BY dist;
- six |     f1     |       dist       
------+------------+------------------
-     | (0,0)      |                0
-     | (-3,4)     |                5
-     | (-10,0)    |               10
-     | (-5,-12)   |               13
-     | (10,10)    |  14.142135623731
-     | (5.1,34.5) | 34.8749193547455
-(6 rows)
+ six |        f1         |         dist         
+-----+-------------------+----------------------
+     | (0,0)             |                    0
+     | (1e-300,-1e-300)  | 1.4142135623731e-300
+     | (-3,4)            |                    5
+     | (-10,0)           |                   10
+     | (-5,-12)          |                   13
+     | (10,10)           |      14.142135623731
+     | (5.1,34.5)        |     34.8749193547455
+     | (1e+300,Infinity) |             Infinity
+     | (NaN,NaN)         |                  NaN
+(9 rows)
 
 SELECT '' AS thirtysix, p1.f1 AS point1, p2.f1 AS point2, p1.f1 <-> p2.f1 AS dist
    FROM POINT_TBL p1, POINT_TBL p2
    ORDER BY dist, p1.f1[0], p2.f1[0];
- thirtysix |   point1   |   point2   |       dist       
------------+------------+------------+------------------
-           | (-10,0)    | (-10,0)    |                0
-           | (-5,-12)   | (-5,-12)   |                0
-           | (-3,4)     | (-3,4)     |                0
-           | (0,0)      | (0,0)      |                0
-           | (5.1,34.5) | (5.1,34.5) |                0
-           | (10,10)    | (10,10)    |                0
-           | (-3,4)     | (0,0)      |                5
-           | (0,0)      | (-3,4)     |                5
-           | (-10,0)    | (-3,4)     | 8.06225774829855
-           | (-3,4)     | (-10,0)    | 8.06225774829855
-           | (-10,0)    | (0,0)      |               10
-           | (0,0)      | (-10,0)    |               10
-           | (-10,0)    | (-5,-12)   |               13
-           | (-5,-12)   | (-10,0)    |               13
-           | (-5,-12)   | (0,0)      |               13
-           | (0,0)      | (-5,-12)   |               13
-           | (0,0)      | (10,10)    |  14.142135623731
-           | (10,10)    | (0,0)      |  14.142135623731
-           | (-3,4)     | (10,10)    | 14.3178210632764
-           | (10,10)    | (-3,4)     | 14.3178210632764
-           | (-5,-12)   | (-3,4)     | 16.1245154965971
-           | (-3,4)     | (-5,-12)   | 16.1245154965971
-           | (-10,0)    | (10,10)    | 22.3606797749979
-           | (10,10)    | (-10,0)    | 22.3606797749979
-           | (5.1,34.5) | (10,10)    | 24.9851956166046
-           | (10,10)    | (5.1,34.5) | 24.9851956166046
-           | (-5,-12)   | (10,10)    | 26.6270539113887
-           | (10,10)    | (-5,-12)   | 26.6270539113887
-           | (-3,4)     | (5.1,34.5) | 31.5572495632937
-           | (5.1,34.5) | (-3,4)     | 31.5572495632937
-           | (0,0)      | (5.1,34.5) | 34.8749193547455
-           | (5.1,34.5) | (0,0)      | 34.8749193547455
-           | (-10,0)    | (5.1,34.5) | 37.6597928831267
-           | (5.1,34.5) | (-10,0)    | 37.6597928831267
-           | (-5,-12)   | (5.1,34.5) | 47.5842410888311
-           | (5.1,34.5) | (-5,-12)   | 47.5842410888311
-(36 rows)
+ thirtysix |      point1       |      point2       |         dist         
+-----------+-------------------+-------------------+----------------------
+           | (-10,0)           | (-10,0)           |                    0
+           | (-5,-12)          | (-5,-12)          |                    0
+           | (-3,4)            | (-3,4)            |                    0
+           | (0,0)             | (0,0)             |                    0
+           | (1e-300,-1e-300)  | (1e-300,-1e-300)  |                    0
+           | (5.1,34.5)        | (5.1,34.5)        |                    0
+           | (10,10)           | (10,10)           |                    0
+           | (0,0)             | (1e-300,-1e-300)  | 1.4142135623731e-300
+           | (1e-300,-1e-300)  | (0,0)             | 1.4142135623731e-300
+           | (-3,4)            | (0,0)             |                    5
+           | (-3,4)            | (1e-300,-1e-300)  |                    5
+           | (0,0)             | (-3,4)            |                    5
+           | (1e-300,-1e-300)  | (-3,4)            |                    5
+           | (-10,0)           | (-3,4)            |     8.06225774829855
+           | (-3,4)            | (-10,0)           |     8.06225774829855
+           | (-10,0)           | (0,0)             |                   10
+           | (-10,0)           | (1e-300,-1e-300)  |                   10
+           | (0,0)             | (-10,0)           |                   10
+           | (1e-300,-1e-300)  | (-10,0)           |                   10
+           | (-10,0)           | (-5,-12)          |                   13
+           | (-5,-12)          | (-10,0)           |                   13
+           | (-5,-12)          | (0,0)             |                   13
+           | (-5,-12)          | (1e-300,-1e-300)  |                   13
+           | (0,0)             | (-5,-12)          |                   13
+           | (1e-300,-1e-300)  | (-5,-12)          |                   13
+           | (0,0)             | (10,10)           |      14.142135623731
+           | (1e-300,-1e-300)  | (10,10)           |      14.142135623731
+           | (10,10)           | (0,0)             |      14.142135623731
+           | (10,10)           | (1e-300,-1e-300)  |      14.142135623731
+           | (-3,4)            | (10,10)           |     14.3178210632764
+           | (10,10)           | (-3,4)            |     14.3178210632764
+           | (-5,-12)          | (-3,4)            |     16.1245154965971
+           | (-3,4)            | (-5,-12)          |     16.1245154965971
+           | (-10,0)           | (10,10)           |     22.3606797749979
+           | (10,10)           | (-10,0)           |     22.3606797749979
+           | (5.1,34.5)        | (10,10)           |     24.9851956166046
+           | (10,10)           | (5.1,34.5)        |     24.9851956166046
+           | (-5,-12)          | (10,10)           |     26.6270539113887
+           | (10,10)           | (-5,-12)          |     26.6270539113887
+           | (-3,4)            | (5.1,34.5)        |     31.5572495632937
+           | (5.1,34.5)        | (-3,4)            |     31.5572495632937
+           | (0,0)             | (5.1,34.5)        |     34.8749193547455
+           | (1e-300,-1e-300)  | (5.1,34.5)        |     34.8749193547455
+           | (5.1,34.5)        | (0,0)             |     34.8749193547455
+           | (5.1,34.5)        | (1e-300,-1e-300)  |     34.8749193547455
+           | (-10,0)           | (5.1,34.5)        |     37.6597928831267
+           | (5.1,34.5)        | (-10,0)           |     37.6597928831267
+           | (-5,-12)          | (5.1,34.5)        |     47.5842410888311
+           | (5.1,34.5)        | (-5,-12)          |     47.5842410888311
+           | (-10,0)           | (1e+300,Infinity) |             Infinity
+           | (-5,-12)          | (1e+300,Infinity) |             Infinity
+           | (-3,4)            | (1e+300,Infinity) |             Infinity
+           | (0,0)             | (1e+300,Infinity) |             Infinity
+           | (1e-300,-1e-300)  | (1e+300,Infinity) |             Infinity
+           | (5.1,34.5)        | (1e+300,Infinity) |             Infinity
+           | (10,10)           | (1e+300,Infinity) |             Infinity
+           | (1e+300,Infinity) | (-10,0)           |             Infinity
+           | (1e+300,Infinity) | (-5,-12)          |             Infinity
+           | (1e+300,Infinity) | (-3,4)            |             Infinity
+           | (1e+300,Infinity) | (0,0)             |             Infinity
+           | (1e+300,Infinity) | (1e-300,-1e-300)  |             Infinity
+           | (1e+300,Infinity) | (5.1,34.5)        |             Infinity
+           | (1e+300,Infinity) | (10,10)           |             Infinity
+           | (-10,0)           | (NaN,NaN)         |                  NaN
+           | (-5,-12)          | (NaN,NaN)         |                  NaN
+           | (-3,4)            | (NaN,NaN)         |                  NaN
+           | (0,0)             | (NaN,NaN)         |                  NaN
+           | (1e-300,-1e-300)  | (NaN,NaN)         |                  NaN
+           | (5.1,34.5)        | (NaN,NaN)         |                  NaN
+           | (10,10)           | (NaN,NaN)         |                  NaN
+           | (1e+300,Infinity) | (1e+300,Infinity) |                  NaN
+           | (1e+300,Infinity) | (NaN,NaN)         |                  NaN
+           | (NaN,NaN)         | (-10,0)           |                  NaN
+           | (NaN,NaN)         | (-5,-12)          |                  NaN
+           | (NaN,NaN)         | (-3,4)            |                  NaN
+           | (NaN,NaN)         | (0,0)             |                  NaN
+           | (NaN,NaN)         | (1e-300,-1e-300)  |                  NaN
+           | (NaN,NaN)         | (5.1,34.5)        |                  NaN
+           | (NaN,NaN)         | (10,10)           |                  NaN
+           | (NaN,NaN)         | (1e+300,Infinity) |                  NaN
+           | (NaN,NaN)         | (NaN,NaN)         |                  NaN
+(81 rows)
 
 SELECT '' AS thirty, p1.f1 AS point1, p2.f1 AS point2
    FROM POINT_TBL p1, POINT_TBL p2
    WHERE (p1.f1 <-> p2.f1) > 3;
- thirty |   point1   |   point2   
---------+------------+------------
-        | (0,0)      | (-10,0)
-        | (0,0)      | (-3,4)
-        | (0,0)      | (5.1,34.5)
-        | (0,0)      | (-5,-12)
-        | (0,0)      | (10,10)
-        | (-10,0)    | (0,0)
-        | (-10,0)    | (-3,4)
-        | (-10,0)    | (5.1,34.5)
-        | (-10,0)    | (-5,-12)
-        | (-10,0)    | (10,10)
-        | (-3,4)     | (0,0)
-        | (-3,4)     | (-10,0)
-        | (-3,4)     | (5.1,34.5)
-        | (-3,4)     | (-5,-12)
-        | (-3,4)     | (10,10)
-        | (5.1,34.5) | (0,0)
-        | (5.1,34.5) | (-10,0)
-        | (5.1,34.5) | (-3,4)
-        | (5.1,34.5) | (-5,-12)
-        | (5.1,34.5) | (10,10)
-        | (-5,-12)   | (0,0)
-        | (-5,-12)   | (-10,0)
-        | (-5,-12)   | (-3,4)
-        | (-5,-12)   | (5.1,34.5)
-        | (-5,-12)   | (10,10)
-        | (10,10)    | (0,0)
-        | (10,10)    | (-10,0)
-        | (10,10)    | (-3,4)
-        | (10,10)    | (5.1,34.5)
-        | (10,10)    | (-5,-12)
-(30 rows)
+ thirty |      point1       |      point2       
+--------+-------------------+-------------------
+        | (0,0)             | (-10,0)
+        | (0,0)             | (-3,4)
+        | (0,0)             | (5.1,34.5)
+        | (0,0)             | (-5,-12)
+        | (0,0)             | (1e+300,Infinity)
+        | (0,0)             | (NaN,NaN)
+        | (0,0)             | (10,10)
+        | (-10,0)           | (0,0)
+        | (-10,0)           | (-3,4)
+        | (-10,0)           | (5.1,34.5)
+        | (-10,0)           | (-5,-12)
+        | (-10,0)           | (1e-300,-1e-300)
+        | (-10,0)           | (1e+300,Infinity)
+        | (-10,0)           | (NaN,NaN)
+        | (-10,0)           | (10,10)
+        | (-3,4)            | (0,0)
+        | (-3,4)            | (-10,0)
+        | (-3,4)            | (5.1,34.5)
+        | (-3,4)            | (-5,-12)
+        | (-3,4)            | (1e-300,-1e-300)
+        | (-3,4)            | (1e+300,Infinity)
+        | (-3,4)            | (NaN,NaN)
+        | (-3,4)            | (10,10)
+        | (5.1,34.5)        | (0,0)
+        | (5.1,34.5)        | (-10,0)
+        | (5.1,34.5)        | (-3,4)
+        | (5.1,34.5)        | (-5,-12)
+        | (5.1,34.5)        | (1e-300,-1e-300)
+        | (5.1,34.5)        | (1e+300,Infinity)
+        | (5.1,34.5)        | (NaN,NaN)
+        | (5.1,34.5)        | (10,10)
+        | (-5,-12)          | (0,0)
+        | (-5,-12)          | (-10,0)
+        | (-5,-12)          | (-3,4)
+        | (-5,-12)          | (5.1,34.5)
+        | (-5,-12)          | (1e-300,-1e-300)
+        | (-5,-12)          | (1e+300,Infinity)
+        | (-5,-12)          | (NaN,NaN)
+        | (-5,-12)          | (10,10)
+        | (1e-300,-1e-300)  | (-10,0)
+        | (1e-300,-1e-300)  | (-3,4)
+        | (1e-300,-1e-300)  | (5.1,34.5)
+        | (1e-300,-1e-300)  | (-5,-12)
+        | (1e-300,-1e-300)  | (1e+300,Infinity)
+        | (1e-300,-1e-300)  | (NaN,NaN)
+        | (1e-300,-1e-300)  | (10,10)
+        | (1e+300,Infinity) | (0,0)
+        | (1e+300,Infinity) | (-10,0)
+        | (1e+300,Infinity) | (-3,4)
+        | (1e+300,Infinity) | (5.1,34.5)
+        | (1e+300,Infinity) | (-5,-12)
+        | (1e+300,Infinity) | (1e-300,-1e-300)
+        | (1e+300,Infinity) | (1e+300,Infinity)
+        | (1e+300,Infinity) | (NaN,NaN)
+        | (1e+300,Infinity) | (10,10)
+        | (NaN,NaN)         | (0,0)
+        | (NaN,NaN)         | (-10,0)
+        | (NaN,NaN)         | (-3,4)
+        | (NaN,NaN)         | (5.1,34.5)
+        | (NaN,NaN)         | (-5,-12)
+        | (NaN,NaN)         | (1e-300,-1e-300)
+        | (NaN,NaN)         | (1e+300,Infinity)
+        | (NaN,NaN)         | (NaN,NaN)
+        | (NaN,NaN)         | (10,10)
+        | (10,10)           | (0,0)
+        | (10,10)           | (-10,0)
+        | (10,10)           | (-3,4)
+        | (10,10)           | (5.1,34.5)
+        | (10,10)           | (-5,-12)
+        | (10,10)           | (1e-300,-1e-300)
+        | (10,10)           | (1e+300,Infinity)
+        | (10,10)           | (NaN,NaN)
+(72 rows)
 
 -- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10
 SELECT '' AS fifteen, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance
    FROM POINT_TBL p1, POINT_TBL p2
    WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1
    ORDER BY distance, p1.f1[0], p2.f1[0];
- fifteen |   point1   |   point2   |     distance     
----------+------------+------------+------------------
-         | (-3,4)     | (0,0)      |                5
-         | (-10,0)    | (-3,4)     | 8.06225774829855
-         | (-10,0)    | (0,0)      |               10
-         | (-10,0)    | (-5,-12)   |               13
-         | (-5,-12)   | (0,0)      |               13
-         | (0,0)      | (10,10)    |  14.142135623731
-         | (-3,4)     | (10,10)    | 14.3178210632764
-         | (-5,-12)   | (-3,4)     | 16.1245154965971
-         | (-10,0)    | (10,10)    | 22.3606797749979
-         | (5.1,34.5) | (10,10)    | 24.9851956166046
-         | (-5,-12)   | (10,10)    | 26.6270539113887
-         | (-3,4)     | (5.1,34.5) | 31.5572495632937
-         | (0,0)      | (5.1,34.5) | 34.8749193547455
-         | (-10,0)    | (5.1,34.5) | 37.6597928831267
-         | (-5,-12)   | (5.1,34.5) | 47.5842410888311
-(15 rows)
+ fifteen |      point1      |      point2       |     distance     
+---------+------------------+-------------------+------------------
+         | (-3,4)           | (0,0)             |                5
+         | (-3,4)           | (1e-300,-1e-300)  |                5
+         | (-10,0)          | (-3,4)            | 8.06225774829855
+         | (-10,0)          | (0,0)             |               10
+         | (-10,0)          | (1e-300,-1e-300)  |               10
+         | (-10,0)          | (-5,-12)          |               13
+         | (-5,-12)         | (0,0)             |               13
+         | (-5,-12)         | (1e-300,-1e-300)  |               13
+         | (0,0)            | (10,10)           |  14.142135623731
+         | (1e-300,-1e-300) | (10,10)           |  14.142135623731
+         | (-3,4)           | (10,10)           | 14.3178210632764
+         | (-5,-12)         | (-3,4)            | 16.1245154965971
+         | (-10,0)          | (10,10)           | 22.3606797749979
+         | (5.1,34.5)       | (10,10)           | 24.9851956166046
+         | (-5,-12)         | (10,10)           | 26.6270539113887
+         | (-3,4)           | (5.1,34.5)        | 31.5572495632937
+         | (0,0)            | (5.1,34.5)        | 34.8749193547455
+         | (1e-300,-1e-300) | (5.1,34.5)        | 34.8749193547455
+         | (-10,0)          | (5.1,34.5)        | 37.6597928831267
+         | (-5,-12)         | (5.1,34.5)        | 47.5842410888311
+         | (-10,0)          | (1e+300,Infinity) |         Infinity
+         | (-5,-12)         | (1e+300,Infinity) |         Infinity
+         | (-3,4)           | (1e+300,Infinity) |         Infinity
+         | (0,0)            | (1e+300,Infinity) |         Infinity
+         | (1e-300,-1e-300) | (1e+300,Infinity) |         Infinity
+         | (5.1,34.5)       | (1e+300,Infinity) |         Infinity
+         | (10,10)          | (1e+300,Infinity) |         Infinity
+(27 rows)
 
 -- put distance result into output to allow sorting with GEQ optimizer - tgl 97/05/10
 SELECT '' AS three, p1.f1 AS point1, p2.f1 AS point2, (p1.f1 <-> p2.f1) AS distance
    FROM POINT_TBL p1, POINT_TBL p2
    WHERE (p1.f1 <-> p2.f1) > 3 and p1.f1 << p2.f1 and p1.f1 >^ p2.f1
    ORDER BY distance;
- three |   point1   |  point2  |     distance     
--------+------------+----------+------------------
-       | (-3,4)     | (0,0)    |                5
-       | (-10,0)    | (-5,-12) |               13
-       | (5.1,34.5) | (10,10)  | 24.9851956166046
-(3 rows)
+ three |   point1   |      point2      |     distance     
+-------+------------+------------------+------------------
+       | (-3,4)     | (0,0)            |                5
+       | (-3,4)     | (1e-300,-1e-300) |                5
+       | (-10,0)    | (-5,-12)         |               13
+       | (5.1,34.5) | (10,10)          | 24.9851956166046
+(4 rows)
 
 -- Test that GiST indexes provide same behavior as sequential scan
 CREATE TEMP TABLE point_gist_tbl(f1 point);
 INSERT INTO point_gist_tbl SELECT '(0,0)' FROM generate_series(0,1000);
 CREATE INDEX point_gist_tbl_index ON point_gist_tbl USING gist (f1);
 INSERT INTO point_gist_tbl VALUES ('(0.0000009,0.0000009)');
 SET enable_seqscan TO true;
 SET enable_indexscan TO false;
 SET enable_bitmapscan TO false;
 SELECT COUNT(*) FROM point_gist_tbl WHERE f1 ~= '(0.0000009,0.0000009)'::point;
diff --git a/src/test/regress/expected/polygon.out b/src/test/regress/expected/polygon.out
index 4a1f60427a..be5f76bf9d 100644
--- a/src/test/regress/expected/polygon.out
+++ b/src/test/regress/expected/polygon.out
@@ -1,18 +1,21 @@
 --
 -- POLYGON
 --
 -- polygon logic
 --
 CREATE TABLE POLYGON_TBL(f1 polygon);
 INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,0.0),(2.0,4.0),(0.0,0.0)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)');
+INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(3,4),(5,6),(7,8)');
+INSERT INTO POLYGON_TBL(f1) VALUES ('(7,8),(5,6),(3,4),(1,2)'); -- Reverse
+INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(7,8),(5,6),(3,-4)');
 -- degenerate polygons
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)');
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)');
 -- bad polygon input strings
 INSERT INTO POLYGON_TBL(f1) VALUES ('0.0');
 ERROR:  invalid input syntax for type polygon: "0.0"
 LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('0.0');
                                             ^
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0');
 ERROR:  invalid input syntax for type polygon: "(0.0 0.0"
@@ -24,215 +27,30 @@ LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)');
                                             ^
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
 ERROR:  invalid input syntax for type polygon: "(0,1,2,3"
 LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
                                             ^
 INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
 ERROR:  invalid input syntax for type polygon: "asdf"
 LINE 1: INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
                                             ^
 SELECT '' AS four, * FROM POLYGON_TBL;
- four |         f1          
-------+---------------------
+ four |             f1             
+------+----------------------------
       | ((2,0),(2,4),(0,0))
       | ((3,1),(3,3),(1,0))
+      | ((1,2),(3,4),(5,6),(7,8))
+      | ((7,8),(5,6),(3,4),(1,2))
+      | ((1,2),(7,8),(5,6),(3,-4))
       | ((0,0))
       | ((0,1),(0,1))
-(4 rows)
-
--- overlap
-SELECT '' AS three, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 && '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
- three |         f1          
--------+---------------------
-       | ((2,0),(2,4),(0,0))
-       | ((3,1),(3,3),(1,0))
-(2 rows)
-
--- left overlap
-SELECT '' AS four, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 &< '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
- four |         f1          
-------+---------------------
-      | ((2,0),(2,4),(0,0))
-      | ((3,1),(3,3),(1,0))
-      | ((0,0))
-      | ((0,1),(0,1))
-(4 rows)
-
--- right overlap
-SELECT '' AS two, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
- two |         f1          
------+---------------------
-     | ((3,1),(3,3),(1,0))
-(1 row)
-
--- left of
-SELECT '' AS one, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 << '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
- one |      f1       
------+---------------
-     | ((0,0))
-     | ((0,1),(0,1))
-(2 rows)
-
--- right of
-SELECT '' AS zero, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
- zero | f1 
-------+----
-(0 rows)
-
--- contained
-SELECT '' AS one, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
- one |         f1          
------+---------------------
-     | ((3,1),(3,3),(1,0))
-(1 row)
-
--- same
-SELECT '' AS one, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
- one |         f1          
------+---------------------
-     | ((3,1),(3,3),(1,0))
-(1 row)
-
--- contains
-SELECT '' AS one, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
- one |         f1          
------+---------------------
-     | ((3,1),(3,3),(1,0))
-(1 row)
-
---
--- polygon logic
---
--- left of
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
- false 
--------
- f
-(1 row)
-
--- left overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
- true 
-------
- f
-(1 row)
-
--- right overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
- false 
--------
- f
-(1 row)
-
--- right of
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' >> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
- false 
--------
- f
-(1 row)
-
--- contained in
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
- false 
--------
- f
-(1 row)
-
--- contains
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
- false 
--------
- f
-(1 row)
-
-SELECT '((0,4),(6,4),(1,2),(6,0),(0,0))'::polygon @> '((2,1),(2,3),(3,3),(3,1))'::polygon AS "false";
- false 
--------
- f
-(1 row)
-
-SELECT '((0,4),(6,4),(3,2),(6,0),(0,0))'::polygon @> '((2,1),(2,3),(3,3),(3,1))'::polygon AS "true";
- true 
-------
- t
-(1 row)
-
-SELECT '((1,1),(1,4),(5,4),(5,3),(2,3),(2,2),(5,2),(5,1))'::polygon @> '((3,2),(3,3),(4,3),(4,2))'::polygon AS "false";
- false 
--------
- f
-(1 row)
-
-SELECT '((0,0),(0,3),(3,3),(3,0))'::polygon @> '((2,1),(2,2),(3,2),(3,1))'::polygon AS "true";
- true 
-------
- t
-(1 row)
-
--- same
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
- false 
--------
- f
-(1 row)
-
--- overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' && polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
- true 
-------
- t
-(1 row)
-
-SELECT '((0,4),(6,4),(1,2),(6,0),(0,0))'::polygon && '((2,1),(2,3),(3,3),(3,1))'::polygon AS "true";
- true 
-------
- t
-(1 row)
-
-SELECT '((1,4),(1,1),(4,1),(4,2),(2,2),(2,4),(1,4))'::polygon && '((3,3),(4,3),(4,4),(3,4),(3,3))'::polygon AS "false";
- false 
--------
- f
-(1 row)
-
-SELECT '((200,800),(800,800),(800,200),(200,200))' &&  '(1000,1000,0,0)'::polygon AS "true";
- true 
-------
- t
-(1 row)
-
--- distance from a point
-SELECT	'(0,0)'::point <-> '((0,0),(1,2),(2,1))'::polygon as on_corner,
-	'(1,1)'::point <-> '((0,0),(2,2),(1,3))'::polygon as on_segment,
-	'(2,2)'::point <-> '((0,0),(1,4),(3,1))'::polygon as inside,
-	'(3,3)'::point <-> '((0,2),(2,0),(2,2))'::polygon as near_corner,
-	'(4,4)'::point <-> '((0,0),(0,3),(4,0))'::polygon as near_segment;
- on_corner | on_segment | inside |   near_corner   | near_segment 
------------+------------+--------+-----------------+--------------
-         0 |          0 |      0 | 1.4142135623731 |          3.2
-(1 row)
+(7 rows)
 
 --
 -- Test the SP-GiST index
 --
 CREATE TABLE quad_poly_tbl (id int, p polygon);
 INSERT INTO quad_poly_tbl
 	SELECT (x - 1) * 100 + y, polygon(circle(point(x * 10, y * 10), 1 + (x + y) % 10))
 	FROM generate_series(1, 100) x,
 		 generate_series(1, 100) y;
 INSERT INTO quad_poly_tbl
diff --git a/src/test/regress/sql/box.sql b/src/test/regress/sql/box.sql
index 135ac108eb..6710fc90f5 100644
--- a/src/test/regress/sql/box.sql
+++ b/src/test/regress/sql/box.sql
@@ -18,29 +18,38 @@
 
 -- boxes are specified by two points, given by four floats x1,y1,x2,y2
 
 
 CREATE TABLE BOX_TBL (f1 box);
 
 INSERT INTO BOX_TBL (f1) VALUES ('(2.0,2.0,0.0,0.0)');
 
 INSERT INTO BOX_TBL (f1) VALUES ('(1.0,1.0,3.0,3.0)');
 
+INSERT INTO BOX_TBL (f1) VALUES ('((-8, 2), (-2, -10))');
+
+
 -- degenerate cases where the box is a line or a point
 -- note that lines and points boxes all have zero area
 INSERT INTO BOX_TBL (f1) VALUES ('(2.5, 2.5, 2.5,3.5)');
 
 INSERT INTO BOX_TBL (f1) VALUES ('(3.0, 3.0,3.0,3.0)');
 
 -- badly formatted box inputs
 INSERT INTO BOX_TBL (f1) VALUES ('(2.3, 4.5)');
 
+INSERT INTO BOX_TBL (f1) VALUES ('[1, 2, 3, 4)');
+
+INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4]');
+
+INSERT INTO BOX_TBL (f1) VALUES ('(1, 2, 3, 4) x');
+
 INSERT INTO BOX_TBL (f1) VALUES ('asdfasdf(ad');
 
 
 SELECT '' AS four, * FROM BOX_TBL;
 
 SELECT '' AS four, b.*, area(b.f1) as barea
    FROM BOX_TBL b;
 
 -- overlap
 SELECT '' AS three, b.f1
diff --git a/src/test/regress/sql/circle.sql b/src/test/regress/sql/circle.sql
index c0284b2b59..46c96e1400 100644
--- a/src/test/regress/sql/circle.sql
+++ b/src/test/regress/sql/circle.sql
@@ -7,26 +7,34 @@ CREATE TABLE CIRCLE_TBL (f1 circle);
 INSERT INTO CIRCLE_TBL VALUES ('<(5,1),3>');
 
 INSERT INTO CIRCLE_TBL VALUES ('<(1,2),100>');
 
 INSERT INTO CIRCLE_TBL VALUES ('1,3,5');
 
 INSERT INTO CIRCLE_TBL VALUES ('((1,2),3)');
 
 INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10>');
 
-INSERT INTO CIRCLE_TBL VALUES ('<(100,1),115>');
+INSERT INTO CIRCLE_TBL VALUES (' < ( 100 , 1 ) , 115 > ');
+
+INSERT INTO CIRCLE_TBL VALUES ('<(3,5),0>');	-- Zero radius
+
+INSERT INTO CIRCLE_TBL VALUES ('<(3,5),NaN>');	-- NaN radius
 
 -- bad values
 
 INSERT INTO CIRCLE_TBL VALUES ('<(-100,0),-100>');
 
+INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10');
+
+INSERT INTO CIRCLE_TBL VALUES ('<(100,200),10> x');
+
 INSERT INTO CIRCLE_TBL VALUES ('1abc,3,5');
 
 INSERT INTO CIRCLE_TBL VALUES ('(3,(1,2),3)');
 
 SELECT * FROM CIRCLE_TBL;
 
 SELECT '' AS six, center(f1) AS center
   FROM CIRCLE_TBL;
 
 SELECT '' AS six, radius(f1) AS radius
diff --git a/src/test/regress/sql/geometry.sql b/src/test/regress/sql/geometry.sql
index 1429ee772a..ce98b3e90c 100644
--- a/src/test/regress/sql/geometry.sql
+++ b/src/test/regress/sql/geometry.sql
@@ -39,74 +39,298 @@ SELECT '' AS two, p1.f1
 -- "is vertical" function
 SELECT '' AS one, p1.f1
    FROM POINT_TBL p1
    WHERE isvertical(p1.f1, point '(5.1,34.5)');
 
 -- "is vertical" operator
 SELECT '' AS one, p1.f1
    FROM POINT_TBL p1
    WHERE p1.f1 ?| point '(5.1,34.5)';
 
+-- Slope
+SELECT p1.f1, p2.f1, slope(p1.f1, p2.f1) FROM POINT_TBL p1, POINT_TBL p2;
+
+-- Add point
+SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM POINT_TBL p1, POINT_TBL p2;
+
+-- Subtract point
+SELECT p1.f1, p2.f1, p1.f1 - p2.f1 FROM POINT_TBL p1, POINT_TBL p2;
+
+-- Multiply with point
+SELECT p1.f1, p2.f1, p1.f1 * p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1[0] BETWEEN 1 AND 1000;
+
+-- Underflow error
+SELECT p1.f1, p2.f1, p1.f1 * p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p1.f1[0] < 1;
+
+-- Divide by point
+SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1[0] BETWEEN 1 AND 1000;
+
+-- Overflow error
+SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1[0] > 1000;
+
+-- Division by 0 error
+SELECT p1.f1, p2.f1, p1.f1 / p2.f1 FROM POINT_TBL p1, POINT_TBL p2 WHERE p2.f1 ~= '(0,0)'::point;
+
+-- Distance to line
+SELECT p.f1, l.s, p.f1 <-> l.s FROM POINT_TBL p, LINE_TBL l;
+
+-- Distance to line segment
+SELECT p.f1, l.s, p.f1 <-> l.s FROM POINT_TBL p, LSEG_TBL l;
+
+-- Distance to box
+SELECT p.f1, b.f1, p.f1 <-> b.f1 FROM POINT_TBL p, BOX_TBL b;
+
+-- Distance to path
+SELECT p.f1, p1.f1, p.f1 <-> p1.f1 FROM POINT_TBL p, PATH_TBL p1;
+
+-- Distance to polygon
+SELECT p.f1, p1.f1, p.f1 <-> p1.f1 FROM POINT_TBL p, POLYGON_TBL p1;
+
+-- Closest point to line
+SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LINE_TBL l;
+
+-- Closest point to line segment
+SELECT p.f1, l.s, p.f1 ## l.s FROM POINT_TBL p, LSEG_TBL l;
+
+-- Closest point to box
+SELECT p.f1, b.f1, p.f1 ## b.f1 FROM POINT_TBL p, BOX_TBL b;
+
+-- On line
+SELECT p.f1, l.s FROM POINT_TBL p, LINE_TBL l WHERE p.f1 <@ l.s;
+
+-- On line segment
+SELECT p.f1, l.s FROM POINT_TBL p, LSEG_TBL l WHERE p.f1 <@ l.s;
+
+-- On path
+SELECT p.f1, p1.f1 FROM POINT_TBL p, PATH_TBL p1 WHERE p.f1 <@ p1.f1;
+
+--
+-- Lines
+--
+
+-- Vertical
+SELECT s FROM LINE_TBL WHERE ?| s;
+
+-- Horizontal
+SELECT s FROM LINE_TBL WHERE ?- s;
+
+-- Same as line
+SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s = l2.s;
+
+-- Parallel to line
+SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?|| l2.s;
+
+-- Perpendicular to line
+SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?-| l2.s;
+
+-- Distance to line
+SELECT l1.s, l2.s, l1.s <-> l2.s FROM LINE_TBL l1, LINE_TBL l2;
+
+-- Distance to box
+SELECT l.s, b.f1, l.s <-> b.f1 FROM LINE_TBL l, BOX_TBL b;
+
+-- Intersect with line
+SELECT l1.s, l2.s FROM LINE_TBL l1, LINE_TBL l2 WHERE l1.s ?# l2.s;
+
+-- Intersect with box
+SELECT l.s, b.f1 FROM LINE_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
+
+-- Intersection point with line
+SELECT l1.s, l2.s, l1.s # l2.s FROM LINE_TBL l1, LINE_TBL l2;
+
+-- Closest point to line segment
+SELECT l.s, l1.s, l.s ## l1.s FROM LINE_TBL l, LSEG_TBL l1;
+
+-- Closest point to box
+SELECT l.s, b.f1, l.s ## b.f1 FROM LINE_TBL l, BOX_TBL b;
+
 --
 -- Line segments
 --
 
 -- intersection
 SELECT '' AS count, p.f1, l.s, l.s # p.f1 AS intersection
    FROM LSEG_TBL l, POINT_TBL p;
 
--- closest point
-SELECT '' AS thirty, p.f1, l.s, p.f1 ## l.s AS closest
-   FROM LSEG_TBL l, POINT_TBL p;
+-- Length
+SELECT s, @-@ s FROM LSEG_TBL;
+
+-- Vertical
+SELECT s FROM LSEG_TBL WHERE ?| s;
+
+-- Horizontal
+SELECT s FROM LSEG_TBL WHERE ?- s;
+
+-- Center
+SELECT s, @@ s FROM LSEG_TBL;
+
+-- To point
+SELECT s, s::point FROM LSEG_TBL;
+
+-- Has points less than line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s < l2.s;
+
+-- Has points less than or equal to line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s <= l2.s;
+
+-- Has points equal to line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s = l2.s;
+
+-- Has points greater than or equal to line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s >= l2.s;
+
+-- Has points greater than line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s > l2.s;
+
+-- Has points not equal to line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s != l2.s;
+
+-- Parallel with line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?|| l2.s;
+
+-- Perpendicular with line segment
+SELECT l1.s, l2.s FROM LSEG_TBL l1, LSEG_TBL l2 WHERE l1.s ?-| l2.s;
+
+-- Distance to line
+SELECT l.s, l1.s, l.s <-> l1.s FROM LSEG_TBL l, LINE_TBL l1;
+
+-- Distance to line segment
+SELECT l1.s, l2.s, l1.s <-> l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
+
+-- Distance to box
+SELECT l.s, b.f1, l.s <-> b.f1 FROM LSEG_TBL l, BOX_TBL b;
+
+-- Intersect with line segment
+SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s ?# l1.s;
+
+-- Intersect with box
+SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s ?# b.f1;
+
+-- Intersection point with line segment
+SELECT l1.s, l2.s, l1.s # l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
+
+-- Closest point to line
+SELECT l.s, l1.s, l.s ## l1.s FROM LSEG_TBL l, LINE_TBL l1;
+
+-- Closest point to line segment
+SELECT l1.s, l2.s, l1.s ## l2.s FROM LSEG_TBL l1, LSEG_TBL l2;
+
+-- Closest point to box
+SELECT l.s, b.f1, l.s ## b.f1 FROM LSEG_TBL l, BOX_TBL b;
+
+-- On line
+SELECT l.s, l1.s FROM LSEG_TBL l, LINE_TBL l1 WHERE l.s <@ l1.s;
+
+-- On box
+SELECT l.s, b.f1 FROM LSEG_TBL l, BOX_TBL b WHERE l.s <@ b.f1;
 
 --
 -- Boxes
 --
 
 SELECT '' as six, box(f1) AS box FROM CIRCLE_TBL;
 
 -- translation
 SELECT '' AS twentyfour, b.f1 + p.f1 AS translation
    FROM BOX_TBL b, POINT_TBL p;
 
 SELECT '' AS twentyfour, b.f1 - p.f1 AS translation
    FROM BOX_TBL b, POINT_TBL p;
 
--- scaling and rotation
-SELECT '' AS twentyfour, b.f1 * p.f1 AS rotation
-   FROM BOX_TBL b, POINT_TBL p;
+-- Multiply with point
+SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
 
-SELECT '' AS twenty, b.f1 / p.f1 AS rotation
-   FROM BOX_TBL b, POINT_TBL p
-   WHERE (p.f1 <-> point '(0,0)') >= 1;
+-- Overflow error
+SELECT b.f1, p.f1, b.f1 * p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] > 1000;
 
+-- Divide by point
+SELECT b.f1, p.f1, b.f1 / p.f1 FROM BOX_TBL b, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
+
+-- To box
 SELECT f1::box
 	FROM POINT_TBL;
 
 SELECT bound_box(a.f1, b.f1)
 	FROM BOX_TBL a, BOX_TBL b;
 
+-- Below box
+SELECT b1.f1, b2.f1, b1.f1 <^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
+
+-- Above box
+SELECT b1.f1, b2.f1, b1.f1 >^ b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
+
+-- Intersection point with box
+SELECT b1.f1, b2.f1, b1.f1 # b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
+
+-- Diagonal
+SELECT f1, diagonal(f1) FROM BOX_TBL;
+
+-- Distance to box
+SELECT b1.f1, b2.f1, b1.f1 <-> b2.f1 FROM BOX_TBL b1, BOX_TBL b2;
+
 --
 -- Paths
 --
 
-SELECT '' AS eight, npoints(f1) AS npoints, f1 AS path FROM PATH_TBL;
+-- Points
+SELECT f1, npoints(f1) FROM PATH_TBL;
 
-SELECT '' AS four, path(f1) FROM POLYGON_TBL;
+-- Area
+SELECT f1, area(f1) FROM PATH_TBL;
 
--- translation
-SELECT '' AS eight, p1.f1 + point '(10,10)' AS dist_add
-   FROM PATH_TBL p1;
+-- Length
+SELECT f1, @-@ f1 FROM PATH_TBL;
 
--- scaling and rotation
-SELECT '' AS eight, p1.f1 * point '(2,-1)' AS dist_mul
-   FROM PATH_TBL p1;
+-- Center
+SELECT f1, @@ f1 FROM PATH_TBL;
+
+-- To polygon
+SELECT f1, f1::polygon FROM PATH_TBL WHERE isclosed(f1);
+
+-- Open path cannot be converted to polygon error
+SELECT f1, f1::polygon FROM PATH_TBL WHERE isopen(f1);
+
+-- Has points less than path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 < p2.f1;
+
+-- Has points less than or equal to path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 <= p2.f1;
+
+-- Has points equal to path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 = p2.f1;
+
+-- Has points greater than or equal to path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 >= p2.f1;
+
+-- Has points greater than path
+SELECT p1.f1, p2.f1 FROM PATH_TBL p1, PATH_TBL p2 WHERE p1.f1 > p2.f1;
+
+-- Add path
+SELECT p1.f1, p2.f1, p1.f1 + p2.f1 FROM PATH_TBL p1, PATH_TBL p2;
+
+-- Add point
+SELECT p.f1, p1.f1, p.f1 + p1.f1 FROM PATH_TBL p, POINT_TBL p1;
+
+-- Subtract point
+SELECT p.f1, p1.f1, p.f1 - p1.f1 FROM PATH_TBL p, POINT_TBL p1;
+
+-- Multiply with point
+SELECT p.f1, p1.f1, p.f1 * p1.f1 FROM PATH_TBL p, POINT_TBL p1;
+
+-- Divide by point
+SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1[0] BETWEEN 1 AND 1000;
+
+-- Division by 0 error
+SELECT p.f1, p1.f1, p.f1 / p1.f1 FROM PATH_TBL p, POINT_TBL p1 WHERE p1.f1 ~= '(0,0)'::point;
+
+-- Distance to path
+SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM PATH_TBL p1, PATH_TBL p2;
 
 --
 -- Polygons
 --
 
 -- containment
 SELECT '' AS twentyfour, p.f1, poly.f1, poly.f1 @> p.f1 AS contains
    FROM POLYGON_TBL poly, POINT_TBL p;
 
 SELECT '' AS twentyfour, p.f1, poly.f1, p.f1 <@ poly.f1 AS contained
@@ -118,36 +342,166 @@ SELECT '' AS four, npoints(f1) AS npoints, f1 AS polygon
 SELECT '' AS four, polygon(f1)
    FROM BOX_TBL;
 
 SELECT '' AS four, polygon(f1)
    FROM PATH_TBL WHERE isclosed(f1);
 
 SELECT '' AS four, f1 AS open_path, polygon( pclose(f1)) AS polygon
    FROM PATH_TBL
    WHERE isopen(f1);
 
--- convert circles to polygons using the default number of points
-SELECT '' AS six, polygon(f1)
-   FROM CIRCLE_TBL;
+-- To box
+SELECT f1, f1::box FROM POLYGON_TBL;
 
--- convert the circle to an 8-point polygon
-SELECT '' AS six, polygon(8, f1)
-   FROM CIRCLE_TBL;
+-- To path
+SELECT f1, f1::path FROM POLYGON_TBL;
+
+-- Same as polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 ~= p2.f1;
+
+-- Contained by polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <@ p2.f1;
+
+-- Contains polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 @> p2.f1;
+
+-- Overlap with polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 && p2.f1;
+
+-- Left of polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 << p2.f1;
+
+-- Overlap of left of polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &< p2.f1;
+
+-- Right of polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 >> p2.f1;
+
+-- Overlap of right of polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &> p2.f1;
+
+-- Below polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 <<| p2.f1;
+
+-- Overlap or below polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 &<| p2.f1;
+
+-- Above polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |>> p2.f1;
+
+-- Overlap or above polygon
+SELECT p1.f1, p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2 WHERE p1.f1 |&> p2.f1;
+
+-- Distance to polygon
+SELECT p1.f1, p2.f1, p1.f1 <-> p2.f1 FROM POLYGON_TBL p1, POLYGON_TBL p2;
 
 --
 -- Circles
 --
 
 SELECT '' AS six, circle(f1, 50.0)
    FROM POINT_TBL;
 
 SELECT '' AS four, circle(f1)
    FROM BOX_TBL;
 
 SELECT '' AS two, circle(f1)
    FROM POLYGON_TBL
    WHERE (# f1) >= 3;
 
 SELECT '' AS twentyfour, c1.f1 AS circle, p1.f1 AS point, (p1.f1 <-> c1.f1) AS distance
    FROM CIRCLE_TBL c1, POINT_TBL p1
    WHERE (p1.f1 <-> c1.f1) > 0
    ORDER BY distance, area(c1.f1), p1.f1[0];
+
+-- To polygon
+SELECT f1, f1::polygon FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
+
+-- To polygon with less points
+SELECT f1, polygon(8, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
+
+-- Too less points error
+SELECT f1, polygon(1, f1) FROM CIRCLE_TBL WHERE f1 >= '<(0,0),1>';
+
+-- Zero radius error
+SELECT f1, polygon(10, f1) FROM CIRCLE_TBL WHERE f1 < '<(0,0),1>';
+
+-- Same as circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 ~= c2.f1;
+
+-- Overlap with circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 && c2.f1;
+
+-- Overlap or left of circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &< c2.f1;
+
+-- Left of circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 << c2.f1;
+
+-- Right of circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >> c2.f1;
+
+-- Overlap or right of circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &> c2.f1;
+
+-- Contained by circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <@ c2.f1;
+
+-- Contain by circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 @> c2.f1;
+
+-- Below circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <<| c2.f1;
+
+-- Above circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |>> c2.f1;
+
+-- Overlap or below circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 &<| c2.f1;
+
+-- Overlap or above circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 |&> c2.f1;
+
+-- Area equal with circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 = c2.f1;
+
+-- Area not equal with circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 != c2.f1;
+
+-- Area less than circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
+
+-- Area greater than circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 > c2.f1;
+
+-- Area less than or equal circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 <= c2.f1;
+
+-- Area greater than or equal circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 >= c2.f1;
+
+-- Area less than circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
+
+-- Area greater than circle
+SELECT c1.f1, c2.f1 FROM CIRCLE_TBL c1, CIRCLE_TBL c2 WHERE c1.f1 < c2.f1;
+
+-- Add point
+SELECT c.f1, p.f1, c.f1 + p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
+
+-- Subtract point
+SELECT c.f1, p.f1, c.f1 - p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
+
+-- Multiply with point
+SELECT c.f1, p.f1, c.f1 * p.f1 FROM CIRCLE_TBL c, POINT_TBL p;
+
+-- Divide by point
+SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] BETWEEN 1 AND 1000;
+
+-- Overflow error
+SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1[0] > 1000;
+
+-- Division by 0 error
+SELECT c.f1, p.f1, c.f1 / p.f1 FROM CIRCLE_TBL c, POINT_TBL p WHERE p.f1 ~= '(0,0)'::point;
+
+-- Distance to polygon
+SELECT c.f1, p.f1, c.f1 <-> p.f1 FROM CIRCLE_TBL c, POLYGON_TBL p;
diff --git a/src/test/regress/sql/line.sql b/src/test/regress/sql/line.sql
index 94067b0cee..2353073118 100644
--- a/src/test/regress/sql/line.sql
+++ b/src/test/regress/sql/line.sql
@@ -1,87 +1,39 @@
 --
 -- LINE
 -- Infinite lines
 --
 
 --DROP TABLE LINE_TBL;
 CREATE TABLE LINE_TBL (s line);
 
-INSERT INTO LINE_TBL VALUES ('{1,-1,1}');
-INSERT INTO LINE_TBL VALUES ('(0,0),(6,6)');
+INSERT INTO LINE_TBL VALUES ('{0,-1,5}');	-- A == 0
+INSERT INTO LINE_TBL VALUES ('{1,0,5}');	-- B == 0
+INSERT INTO LINE_TBL VALUES ('{0,3,0}');	-- A == C == 0
+INSERT INTO LINE_TBL VALUES (' (0,0), (6,6)');
 INSERT INTO LINE_TBL VALUES ('10,-10 ,-5,-4');
 INSERT INTO LINE_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
-INSERT INTO LINE_TBL VALUES ('(11,22,33,44)');
 
-INSERT INTO LINE_TBL VALUES ('[(1,0),(1,0)]');
+INSERT INTO LINE_TBL VALUES ('{3,NaN,5}');
+INSERT INTO LINE_TBL VALUES ('{NaN,NaN,NaN}');
 
 -- horizontal
 INSERT INTO LINE_TBL VALUES ('[(1,3),(2,3)]');
 -- vertical
-INSERT INTO LINE_TBL VALUES ('[(3,1),(3,2)]');
+INSERT INTO LINE_TBL VALUES (line(point '(3,1)', point '(3,2)'));
 
 -- bad values for parser testing
+INSERT INTO LINE_TBL VALUES ('{}');
+INSERT INTO LINE_TBL VALUES ('{0');
+INSERT INTO LINE_TBL VALUES ('{0,0}');
+INSERT INTO LINE_TBL VALUES ('{0,0,1');
 INSERT INTO LINE_TBL VALUES ('{0,0,1}');
+INSERT INTO LINE_TBL VALUES ('{0,0,1} x');
 INSERT INTO LINE_TBL VALUES ('(3asdf,2 ,3,4r2)');
 INSERT INTO LINE_TBL VALUES ('[1,2,3, 4');
 INSERT INTO LINE_TBL VALUES ('[(,2),(3,4)]');
 INSERT INTO LINE_TBL VALUES ('[(1,2),(3,4)');
+INSERT INTO LINE_TBL VALUES ('[(1,2),(1,2)]');
+
+INSERT INTO LINE_TBL VALUES (line(point '(1,0)', point '(1,0)'));
 
 select * from LINE_TBL;
-
-
--- functions and operators
-
-SELECT * FROM LINE_TBL WHERE (s <-> line '[(1,2),(3,4)]') < 10;
-
-SELECT * FROM LINE_TBL WHERE (point '(0.1,0.1)' <-> s) < 1;
-
-SELECT * FROM LINE_TBL WHERE (lseg '[(0.1,0.1),(0.2,0.2)]' <-> s) < 1;
-
-SELECT line '[(1,1),(2,1)]' <-> line '[(-1,-1),(-2,-1)]';
-SELECT lseg '[(1,1),(2,1)]' <-> line '[(-1,-1),(-2,-1)]';
-SELECT point '(-1,1)' <-> line '[(-3,0),(-4,0)]';
-
-SELECT lseg '[(1,1),(5,5)]' ?# line '[(2,0),(0,2)]';  -- true
-SELECT lseg '[(1,1),(5,5)]' ?# line '[(0,0),(1,0)]';  -- false
-
-SELECT line '[(0,0),(1,1)]' ?# box '(0,0,2,2)';  -- true
-SELECT line '[(3,0),(4,1)]' ?# box '(0,0,2,2)';  -- false
-
-SELECT point '(1,1)' <@ line '[(0,0),(2,2)]';  -- true
-SELECT point '(1,1)' <@ line '[(0,0),(1,0)]';  -- false
-
-SELECT point '(1,1)' @ line '[(0,0),(2,2)]';  -- true
-SELECT point '(1,1)' @ line '[(0,0),(1,0)]';  -- false
-
-SELECT lseg '[(1,1),(2,2)]' <@ line '[(0,0),(2,2)]';  -- true
-SELECT lseg '[(1,1),(2,1)]' <@ line '[(0,0),(1,0)]';  -- false
-
-SELECT lseg '[(1,1),(2,2)]' @ line '[(0,0),(2,2)]';  -- true
-SELECT lseg '[(1,1),(2,1)]' @ line '[(0,0),(1,0)]';  -- false
-
-SELECT point '(0,1)' ## line '[(0,0),(1,1)]';
-
-SELECT line '[(0,0),(1,1)]' ## lseg '[(1,0),(2,0)]';
-
-SELECT line '[(0,0),(1,1)]' ?# line '[(1,0),(2,1)]';  -- false
-SELECT line '[(0,0),(1,1)]' ?# line '[(1,0),(1,1)]';  -- true
-
-SELECT line '[(0,0),(1,1)]' # line '[(1,0),(2,1)]';
-SELECT line '[(0,0),(1,1)]' # line '[(1,0),(1,1)]';
-
-SELECT line '[(0,0),(1,1)]' ?|| line '[(1,0),(2,1)]';  -- true
-SELECT line '[(0,0),(1,1)]' ?|| line '[(1,0),(1,1)]';  -- false
-
-SELECT line '[(0,0),(1,0)]' ?-| line '[(0,0),(0,1)]';  -- true
-SELECT line '[(0,0),(1,1)]' ?-| line '[(1,0),(1,1)]';  -- false
-
-SELECT ?- line '[(0,0),(1,0)]';  -- true
-SELECT ?- line '[(0,0),(1,1)]';  -- false
-
-SELECT ?| line '[(0,0),(0,1)]';  -- true
-SELECT ?| line '[(0,0),(1,1)]';  -- false
-
-SELECT line(point '(1,2)', point '(3,4)');
-
-SELECT line '[(1,2),(3,4)]' = line '[(3,4),(4,5)]';  -- true
-SELECT line '[(1,2),(3,4)]' = line '[(3,4),(4,4)]';  -- false
diff --git a/src/test/regress/sql/lseg.sql b/src/test/regress/sql/lseg.sql
index 07c5a29e0a..f266ca3e09 100644
--- a/src/test/regress/sql/lseg.sql
+++ b/src/test/regress/sql/lseg.sql
@@ -3,23 +3,22 @@
 -- Line segments
 --
 
 --DROP TABLE LSEG_TBL;
 CREATE TABLE LSEG_TBL (s lseg);
 
 INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)]');
 INSERT INTO LSEG_TBL VALUES ('(0,0),(6,6)');
 INSERT INTO LSEG_TBL VALUES ('10,-10 ,-3,-4');
 INSERT INTO LSEG_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
-INSERT INTO LSEG_TBL VALUES ('(11,22,33,44)');
+INSERT INTO LSEG_TBL VALUES (lseg(point(11, 22), point(33,44)));
+INSERT INTO LSEG_TBL VALUES ('[(-10,2),(-10,3)]');	-- vertical
+INSERT INTO LSEG_TBL VALUES ('[(0,-20),(30,-20)]');	-- horizontal
+INSERT INTO LSEG_TBL VALUES ('[(NaN,1),(NaN,90)]');	-- NaN
 
 -- bad values for parser testing
 INSERT INTO LSEG_TBL VALUES ('(3asdf,2 ,3,4r2)');
 INSERT INTO LSEG_TBL VALUES ('[1,2,3, 4');
 INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]');
 INSERT INTO LSEG_TBL VALUES ('[(1,2),(3,4)');
 
 select * from LSEG_TBL;
-
-SELECT * FROM LSEG_TBL WHERE s <= lseg '[(1,2),(3,4)]';
-
-SELECT * FROM LSEG_TBL WHERE (s <-> lseg '[(1,2),(3,4)]') < 10;
diff --git a/src/test/regress/sql/path.sql b/src/test/regress/sql/path.sql
index 7e69b539ad..318decf974 100644
--- a/src/test/regress/sql/path.sql
+++ b/src/test/regress/sql/path.sql
@@ -1,38 +1,44 @@
 --
 -- PATH
 --
 
 --DROP TABLE PATH_TBL;
 
 CREATE TABLE PATH_TBL (f1 path);
 
 INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]');
 
-INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))');
+INSERT INTO PATH_TBL VALUES (' ( ( 1 , 2 ) , ( 3 , 4 ) ) ');
 
-INSERT INTO PATH_TBL VALUES ('[(0,0),(3,0),(4,5),(1,6)]');
+INSERT INTO PATH_TBL VALUES ('[ (0,0),(3,0),(4,5),(1,6) ]');
 
-INSERT INTO PATH_TBL VALUES ('((1,2),(3,4))');
+INSERT INTO PATH_TBL VALUES ('((1,2) ,(3,4 ))');
 
-INSERT INTO PATH_TBL VALUES ('1,2 ,3,4');
+INSERT INTO PATH_TBL VALUES ('1,2 ,3,4 ');
 
-INSERT INTO PATH_TBL VALUES ('[1,2,3, 4]');
+INSERT INTO PATH_TBL VALUES (' [1,2,3, 4] ');
 
-INSERT INTO PATH_TBL VALUES ('[11,12,13,14]');
+INSERT INTO PATH_TBL VALUES ('((10,20))');	-- Only one point
 
-INSERT INTO PATH_TBL VALUES ('(11,12,13,14)');
+INSERT INTO PATH_TBL VALUES ('[ 11,12,13,14 ]');
+
+INSERT INTO PATH_TBL VALUES ('( 11,12,13,14) ');
 
 -- bad values for parser testing
+INSERT INTO PATH_TBL VALUES ('[]');
+
 INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]');
 
 INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)');
 
-SELECT f1 FROM PATH_TBL;
+INSERT INTO PATH_TBL VALUES ('(1,2,3,4');
+
+INSERT INTO PATH_TBL VALUES ('(1,2),(3,4)]');
 
 SELECT '' AS count, f1 AS open_path FROM PATH_TBL WHERE isopen(f1);
 
 SELECT '' AS count, f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1);
 
 SELECT '' AS count, pclose(f1) AS closed_path FROM PATH_TBL;
 
 SELECT '' AS count, popen(f1) AS open_path FROM PATH_TBL;
diff --git a/src/test/regress/sql/point.sql b/src/test/regress/sql/point.sql
index 63a803a809..a209f3bfeb 100644
--- a/src/test/regress/sql/point.sql
+++ b/src/test/regress/sql/point.sql
@@ -7,29 +7,39 @@ CREATE TABLE POINT_TBL(f1 point);
 INSERT INTO POINT_TBL(f1) VALUES ('(0.0,0.0)');
 
 INSERT INTO POINT_TBL(f1) VALUES ('(-10.0,0.0)');
 
 INSERT INTO POINT_TBL(f1) VALUES ('(-3.0,4.0)');
 
 INSERT INTO POINT_TBL(f1) VALUES ('(5.1, 34.5)');
 
 INSERT INTO POINT_TBL(f1) VALUES ('(-5.0,-12.0)');
 
+INSERT INTO POINT_TBL(f1) VALUES ('(1e-300,-1e-300)');	-- To underflow
+
+INSERT INTO POINT_TBL(f1) VALUES ('(1e+300,Inf)');		-- To overflow
+
+INSERT INTO POINT_TBL(f1) VALUES (' ( Nan , NaN ) ');
+
 -- bad format points
 INSERT INTO POINT_TBL(f1) VALUES ('asdfasdf');
 
 INSERT INTO POINT_TBL(f1) VALUES ('10.0,10.0');
 
 INSERT INTO POINT_TBL(f1) VALUES ('(10.0 10.0)');
 
+INSERT INTO POINT_TBL(f1) VALUES ('(10.0, 10.0) x');
+
 INSERT INTO POINT_TBL(f1) VALUES ('(10.0,10.0');
 
+INSERT INTO POINT_TBL(f1) VALUES ('(10.0, 1e+500)');	-- Out of range
+
 
 SELECT '' AS six, * FROM POINT_TBL;
 
 -- left of
 SELECT '' AS three, p.* FROM POINT_TBL p WHERE p.f1 << '(0.0, 0.0)';
 
 -- right of
 SELECT '' AS three, p.* FROM POINT_TBL p WHERE '(0.0,0.0)' >> p.f1;
 
 -- above
diff --git a/src/test/regress/sql/polygon.sql b/src/test/regress/sql/polygon.sql
index 7e8cb08cd8..d3d2fe3457 100644
--- a/src/test/regress/sql/polygon.sql
+++ b/src/test/regress/sql/polygon.sql
@@ -4,126 +4,43 @@
 -- polygon logic
 --
 
 CREATE TABLE POLYGON_TBL(f1 polygon);
 
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('(2.0,0.0),(2.0,4.0),(0.0,0.0)');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('(3.0,1.0),(3.0,3.0),(1.0,0.0)');
 
+INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(3,4),(5,6),(7,8)');
+INSERT INTO POLYGON_TBL(f1) VALUES ('(7,8),(5,6),(3,4),(1,2)'); -- Reverse
+INSERT INTO POLYGON_TBL(f1) VALUES ('(1,2),(7,8),(5,6),(3,-4)');
+
 -- degenerate polygons
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,0.0)');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0,1.0),(0.0,1.0)');
 
 -- bad polygon input strings
 INSERT INTO POLYGON_TBL(f1) VALUES ('0.0');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0.0 0.0');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2)');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('(0,1,2,3');
 
 INSERT INTO POLYGON_TBL(f1) VALUES ('asdf');
 
 
 SELECT '' AS four, * FROM POLYGON_TBL;
 
--- overlap
-SELECT '' AS three, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 && '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
-
--- left overlap
-SELECT '' AS four, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 &< '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
-
--- right overlap
-SELECT '' AS two, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 &> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
-
--- left of
-SELECT '' AS one, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 << '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
-
--- right of
-SELECT '' AS zero, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 >> '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
-
--- contained
-SELECT '' AS one, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
-
--- same
-SELECT '' AS one, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
-
--- contains
-SELECT '' AS one, p.*
-   FROM POLYGON_TBL p
-   WHERE p.f1 @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)';
-
---
--- polygon logic
---
--- left of
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
-
--- left overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' << polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
-
--- right overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' &> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
-
--- right of
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' >> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
-
--- contained in
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' <@ polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
-
--- contains
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' @> polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
-
-SELECT '((0,4),(6,4),(1,2),(6,0),(0,0))'::polygon @> '((2,1),(2,3),(3,3),(3,1))'::polygon AS "false";
-
-SELECT '((0,4),(6,4),(3,2),(6,0),(0,0))'::polygon @> '((2,1),(2,3),(3,3),(3,1))'::polygon AS "true";
-
-SELECT '((1,1),(1,4),(5,4),(5,3),(2,3),(2,2),(5,2),(5,1))'::polygon @> '((3,2),(3,3),(4,3),(4,2))'::polygon AS "false";
-
-SELECT '((0,0),(0,3),(3,3),(3,0))'::polygon @> '((2,1),(2,2),(3,2),(3,1))'::polygon AS "true";
-
--- same
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' ~= polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS false;
-
--- overlap
-SELECT polygon '(2.0,0.0),(2.0,4.0),(0.0,0.0)' && polygon '(3.0,1.0),(3.0,3.0),(1.0,0.0)' AS true;
-
-SELECT '((0,4),(6,4),(1,2),(6,0),(0,0))'::polygon && '((2,1),(2,3),(3,3),(3,1))'::polygon AS "true";
-
-SELECT '((1,4),(1,1),(4,1),(4,2),(2,2),(2,4),(1,4))'::polygon && '((3,3),(4,3),(4,4),(3,4),(3,3))'::polygon AS "false";
-SELECT '((200,800),(800,800),(800,200),(200,200))' &&  '(1000,1000,0,0)'::polygon AS "true";
-
--- distance from a point
-SELECT	'(0,0)'::point <-> '((0,0),(1,2),(2,1))'::polygon as on_corner,
-	'(1,1)'::point <-> '((0,0),(2,2),(1,3))'::polygon as on_segment,
-	'(2,2)'::point <-> '((0,0),(1,4),(3,1))'::polygon as inside,
-	'(3,3)'::point <-> '((0,2),(2,0),(2,2))'::polygon as near_corner,
-	'(4,4)'::point <-> '((0,0),(0,3),(4,0))'::polygon as near_segment;
-
 --
 -- Test the SP-GiST index
 --
 
 CREATE TABLE quad_poly_tbl (id int, p polygon);
 
 INSERT INTO quad_poly_tbl
 	SELECT (x - 1) * 100 + y, polygon(circle(point(x * 10, y * 10), 1 + (x + y) % 10))
 	FROM generate_series(1, 100) x,
 		 generate_series(1, 100) y;
-- 
2.14.3 (Apple Git-98)

