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

MBRContains, MBRWithin no longer work with geometries of different type

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.2, 5.5.30
    • 10.0.3, 5.5.31
    • None
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.