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

Inconsistent behavior of ST_Touches with a POINT as one of arguments

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.1
    • Fix Version/s: 10.1.6
    • Component/s: GIS
    • Labels:
      None
    • Sprint:
      10.1.6-1

      Description

      Polygon and point, line and point

      ST_Touches(POLYGON,POINT) and ST_Touches(LINESTRING,POINT) in some cases return true in 10.0 and PostgreSQL and false in 10.1:

      10.1

      MariaDB [test]> select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
      +-----------------------------------------------------------------------------------+
      | ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')) |
      +-----------------------------------------------------------------------------------+
      |                                                                                 0 |
      +-----------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
      +-------------------------------------------------------------------------------------------------+
      | ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')) |
      +-------------------------------------------------------------------------------------------------+
      |                                                                                               0 |
      +-------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      10.0

      MariaDB [test]> select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
      +-----------------------------------------------------------------------------------+
      | ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)')) |
      +-----------------------------------------------------------------------------------+
      |                                                                                 1 |
      +-----------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
      +-------------------------------------------------------------------------------------------------+
      | ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)')) |
      +-------------------------------------------------------------------------------------------------+
      |                                                                                               1 |
      +-------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      PostgreSQL

      pgis=# select ST_Touches(ST_LineFromText('LINESTRING(0 0,5 5)'),ST_PointFromText('POINT(0 0)'));
       st_touches 
      ------------
       t
      (1 row)
       
      pgis=# select ST_Touches(ST_PolygonFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'),ST_PointFromText('POINT(0 0)'));
       st_touches 
      ------------
       t
      (1 row)

      Two identical points

      ST_Touches(POINT,POINT) returns true in 10.0 and false in 10.1.
      In PostgreSQL, it also returns false. I'm not sure which is correct, the definition of ST_Touches leaves it unclear for a degenerate object such as point.

      10.0

      MariaDB [test]> select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
      +---------------------------------------------------------------------------+
      | ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')) |
      +---------------------------------------------------------------------------+
      |                                                                         1 |
      +---------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      10.1

      MariaDB [test]> select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
      +---------------------------------------------------------------------------+
      | ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)')) |
      +---------------------------------------------------------------------------+
      |                                                                         0 |
      +---------------------------------------------------------------------------+
      1 row in set (0.00 sec)

      PostgreSQL

      pgis=# select ST_Touches(ST_PointFromText('POINT(0 0)'),ST_PointFromText('POINT(0 0)'));
       st_touches 
      ------------
       f
      (1 row)

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                holyfoot Alexey Botchkov
                Reporter:
                elenst Elena Stepanova
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: