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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
|
SET @tmp=ST_GIS_DEBUG(1);
DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN
DECLARE g GEOMETRY;
SET g=GeomFromText(geom);
SELECT geom AS `-----`;
SELECT dist, GeometryType(@buf:=ST_Buffer(g, dist)) AS `buffer`, ROUND(ST_AREA(@buf),2) AS buf_area;
END|
#
# Testing ST_BUFFER with positive distance
#
-----
POINT(0 0))
dist buffer buf_area
1 POLYGON 3.14
-----
LineString(0 1, 1 1))
dist buffer buf_area
1 POLYGON 5.14
-----
LineString(9 9,8 1,1 5,0 0)
dist buffer buf_area
1 POLYGON 44.63
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist buffer buf_area
1 POLYGON 63.14
-----
Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))
dist buffer buf_area
1 POLYGON 95.14
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist buffer buf_area
1 POLYGON 174.93
-----
MultiPoint(9 9,8 1,1 5)
dist buffer buf_area
1 MULTIPOLYGON 9.42
-----
MultiLineString((0 0,2 2))
dist buffer buf_area
1 POLYGON 8.80
-----
MultiLineString((0 0,2 2,0 4))
dist buffer buf_area
1 POLYGON 14.24
-----
MultiLineString((0 0,2 2),(0 2,2 0))
dist buffer buf_area
1 POLYGON 13.59
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
dist buffer buf_area
1 MULTIPOLYGON 70.06
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))
dist buffer buf_area
1 POLYGON 73.18
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))
dist buffer buf_area
1 POLYGON 73.18
-----
GeometryCollection(Point(0 0))
dist buffer buf_area
1 POLYGON 3.14
-----
GeometryCollection(LineString(0 0, 2 2)))
dist buffer buf_area
1 POLYGON 8.80
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))
dist buffer buf_area
1 POLYGON 63.14
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
dist buffer buf_area
1 MULTIPOLYGON 9.42
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
dist buffer buf_area
1 MULTIPOLYGON 10.28
-----
GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6))))
dist buffer buf_area
1 MULTIPOLYGON 48.28
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
dist buffer buf_area
1 POLYGON 75.92
#
# Testing ST_BUFFER with zero distance
#
-----
POINT(0 0))
dist buffer buf_area
0 POINT 0.00
-----
LineString(0 1, 1 1))
dist buffer buf_area
0 LINESTRING 0.00
-----
LineString(9 9,8 1,1 5,0 0)
dist buffer buf_area
0 LINESTRING 0.00
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist buffer buf_area
0 POLYGON 36.00
-----
Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2))
dist buffer buf_area
0 POLYGON 48.00
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist buffer buf_area
0 POLYGON 116.00
-----
MultiPoint(9 9,8 1,1 5)
dist buffer buf_area
0 MULTIPOINT NULL
-----
MultiLineString((0 0,2 2))
dist buffer buf_area
0 MULTILINESTRING NULL
-----
MultiLineString((0 0,2 2,0 4))
dist buffer buf_area
0 MULTILINESTRING NULL
-----
MultiLineString((0 0,2 2),(0 2,2 0))
dist buffer buf_area
0 MULTILINESTRING NULL
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
dist buffer buf_area
0 MULTILINESTRING NULL
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9)))
dist buffer buf_area
0 MULTIPOLYGON 66.00
-----
MultiPolygon(((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)),((9 9,8 1,1 5,9 9)))
dist buffer buf_area
0 MULTIPOLYGON 62.00
-----
GeometryCollection(Point(0 0))
dist buffer buf_area
0 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(LineString(0 0, 2 2)))
dist buffer buf_area
0 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))
dist buffer buf_area
0 GEOMETRYCOLLECTION 36.00
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
dist buffer buf_area
0 GEOMETRYCOLLECTION NULL
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
dist buffer buf_area
0 GEOMETRYCOLLECTION NULL
-----
GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6))))
dist buffer buf_area
0 GEOMETRYCOLLECTION 18.00
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
dist buffer buf_area
0 GEOMETRYCOLLECTION 36.00
#
# Testing ST_BUFFER with negative distance
#
-----
POINT(0 0))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
LineString(0 1, 1 1))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
LineString(9 9,8 1,1 5,0 0)
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist buffer buf_area
-1 POLYGON 16.00
-----
MultiPoint(9 9,8 1,1 5)
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
MultiLineString((0 0,2 2))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
MultiLineString((0 0,2 2,0 4))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
MultiLineString((0 0,2 2),(0 2,2 0))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(Point(0 0))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(LineString(0 0, 2 2)))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))))
dist buffer buf_area
-1 POLYGON 16.00
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
dist buffer buf_area
-1 GEOMETRYCOLLECTION 0.00
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
dist buffer buf_area
-1 POLYGON 16.00
SELECT ST_CONTAINS(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)'));
ST_CONTAINS(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)'))
0
SELECT AsText(ST_UNION(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)')));
AsText(ST_UNION(
GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
GeomFromText('POINT(5 10)')))
GEOMETRYCOLLECTION(POLYGON((0 0,0 5,5 5,5 0,0 0)),POLYGON((6 6,6 11,11 11,11 6,6 6)),POINT(5 10))
DROP PROCEDURE p1;
#
# Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE
#
SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3));
GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3))
POLYGON
#
# Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL
#
SELECT GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1));
GeometryType(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2), (4 4,4 6,6 6,6 4,4 4)), ((9 9,8 1,1 5,9 9)))'),1))
POLYGON
#
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),'');
Warnings:
Warning 1292 Truncated incorrect DOUBLE value: ''
SELECT ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) '),
ST_NUMINTERIORRINGS(POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) '))));
ST_WITHIN(
LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
ST_BUFFER(MULTIPOLYGONFROMTEXT(' MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5)),((2 2,2 8,8 8,8 2,2 2),(4 4,4 6,6 6,6 4,4 4)),((0 5,3 5,3 2,1 2,1 1,3 1,3 0,0 0,0 3,2 3,2 4,0 4,0 5))) ')
0
SELECT ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))));
ST_DIMENSION(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))))
2
SELECT ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))));
ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
SRID(MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))))
0
SELECT ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))));
ASTEXT(ST_BUFFER(POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
SRID(GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))))
POLYGON((9 9,5 2,4 5,9 9))
#
# Start of 10.2 tests
#
#
# MDEV-10134 Add full support for DEFAULT
#
CREATE TABLE t1 (a INT DEFAULT ST_GIS_DEBUG(1));
ERROR HY000: Function or expression 'st_gis_debug()' cannot be used in the DEFAULT clause of `a`
#
# End of 10.2 tests
#
#
# Start of 10.3 tests
#
#
# Comparison data type aggregation for pluggable data types
#
SET SESSION debug_dbug="+d,Item_func_in";
SET SESSION debug_dbug="+d,Predicant_to_list_comparator";
CREATE TABLE t1 (a POINT);
INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3));
SELECT COUNT(*) FROM t1 WHERE a IN (POINT(1,1),POINT(10,20),POINT(10,30));
COUNT(*)
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (geometry)
Note 1105 DBUG: [1] arg=2 handler=0 (geometry)
Note 1105 DBUG: [2] arg=3 handler=0 (geometry)
Note 1105 DBUG: types_compatible=yes bisect=yes
SELECT COUNT(*) FROM t1 WHERE a IN (POINT(1,1),POINT(10,20),POINT(10,30),'test');
COUNT(*)
1
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (geometry)
Note 1105 DBUG: [1] arg=2 handler=0 (geometry)
Note 1105 DBUG: [2] arg=3 handler=0 (geometry)
Note 1105 DBUG: [3] arg=4 handler=3 (longblob)
Note 1105 DBUG: types_compatible=no bisect=no
SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1');
COUNT(*)
0
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (longblob)
Note 1105 DBUG: [1] arg=2 handler=0 (longblob)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
CREATE TABLE t1 (a TEXT);
INSERT INTO t1 VALUES ('test'),('test1'),('test2');
SELECT * FROM t1 WHERE a IN ('test',POINT(1,1));
a
test
Warnings:
Note 1105 DBUG: [0] arg=1 handler=0 (longblob)
Note 1105 DBUG: [1] arg=2 handler=0 (longblob)
Note 1105 DBUG: types_compatible=yes bisect=yes
DROP TABLE t1;
SET SESSION debug_dbug="-d,Predicant_to_list_comparator";
SET SESSION debug_dbug="-d,Item_func_in";
#
# MDEV-12238 Add Type_handler::Item_func_{plus|minus|mul|div|mod}_fix_length_and_dec()
#
SET debug_dbug='+d,num_op';
CREATE TABLE t1 AS SELECT
POINT(0,0)+POINT(0,0),
POINT(0,0)-POINT(0,0),
POINT(0,0)*POINT(0,0),
POINT(0,0)/POINT(0,0),
POINT(0,0) MOD POINT(0,0) LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`POINT(0,0)+POINT(0,0)` geometry DEFAULT NULL,
`POINT(0,0)-POINT(0,0)` geometry DEFAULT NULL,
`POINT(0,0)*POINT(0,0)` geometry DEFAULT NULL,
`POINT(0,0)/POINT(0,0)` geometry DEFAULT NULL,
`POINT(0,0) MOD POINT(0,0)` geometry DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
POINT(0,0)+'0',
POINT(0,0)-'0',
POINT(0,0)*'0',
POINT(0,0)/'0',
POINT(0,0) MOD '0' LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`POINT(0,0)+'0'` tinytext DEFAULT NULL,
`POINT(0,0)-'0'` tinytext DEFAULT NULL,
`POINT(0,0)*'0'` tinytext DEFAULT NULL,
`POINT(0,0)/'0'` tinytext DEFAULT NULL,
`POINT(0,0) MOD '0'` tinytext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT
'0'+POINT(0,0),
'0'*POINT(0,0) LIMIT 0;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`'0'+POINT(0,0)` tinytext DEFAULT NULL,
`'0'*POINT(0,0)` tinytext DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE TABLE t1 AS SELECT '0'-POINT(0,0) LIMIT 0;
ERROR HY000: Illegal parameter data types varchar and geometry for operation '-'
CREATE TABLE t1 AS SELECT '0'/POINT(0,0) LIMIT 0;
ERROR HY000: Illegal parameter data types varchar and geometry for operation '/'
CREATE TABLE t1 AS SELECT '0' MOD POINT(0,0) LIMIT 0;
ERROR HY000: Illegal parameter data types varchar and geometry for operation 'MOD'
SET debug_dbug='-d,num_op';
|