1DROP TABLE IF EXISTS p1; 2CREATE PROCEDURE p1(dist DOUBLE, geom TEXT) 3BEGIN 4DECLARE g GEOMETRY; 5SET g=ST_GeomFromText(geom); 6SELECT geom AS `-----`; 7SELECT dist, ST_GeometryType(@buf:=ST_Buffer(g, dist)) AS `buffer`, ROUND(ST_AREA(@buf),2) AS buf_area; 8END| 9# 10# Testing ST_BUFFER with positive distance 11# 12ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 13----- 14POINT(0 0) 15dist buffer buf_area 161 POLYGON 3.12 17ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 18----- 19LineString(0 1, 1 1) 20dist buffer buf_area 211 POLYGON 5.12 22----- 23LineString(9 9,8 1,1 5,0 0) 24dist buffer buf_area 251 POLYGON 44.60 26----- 27Polygon((2 2,2 8,8 8,8 2,2 2)) 28dist buffer buf_area 291 POLYGON 63.12 30----- 31Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2)) 32dist buffer buf_area 331 POLYGON 95.12 34----- 35Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0)) 36dist buffer buf_area 371 POLYGON 174.90 38----- 39MultiPoint(9 9,8 1,1 5) 40dist buffer buf_area 411 MULTIPOLYGON 9.36 42----- 43MultiLineString((0 0,2 2)) 44dist buffer buf_area 451 POLYGON 8.78 46----- 47MultiLineString((0 0,2 2,0 4)) 48dist buffer buf_area 491 POLYGON 14.22 50----- 51MultiLineString((0 0,2 2),(0 2,2 0)) 52dist buffer buf_area 531 POLYGON 13.56 54----- 55MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) 56dist buffer buf_area 571 MULTIPOLYGON 70.01 58----- 59MultiLineString((0 0,0 1),(3 0,3 1)) 60dist buffer buf_area 611 MULTIPOLYGON 10.24 62----- 63MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9))) 64dist buffer buf_area 651 POLYGON 73.16 66----- 67MultiPolygon(((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))) 68dist buffer buf_area 691 POLYGON 73.16 70----- 71GeometryCollection(Point(0 0)) 72dist buffer buf_area 731 POLYGON 3.12 74ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 75----- 76GeometryCollection(LineString(0 0, 2 2)) 77dist buffer buf_area 781 POLYGON 8.78 79ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 80----- 81GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))) 82dist buffer buf_area 831 POLYGON 63.12 84----- 85GeometryCollection(MultiPoint(9 9,8 1,1 5)) 86dist buffer buf_area 871 MULTIPOLYGON 9.36 88----- 89GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) 90dist buffer buf_area 911 MULTIPOLYGON 10.24 92----- 93GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6)))) 94dist buffer buf_area 951 MULTIPOLYGON 48.24 96----- 97GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) 98dist buffer buf_area 991 POLYGON 75.88 100# 101# Testing ST_BUFFER with zero distance 102# 103ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 104----- 105POINT(0 0) 106dist buffer buf_area 1070 POINT 0.00 108ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 109----- 110LineString(0 1, 1 1) 111dist buffer buf_area 1120 LINESTRING 0.00 113----- 114LineString(9 9,8 1,1 5,0 0) 115dist buffer buf_area 1160 LINESTRING 0.00 117----- 118Polygon((2 2,2 8,8 8,8 2,2 2)) 119dist buffer buf_area 1200 POLYGON 36.00 121----- 122Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2)) 123dist buffer buf_area 1240 POLYGON 48.00 125----- 126Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0)) 127dist buffer buf_area 1280 POLYGON 116.00 129----- 130MultiPoint(9 9,8 1,1 5) 131dist buffer buf_area 1320 MULTIPOINT 0.00 133----- 134MultiLineString((0 0,2 2)) 135dist buffer buf_area 1360 LINESTRING 0.00 137----- 138MultiLineString((0 0,2 2,0 4)) 139dist buffer buf_area 1400 LINESTRING 0.00 141----- 142MultiLineString((0 0,2 2),(0 2,2 0)) 143dist buffer buf_area 1440 MULTILINESTRING 0.00 145----- 146MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) 147dist buffer buf_area 1480 MULTILINESTRING 0.00 149----- 150MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9))) 151dist buffer buf_area 1520 MULTIPOLYGON 66.00 153----- 154MultiPolygon(((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))) 155dist buffer buf_area 1560 MULTIPOLYGON 62.00 157----- 158GeometryCollection(Point(0 0)) 159dist buffer buf_area 1600 POINT 0.00 161ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 162----- 163GeometryCollection(LineString(0 0, 2 2)) 164dist buffer buf_area 1650 LINESTRING 0.00 166ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 167----- 168GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))) 169dist buffer buf_area 1700 POLYGON 36.00 171----- 172GeometryCollection(MultiPoint(9 9,8 1,1 5)) 173dist buffer buf_area 1740 MULTIPOINT 0.00 175----- 176GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) 177dist buffer buf_area 1780 MULTILINESTRING 0.00 179----- 180GeometryCollection(MultiPolygon(((0 0, 3 0, 3 3, 0 3, 0 0)),((6 6,6 9,9 9,9 6,6 6)))) 181dist buffer buf_area 1820 MULTIPOLYGON 18.00 183----- 184GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) 185dist buffer buf_area 1860 GEOMETRYCOLLECTION 36.00 187# 188# Testing ST_BUFFER with negative distance 189# 190----- 191POINT(0 0) 192ERROR HY000: Incorrect arguments to st_buffer 193----- 194LineString(0 1, 1 1) 195ERROR HY000: Incorrect arguments to st_buffer 196----- 197LineString(9 9,8 1,1 5,0 0) 198ERROR HY000: Incorrect arguments to st_buffer 199----- 200Polygon((2 2,2 8,8 8,8 2,2 2)) 201dist buffer buf_area 202-1 POLYGON 16.00 203----- 204Polygon((0 0,0 8,8 8,8 0,0 0),(2 2,6 2,6 6,2 6,2 2)) 205dist buffer buf_area 206-1 MULTIPOLYGON 0.88 207----- 208Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0)) 209dist buffer buf_area 210-1 POLYGON 64.22 211----- 212MultiPoint(9 9,8 1,1 5) 213ERROR HY000: Incorrect arguments to st_buffer 214----- 215MultiLineString((0 0,2 2)) 216ERROR HY000: Incorrect arguments to st_buffer 217----- 218MultiLineString((0 0,2 2,0 4)) 219ERROR HY000: Incorrect arguments to st_buffer 220----- 221MultiLineString((0 0,2 2),(0 2,2 0)) 222ERROR HY000: Incorrect arguments to st_buffer 223----- 224MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14)) 225ERROR HY000: Incorrect arguments to st_buffer 226----- 227MultiPolygon(((2 2,2 8,8 8,8 2,2 2)), ((9 9,8 1,1 5,9 9))) 228dist buffer buf_area 229-1 POLYGON 8.00 230----- 231MultiPolygon(((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))) 232dist buffer buf_area 233-1 MULTIPOLYGON 0.30 234----- 235GeometryCollection(Point(0 0)) 236ERROR HY000: Incorrect arguments to st_buffer 237----- 238GeometryCollection(LineString(0 0, 2 2)) 239ERROR HY000: Incorrect arguments to st_buffer 240ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 241ERROR 22023: Invalid GIS data provided to function st_geometryfromtext. 242----- 243GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2))) 244dist buffer buf_area 245-1 POLYGON 16.00 246----- 247GeometryCollection(MultiPoint(9 9,8 1,1 5)) 248ERROR HY000: Incorrect arguments to st_buffer 249----- 250GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1))) 251ERROR HY000: Incorrect arguments to st_buffer 252----- 253GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2))) 254ERROR HY000: Incorrect arguments to st_buffer 255SELECT ST_CONTAINS( 256ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), 257ST_GeomFromText('POINT(5 10)')); 258ST_CONTAINS( 259ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), 260ST_GeomFromText('POINT(5 10)')) 2610 262SELECT ST_AsText(ST_UNION( 263ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), 264ST_GeomFromText('POINT(5 10)'))); 265ST_AsText(ST_UNION( 266ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'), 267ST_GeomFromText('POINT(5 10)'))) 268GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,5 0,5 5,0 5,0 0)),((6 6,11 6,11 11,6 11,6 6))),POINT(5 10)) 269DROP PROCEDURE p1; 270# 271# Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE 272# 273SELECT ST_GeometryType(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)); 274ST_GeometryType(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((0 0,9 4,3 3,0 0)),((2 2,2 2,8 8,2 3,2 2)))'), 3)) 275POLYGON 276# 277# Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL 278# 279SELECT ST_GeometryType(ST_BUFFER(ST_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)); 280ST_GeometryType(ST_BUFFER(ST_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)) 281POLYGON 282# 283# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER 284# 285DO ST_BUFFER(ST_GEOMCOLLFROMTEXT('linestring(1 1,2 2)'),''); 286SELECT ST_WITHIN( 287ST_LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), 288ST_BUFFER(ST_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))) '), 289ST_NUMINTERIORRINGS(ST_POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) ')))); 290ST_WITHIN( 291ST_LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '), 292ST_BUFFER(ST_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 2930 294SELECT ST_DIMENSION(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), 295ST_NUMINTERIORRINGS(ST_POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))); 296ST_DIMENSION(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '), 297ST_NUMINTERIORRINGS(ST_POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))')))) 2982 299SELECT ST_NUMINTERIORRINGS( 300ST_ENVELOPE(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), 301ST_SRID(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))); 302ST_NUMINTERIORRINGS( 303ST_ENVELOPE(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '), 304ST_SRID(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) '))))) 3050 306SELECT ST_ASTEXT(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), 307ST_SRID(ST_GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))); 308ST_ASTEXT(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'), 309ST_SRID(ST_GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) ')))) 310POLYGON((9 9,5 2,4 5,9 9)) 311# 312# 18701868 CRASH IN MY_DECIMAL::SANITY_CHECK, 313# ORDER BY CAST (INVALID GIS FUNCTION RESULT) 314# 315CREATE TABLE t1 (a INT) engine=innodb; 316INSERT INTO t1 VALUES (1); 317SELECT * FROM t1 ORDER BY cast(st_distance(1,1) as DECIMAL); 318a 3191 320DELETE FROM t1 ORDER BY cast(st_distance(1,1) as DECIMAL); 321ERROR 22023: Invalid GIS data provided to function st_distance. 322UPDATE t1 SET a=1 ORDER BY cast(st_distance(1,1) as DECIMAL); 323ERROR 22023: Invalid GIS data provided to function st_distance. 324DROP TABLE t1; 325