Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-4521

MBRContains, MBRWithin no longer work with geometries of different type

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.2, 5.5.30
    • Fix Version/s: 10.0.3, 5.5.31
    • Component/s: None
    • Labels:
      None

      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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                holyfoot Alexey Botchkov
                Reporter:
                hholzgra Hartmut Holzgraefe
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: