1-- 2-- PATH 3-- 4--DROP TABLE PATH_TBL; 5CREATE TABLE PATH_TBL (f1 path); 6INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)]'); 7INSERT INTO PATH_TBL VALUES (' ( ( 1 , 2 ) , ( 3 , 4 ) ) '); 8INSERT INTO PATH_TBL VALUES ('[ (0,0),(3,0),(4,5),(1,6) ]'); 9INSERT INTO PATH_TBL VALUES ('((1,2) ,(3,4 ))'); 10INSERT INTO PATH_TBL VALUES ('1,2 ,3,4 '); 11INSERT INTO PATH_TBL VALUES (' [1,2,3, 4] '); 12INSERT INTO PATH_TBL VALUES ('((10,20))'); -- Only one point 13INSERT INTO PATH_TBL VALUES ('[ 11,12,13,14 ]'); 14INSERT INTO PATH_TBL VALUES ('( 11,12,13,14) '); 15-- bad values for parser testing 16INSERT INTO PATH_TBL VALUES ('[]'); 17ERROR: invalid input syntax for type path: "[]" 18LINE 1: INSERT INTO PATH_TBL VALUES ('[]'); 19 ^ 20INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]'); 21ERROR: invalid input syntax for type path: "[(,2),(3,4)]" 22LINE 1: INSERT INTO PATH_TBL VALUES ('[(,2),(3,4)]'); 23 ^ 24INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)'); 25ERROR: invalid input syntax for type path: "[(1,2),(3,4)" 26LINE 1: INSERT INTO PATH_TBL VALUES ('[(1,2),(3,4)'); 27 ^ 28INSERT INTO PATH_TBL VALUES ('(1,2,3,4'); 29ERROR: invalid input syntax for type path: "(1,2,3,4" 30LINE 1: INSERT INTO PATH_TBL VALUES ('(1,2,3,4'); 31 ^ 32INSERT INTO PATH_TBL VALUES ('(1,2),(3,4)]'); 33ERROR: invalid input syntax for type path: "(1,2),(3,4)]" 34LINE 1: INSERT INTO PATH_TBL VALUES ('(1,2),(3,4)]'); 35 ^ 36SELECT f1 AS open_path FROM PATH_TBL WHERE isopen(f1); 37 open_path 38--------------------------- 39 [(1,2),(3,4)] 40 [(0,0),(3,0),(4,5),(1,6)] 41 [(1,2),(3,4)] 42 [(11,12),(13,14)] 43(4 rows) 44 45SELECT f1 AS closed_path FROM PATH_TBL WHERE isclosed(f1); 46 closed_path 47------------------- 48 ((1,2),(3,4)) 49 ((1,2),(3,4)) 50 ((1,2),(3,4)) 51 ((10,20)) 52 ((11,12),(13,14)) 53(5 rows) 54 55SELECT pclose(f1) AS closed_path FROM PATH_TBL; 56 closed_path 57--------------------------- 58 ((1,2),(3,4)) 59 ((1,2),(3,4)) 60 ((0,0),(3,0),(4,5),(1,6)) 61 ((1,2),(3,4)) 62 ((1,2),(3,4)) 63 ((1,2),(3,4)) 64 ((10,20)) 65 ((11,12),(13,14)) 66 ((11,12),(13,14)) 67(9 rows) 68 69SELECT popen(f1) AS open_path FROM PATH_TBL; 70 open_path 71--------------------------- 72 [(1,2),(3,4)] 73 [(1,2),(3,4)] 74 [(0,0),(3,0),(4,5),(1,6)] 75 [(1,2),(3,4)] 76 [(1,2),(3,4)] 77 [(1,2),(3,4)] 78 [(10,20)] 79 [(11,12),(13,14)] 80 [(11,12),(13,14)] 81(9 rows) 82 83