1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +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:
Alexey Botchkov
2013-05-15 02:33:29 +05:00
parent d0265a632f
commit c2ee0218ba
3 changed files with 48 additions and 0 deletions

View File

@ -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;

View File

@ -956,3 +956,23 @@ SELECT a, ASTEXT(b) FROM t1;
DROP TABLE t1;
--echo End of 5.1 tests
#
# MDEV-4521 MBRContains, MBRWithin no longer work with geometries of different type.
#
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)'));
SELECT COUNT(*) FROM t1 IGNORE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRContains(l, GEOMFROMTEXT('POINT(0 0)'));
SELECT COUNT(*) FROM t1 FORCE INDEX(l) WHERE MBRWithin(GEOMFROMTEXT('POINT(0 0)'), l);
DROP TABLE t1;