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

Wrong result with ST_Disjoint, InnoDB only

    XMLWordPrintable

Details

    • Unexpected results
    • Q4/2026 Server Development

    Description

      Setup:

      CREATE TABLE t1 (id int PRIMARY KEY, g geometry NOT NULL, SPATIAL KEY(g))
        ENGINE=InnoDB;
      INSERT INTO t1 VALUES
       (1, ST_GeomFromText('POLYGON((0 0,10 0,0 10,0 0))')),
       (2, ST_GeomFromText('POLYGON((100 100,101 100,101 101,100 101,100 100))'));
      SET @p= ST_GeomFromText('POLYGON((8 8,9 8,9 9,8 9,8 8))');
      

      On 11.4 we are missing a result for ST_Disjoint:

      MariaDB [test]> SELECT id FROM t1 WHERE ST_Disjoint(@p,g);
      +----+
      | id |
      +----+
      |  2 |
      +----+
      1 row in set (0.001 sec)
      

      Contrasted with MySQL 9.6.0:

      mysql> SELECT id FROM t1 WHERE ST_Disjoint(@p,g);
      +----+
      | id |
      +----+
      |  1 |
      |  2 |
      +----+
      2 rows in set (0.002 sec)
      

      Interestingly, this appears to be specific to InnoDB. Changing the engine to MyISAM or Aria gives the same result that MySQL gives.

      Attachments

        Activity

          People

            rucha174 Rucha Deodhar
            Gosselin Dave Gosselin
            Dave Gosselin Dave Gosselin
            Rucha Deodhar Rucha Deodhar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Time Tracking

                Estimated:
                Original Estimate - 0d
                0d
                Remaining:
                Time Spent - 0.75h Remaining Estimate - 0.25d
                0.25d
                Logged:
                Time Spent - 0.75h Remaining Estimate - 0.25d
                0.75h

                Git Integration

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