[MDEV-4521] MBRContains, MBRWithin no longer work with geometries of different type Created: 2013-05-14  Updated: 2017-07-19  Resolved: 2013-05-15

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.2, 5.5.30
Fix Version/s: 10.0.3, 5.5.31

Type: Bug Priority: Major
Reporter: Hartmut Holzgraefe Assignee: Alexey Botchkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-13348 MBRWithin doesn't work with geo of di... Closed

 Description   

MDEV-3819 "missing constraints for spatial column types" in revision 3663 seems to have caused this:

When a spatial index is utilized to check a condition using MBRContains or MBRWithin an error is raised if the geometries of the two arguments are not of the same type, so it is e.g. no longer possible to check whether a point is in the MBR of a line or polygon.

How to reproduce:

— test code —

DROP TABLE IF EXISTS t1;
 
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);

— Expected result —

COUNT(*)
1
COUNT(*)
1
COUNT(*)
1
COUNT(*)
1

— Actual result —

COUNT(*)
1
COUNT(*)
1
ERROR 1366 (22007) at line 17: Incorrect LINESTRING value: 'POINT' for column 'l' at row 1
ERROR 1366 (22007) at line 18: Incorrect LINESTRING value: 'POINT' for column 'l' at row 1


Generated at Thu Feb 08 06:57:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.