mirror of
https://github.com/MariaDB/server.git
synced 2025-11-19 19:03:26 +03:00
MDEV-4521 MBRContains, MBRWithin no longer work with geometries of different type.
get_mm_leaf function can store all sorts of spatial features in
one type of field it receives from an Item_field.
So we just allow that by setting the type of this field to GEOMETRY.
per-file comments:
mysql-test/r/gis-rtree.result
result updated
mysql-test/t/gis-rtree.test
test case added.
sql/opt_range.cc
set geom_type=GEOMETRY if we got Field_geom.
This commit is contained in:
@@ -1576,3 +1576,23 @@ a ASTEXT(b)
|
||||
0 POINT(1 1)
|
||||
DROP TABLE t1;
|
||||
End of 5.1 tests
|
||||
CREATE TABLE t1 (
|
||||
l LINESTRING NOT NULL,
|
||||
SPATIAL KEY(l)
|
||||
) ENGINE = myisam;
|
||||
INSERT INTO t1 VALUES(GeomFromText('LINESTRING(0 0, 1 1)'));
|
||||
INSERT INTO t1 VALUES(GeomFromText('LINESTRING(1 1, 2 2)'));
|
||||
INSERT INTO t1 VALUES(GeomFromText('LINESTRING(2 2, 3 3)'));
|
||||
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
|
||||
COUNT(*)
|
||||
1
|
||||
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
|
||||
COUNT(*)
|
||||
1
|
||||
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
|
||||
COUNT(*)
|
||||
1
|
||||
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
|
||||
COUNT(*)
|
||||
1
|
||||
DROP TABLE t1;
|
||||
|
||||
Reference in New Issue
Block a user