]> granicus.if.org Git - postgresql/blob - src/test/regress/expected/line.out
Tweak "line" test to avoid platform-specific floating-point output
[postgresql] / src / test / regress / expected / line.out
1 --
2 -- LINE
3 -- Infinite lines
4 --
5 --DROP TABLE LINE_TBL;
6 CREATE TABLE LINE_TBL (s line);
7 INSERT INTO LINE_TBL VALUES ('{1,-1,1}');
8 INSERT INTO LINE_TBL VALUES ('(0,0),(6,6)');
9 INSERT INTO LINE_TBL VALUES ('10,-10 ,-5,-4');
10 INSERT INTO LINE_TBL VALUES ('[-1e6,2e2,3e5, -4e1]');
11 INSERT INTO LINE_TBL VALUES ('(11,22,33,44)');
12 INSERT INTO LINE_TBL VALUES ('[(1,0),(1,0)]');
13 ERROR:  invalid line specification: must be two distinct points
14 LINE 1: INSERT INTO LINE_TBL VALUES ('[(1,0),(1,0)]');
15                                      ^
16 -- horizontal
17 INSERT INTO LINE_TBL VALUES ('[(1,3),(2,3)]');
18 -- vertical
19 INSERT INTO LINE_TBL VALUES ('[(3,1),(3,2)]');
20 -- bad values for parser testing
21 INSERT INTO LINE_TBL VALUES ('{0,0,1}');
22 ERROR:  invalid line specification: A and B cannot both be zero
23 LINE 1: INSERT INTO LINE_TBL VALUES ('{0,0,1}');
24                                      ^
25 INSERT INTO LINE_TBL VALUES ('(3asdf,2 ,3,4r2)');
26 ERROR:  invalid input syntax for type line: "(3asdf,2 ,3,4r2)"
27 LINE 1: INSERT INTO LINE_TBL VALUES ('(3asdf,2 ,3,4r2)');
28                                      ^
29 INSERT INTO LINE_TBL VALUES ('[1,2,3, 4');
30 ERROR:  invalid input syntax for type line: "[1,2,3, 4"
31 LINE 1: INSERT INTO LINE_TBL VALUES ('[1,2,3, 4');
32                                      ^
33 INSERT INTO LINE_TBL VALUES ('[(,2),(3,4)]');
34 ERROR:  invalid input syntax for type line: "[(,2),(3,4)]"
35 LINE 1: INSERT INTO LINE_TBL VALUES ('[(,2),(3,4)]');
36                                      ^
37 INSERT INTO LINE_TBL VALUES ('[(1,2),(3,4)');
38 ERROR:  invalid input syntax for type line: "[(1,2),(3,4)"
39 LINE 1: INSERT INTO LINE_TBL VALUES ('[(1,2),(3,4)');
40                                      ^
41 select * from LINE_TBL;
42                       s                      
43 ---------------------------------------------
44  {1,-1,1}
45  {1,-1,0}
46  {-0.4,-1,-6}
47  {-0.000184615384615385,-1,15.3846153846154}
48  {1,-1,11}
49  {0,-1,3}
50  {-1,0,3}
51 (7 rows)
52
53 -- functions and operators
54 SELECT * FROM LINE_TBL WHERE (s <-> line '[(1,2),(3,4)]') < 10;
55                       s                      
56 ---------------------------------------------
57  {1,-1,1}
58  {1,-1,0}
59  {-0.4,-1,-6}
60  {-0.000184615384615385,-1,15.3846153846154}
61  {1,-1,11}
62  {0,-1,3}
63  {-1,0,3}
64 (7 rows)
65
66 SELECT * FROM LINE_TBL WHERE (point '(0.1,0.1)' <-> s) < 1;
67     s     
68 ----------
69  {1,-1,1}
70  {1,-1,0}
71 (2 rows)
72
73 SELECT * FROM LINE_TBL WHERE (lseg '[(0.1,0.1),(0.2,0.2)]' <-> s) < 1;
74     s     
75 ----------
76  {1,-1,1}
77  {1,-1,0}
78 (2 rows)
79
80 SELECT line '[(1,1),(2,1)]' <-> line '[(-1,-1),(-2,-1)]';
81  ?column? 
82 ----------
83         2
84 (1 row)
85
86 SELECT lseg '[(1,1),(2,1)]' <-> line '[(-1,-1),(-2,-1)]';
87  ?column? 
88 ----------
89         2
90 (1 row)
91
92 SELECT point '(-1,1)' <-> line '[(-3,0),(-4,0)]';
93  ?column? 
94 ----------
95         1
96 (1 row)
97
98 SELECT lseg '[(1,1),(5,5)]' ?# line '[(2,0),(0,2)]';  -- true
99  ?column? 
100 ----------
101  t
102 (1 row)
103
104 SELECT lseg '[(1,1),(5,5)]' ?# line '[(0,0),(1,0)]';  -- false
105  ?column? 
106 ----------
107  f
108 (1 row)
109
110 SELECT line '[(0,0),(1,1)]' ?# box '(0,0,2,2)';  -- true
111  ?column? 
112 ----------
113  t
114 (1 row)
115
116 SELECT line '[(3,0),(4,1)]' ?# box '(0,0,2,2)';  -- false
117  ?column? 
118 ----------
119  f
120 (1 row)
121
122 SELECT point '(1,1)' <@ line '[(0,0),(2,2)]';  -- true
123  ?column? 
124 ----------
125  t
126 (1 row)
127
128 SELECT point '(1,1)' <@ line '[(0,0),(1,0)]';  -- false
129  ?column? 
130 ----------
131  f
132 (1 row)
133
134 SELECT point '(1,1)' @ line '[(0,0),(2,2)]';  -- true
135  ?column? 
136 ----------
137  t
138 (1 row)
139
140 SELECT point '(1,1)' @ line '[(0,0),(1,0)]';  -- false
141  ?column? 
142 ----------
143  f
144 (1 row)
145
146 SELECT lseg '[(1,1),(2,2)]' <@ line '[(0,0),(2,2)]';  -- true
147  ?column? 
148 ----------
149  t
150 (1 row)
151
152 SELECT lseg '[(1,1),(2,1)]' <@ line '[(0,0),(1,0)]';  -- false
153  ?column? 
154 ----------
155  f
156 (1 row)
157
158 SELECT lseg '[(1,1),(2,2)]' @ line '[(0,0),(2,2)]';  -- true
159  ?column? 
160 ----------
161  t
162 (1 row)
163
164 SELECT lseg '[(1,1),(2,1)]' @ line '[(0,0),(1,0)]';  -- false
165  ?column? 
166 ----------
167  f
168 (1 row)
169
170 SELECT point '(0,1)' ## line '[(0,0),(1,1)]';
171  ?column?  
172 -----------
173  (0.5,0.5)
174 (1 row)
175
176 SELECT line '[(0,0),(1,1)]' ## lseg '[(1,0),(2,0)]';
177  ?column? 
178 ----------
179  (1,0)
180 (1 row)
181
182 SELECT line '[(0,0),(1,1)]' ?# line '[(1,0),(2,1)]';  -- false
183  ?column? 
184 ----------
185  f
186 (1 row)
187
188 SELECT line '[(0,0),(1,1)]' ?# line '[(1,0),(1,1)]';  -- true
189  ?column? 
190 ----------
191  t
192 (1 row)
193
194 SELECT line '[(0,0),(1,1)]' # line '[(1,0),(2,1)]';
195  ?column? 
196 ----------
197  
198 (1 row)
199
200 SELECT line '[(0,0),(1,1)]' # line '[(1,0),(1,1)]';
201  ?column? 
202 ----------
203  (1,1)
204 (1 row)
205
206 SELECT line '[(0,0),(1,1)]' ?|| line '[(1,0),(2,1)]';  -- true
207  ?column? 
208 ----------
209  t
210 (1 row)
211
212 SELECT line '[(0,0),(1,1)]' ?|| line '[(1,0),(1,1)]';  -- false
213  ?column? 
214 ----------
215  f
216 (1 row)
217
218 SELECT line '[(0,0),(1,0)]' ?-| line '[(0,0),(0,1)]';  -- true
219  ?column? 
220 ----------
221  t
222 (1 row)
223
224 SELECT line '[(0,0),(1,1)]' ?-| line '[(1,0),(1,1)]';  -- false
225  ?column? 
226 ----------
227  f
228 (1 row)
229
230 SELECT ?- line '[(0,0),(1,0)]';  -- true
231  ?column? 
232 ----------
233  t
234 (1 row)
235
236 SELECT ?- line '[(0,0),(1,1)]';  -- false
237  ?column? 
238 ----------
239  f
240 (1 row)
241
242 SELECT ?| line '[(0,0),(0,1)]';  -- true
243  ?column? 
244 ----------
245  t
246 (1 row)
247
248 SELECT ?| line '[(0,0),(1,1)]';  -- false
249  ?column? 
250 ----------
251  f
252 (1 row)
253
254 SELECT line(point '(1,2)', point '(3,4)');
255    line   
256 ----------
257  {1,-1,1}
258 (1 row)
259
260 SELECT line '[(1,2),(3,4)]' = line '[(3,4),(4,5)]';  -- true
261  ?column? 
262 ----------
263  t
264 (1 row)
265
266 SELECT line '[(1,2),(3,4)]' = line '[(3,4),(4,4)]';  -- false
267  ?column? 
268 ----------
269  f
270 (1 row)
271