用于EagleEye3.0 规则集漏报和误报测试的示例项目,项目收集于github和gitee
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

277 lines
9.2 KiB

DROP TABLE IF EXISTS p1;
CREATE PROCEDURE p1(dist DOUBLE, geom TEXT)
BEGIN
DECLARE g GEOMETRY;
SET g=ST_GeomFromText(geom);
SELECT geom AS `-----`;
SELECT dist, ST_GeometryType(@buf:=ST_Buffer(g, dist)) AS `buffer`, ROUND(ST_AREA(@buf),2) AS buf_area;
END|
Warnings:
Warning 1287 Setting user variables within expressions is deprecated and will be removed in a future release. Consider alternatives: 'SET variable=expression, ...', or 'SELECT expression(s) INTO variables(s)'.
#
# Testing ST_BUFFER with positive distance
#
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
POINT(0 0)
dist buffer buf_area
1 POLYGON 3.12
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
LineString(0 1, 1 1)
dist buffer buf_area
1 POLYGON 5.12
-----
LineString(9 9,8 1,1 5,0 0)
dist buffer buf_area
1 POLYGON 44.60
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist buffer buf_area
1 POLYGON 63.12
-----
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.12
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist buffer buf_area
1 POLYGON 174.90
-----
MultiPoint(9 9,8 1,1 5)
dist buffer buf_area
1 MULTIPOLYGON 9.36
-----
MultiLineString((0 0,2 2))
dist buffer buf_area
1 POLYGON 8.78
-----
MultiLineString((0 0,2 2,0 4))
dist buffer buf_area
1 POLYGON 14.22
-----
MultiLineString((0 0,2 2),(0 2,2 0))
dist buffer buf_area
1 POLYGON 13.56
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
dist buffer buf_area
1 MULTIPOLYGON 70.01
-----
MultiLineString((0 0,0 1),(3 0,3 1))
dist buffer buf_area
1 MULTIPOLYGON 10.24
# Invalid geometry in input
-----
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.16
# Invalid geometry in input
-----
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.16
-----
GeometryCollection(Point(0 0))
dist buffer buf_area
1 POLYGON 3.12
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
GeometryCollection(LineString(0 0, 2 2))
dist buffer buf_area
1 POLYGON 8.78
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))
dist buffer buf_area
1 POLYGON 63.12
-----
GeometryCollection(MultiPoint(9 9,8 1,1 5))
dist buffer buf_area
1 MULTIPOLYGON 9.36
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
dist buffer buf_area
1 MULTIPOLYGON 10.24
-----
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.24
-----
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.88
#
# Testing ST_BUFFER with zero distance
#
-----
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
# Invalid geometry in input
-----
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
# Invalid geometry in input
-----
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
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
GeometryCollection(Polygon((2 2,2 8,8 8,8 2,2 2)))
dist buffer buf_area
0 POLYGON 36.00
-----
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 MULTIPOLYGON 18.00
#
# Testing ST_BUFFER with negative distance
#
-----
POINT(0 0)
ERROR HY000: Incorrect arguments to st_buffer
-----
LineString(0 1, 1 1)
ERROR HY000: Incorrect arguments to st_buffer
-----
LineString(9 9,8 1,1 5,0 0)
ERROR HY000: Incorrect arguments to st_buffer
-----
Polygon((2 2,2 8,8 8,8 2,2 2))
dist buffer buf_area
-1 POLYGON 16.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
-1 MULTIPOLYGON 0.88
-----
Polygon((0 0, 0 8, 8 8, 8 10, -10 10, -10 0, 0 0))
dist buffer buf_area
-1 POLYGON 64.22
-----
MultiPoint(9 9,8 1,1 5)
ERROR HY000: Incorrect arguments to st_buffer
-----
MultiLineString((0 0,2 2))
ERROR HY000: Incorrect arguments to st_buffer
-----
MultiLineString((0 0,2 2,0 4))
ERROR HY000: Incorrect arguments to st_buffer
-----
MultiLineString((0 0,2 2),(0 2,2 0))
ERROR HY000: Incorrect arguments to st_buffer
-----
MultiLineString((2 2,2 8,-2 8),(-6 -6, 6 6),(10 10, 14 14))
ERROR HY000: Incorrect arguments to st_buffer
# Invalid geometry in input
-----
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 6.14
# Invalid geometry in input
-----
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 MULTIPOLYGON 0.74
-----
GeometryCollection(Point(0 0))
ERROR HY000: Incorrect arguments to st_buffer
-----
GeometryCollection(LineString(0 0, 2 2))
ERROR HY000: Incorrect arguments to st_buffer
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
ERROR 22023: Invalid GIS data provided to function st_geomfromtext.
-----
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))
ERROR HY000: Incorrect arguments to st_buffer
-----
GeometryCollection(MultiLineString((0 0,0 1),(3 0,3 1)))
ERROR HY000: Incorrect arguments to st_buffer
-----
GeometryCollection(Point(9 9),LineString(1 5,0 0),Polygon((2 2,2 8,8 8,8 2,2 2)))
ERROR HY000: Incorrect arguments to st_buffer
SELECT ST_CONTAINS(
ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
ST_GeomFromText('POINT(5 10)'));
ST_CONTAINS(
ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
ST_GeomFromText('POINT(5 10)'))
0
SELECT ST_AsText(ST_UNION(
ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
ST_GeomFromText('POINT(5 10)')));
ST_AsText(ST_UNION(
ST_GeomFromText('MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0)),((6 6, 6 11, 11 11, 11 6, 6 6)))'),
ST_GeomFromText('POINT(5 10)')))
GEOMETRYCOLLECTION(MULTIPOLYGON(((0 0,5 0,5 5,0 5,0 0)),((6 6,11 6,11 11,6 11,6 6))),POINT(5 10))
DROP PROCEDURE p1;
#
# Bug #13833019 ASSERTION `T1->RESULT_RANGE' FAILED IN GCALC_OPERATION_REDUCER::END_COUPLE
#
SELECT 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));
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))
POLYGON
#
# Bug #13832749 HANDLE_FATAL_SIGNAL IN GCALC_FUNCTION::COUNT_INTERNAL
#
SELECT 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));
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))
POLYGON
#
# Bug#13358363 - ASSERTION: N > 0 && N < SINUSES_CALCULATED*2+1 | GET_N_SINCOS/ADD_EDGE_BUFFER
#
DO ST_BUFFER(ST_LINEFROMTEXT('linestring(1 1,2 2)'),'');
SELECT ST_WITHIN(
ST_LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
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)),((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(ST_POLYGONFROMTEXT('POLYGON((3 5,2 4,2 5,3 5)) '))));
ST_WITHIN(
ST_LINESTRINGFROMTEXT(' LINESTRING(3 8,9 2,3 8,3 3,7 6,4 7,4 7,8 1) '),
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)),((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(ST_POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(ST_POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))));
ST_DIMENSION(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((3 5,2 5,2 4,3 4,3 5)) '),
ST_NUMINTERIORRINGS(ST_POLYGONFROMTEXT(' POLYGON((0 0,9 3,4 2,0 0))'))))
2
SELECT ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
ST_SRID(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))));
ST_NUMINTERIORRINGS(
ST_ENVELOPE(ST_BUFFER(ST_MULTIPOLYGONFROMTEXT('MULTIPOLYGON(((3 5,2 5,2 4,3 4,3 5))) '),
ST_SRID(ST_MULTILINESTRINGFROMTEXT('MULTILINESTRING((2 2,4 2,1 2,2 4,2 2)) ')))))
0
SELECT ST_ASTEXT(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
ST_SRID(ST_GEOMETRYFROMTEXT(' MULTIPOINT(8 4,5 0,7 8,6 9,3 4,7 3,5 5) '))));
ST_ASTEXT(ST_BUFFER(ST_POLYGONFROMTEXT(' POLYGON((9 9,5 2,4 5,9 9))'),
ST_SRID(ST_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))
#
# 18701868 CRASH IN MY_DECIMAL::SANITY_CHECK,
# ORDER BY CAST (INVALID GIS FUNCTION RESULT)
#
CREATE TABLE t1 (a INT) engine=innodb;
INSERT INTO t1 VALUES (1);
SELECT * FROM t1 ORDER BY cast(st_distance(1,1) as DECIMAL);
a
1
DELETE FROM t1 ORDER BY cast(st_distance(1,1) as DECIMAL);
ERROR 22023: Invalid GIS data provided to function st_distance.
UPDATE t1 SET a=1 ORDER BY cast(st_distance(1,1) as DECIMAL);
ERROR 22023: Invalid GIS data provided to function st_distance.
DROP TABLE t1;