summaryrefslogtreecommitdiff
path: root/src/test/regress/expected/lseg.out
blob: f2f4367e8c8f47f5d9496f0c6a47428206a58466 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
--
-- 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)');
-- 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)]');
ERROR:  invalid input syntax for type lseg: "[(,2),(3,4)]"
LINE 1: INSERT INTO LSEG_TBL VALUES ('[(,2),(3,4)]');
                                     ^
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)');
                                     ^
select * from LSEG_TBL ORDER BY (s[0])[0], (s[0])[1];
               s               
-------------------------------
 [(-1000000,200),(300000,-40)]
 [(0,0),(6,6)]
 [(1,2),(3,4)]
 [(10,-10),(-3,-4)]
 [(11,22),(33,44)]
(5 rows)

SELECT * FROM LSEG_TBL WHERE s <= lseg '[(1,2),(3,4)]' ORDER BY (s[0])[0], (s[0])[1];
       s       
---------------
 [(1,2),(3,4)]
(1 row)

SELECT * FROM LSEG_TBL WHERE (s <-> lseg '[(1,2),(3,4)]') < 10 ORDER BY (s[0])[0], (s[0])[1];
         s          
--------------------
 [(0,0),(6,6)]
 [(1,2),(3,4)]
 [(10,-10),(-3,-4)]
(3 rows)