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

Inconsistency in data type conversion with GIS columns

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • 10.3, 10.4
    • 10.4
    • Data types, GIS
    • None

    Description

      It is very well possible that the change in behavior between 10.2 and 10.3 was intentional and correct, but I would want to make sure.

      UPDATE in the test case below has a value of a wrong type in WHERE clause.
      On 10.2, it produces an error if the column has a key on it, and works without warnings or errors if there is no key.
      On 10.3 and later, it works regardless of the key, without a warning or error.

      However, if we attempt to INSERT such record into the table, it causes an error on all versions, regardless the key.

      sql_mode doesn't seem to anyhow affect it.

      Note: All comparison was made on non-debug builds, because the debug version of 10.2 aborts with an assertion failure, filed separately as MDEV-21635.

      With key

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (f POINT, KEY(f));
      INSERT INTO t1 VALUES (ST_PointFromText('POINT(1 1)')),(ST_PointFromText('POINT(2 2)'));
      UPDATE t1 SET f = NULL WHERE f IN ( 'x', ST_PointFromText('POINT(1 1)') );
      

      Without key

      DROP TABLE IF EXISTS t1;
      CREATE TABLE t1 (f POINT);
      INSERT INTO t1 VALUES (ST_PointFromText('POINT(1 1)')),(ST_PointFromText('POINT(2 2)'));
      UPDATE t1 SET f = NULL WHERE f IN ( 'x', ST_PointFromText('POINT(1 1)') );
      

      10.2 256994ef

      MariaDB [test]> DROP TABLE IF EXISTS t1;
      Query OK, 0 rows affected (0.137 sec)
       
      MariaDB [test]> CREATE TABLE t1 (f POINT, KEY(f));
      Query OK, 0 rows affected (0.201 sec)
       
      MariaDB [test]> INSERT INTO t1 VALUES (ST_PointFromText('POINT(1 1)')),(ST_PointFromText('POINT(2 2)'));
      Query OK, 2 rows affected (0.037 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> UPDATE t1 SET f = NULL WHERE f IN ( 'x', ST_PointFromText('POINT(1 1)') );
      ERROR 1416 (22003): Cannot get geometry object from data you send to the GEOMETRY field
       
      MariaDB [test]> CREATE TABLE t1 (f POINT);
      Query OK, 0 rows affected (0.184 sec)
       
      MariaDB [test]> INSERT INTO t1 VALUES (ST_PointFromText('POINT(1 1)')),(ST_PointFromText('POINT(2 2)'));
      Query OK, 2 rows affected (0.037 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> UPDATE t1 SET f = NULL WHERE f IN ( 'x', ST_PointFromText('POINT(1 1)') );
      Query OK, 1 row affected (0.066 sec)
      Rows matched: 1  Changed: 1  Warnings: 0
      

      10.3 c8bd8d5c

      MariaDB [test]> DROP TABLE IF EXISTS t1;
      Query OK, 0 rows affected (0.135 sec)
       
      MariaDB [test]> CREATE TABLE t1 (f POINT, KEY(f));
      Query OK, 0 rows affected (0.209 sec)
       
      MariaDB [test]> INSERT INTO t1 VALUES (ST_PointFromText('POINT(1 1)')),(ST_PointFromText('POINT(2 2)'));
      Query OK, 2 rows affected (0.038 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> UPDATE t1 SET f = NULL WHERE f IN ( 'x', ST_PointFromText('POINT(1 1)') );
      Query OK, 1 row affected (0.064 sec)
      Rows matched: 1  Changed: 1  Warnings: 0
       
      MariaDB [test]> DROP TABLE IF EXISTS t1;
      Query OK, 0 rows affected (0.138 sec)
       
      MariaDB [test]> CREATE TABLE t1 (f POINT);
      Query OK, 0 rows affected (0.192 sec)
       
      MariaDB [test]> INSERT INTO t1 VALUES (ST_PointFromText('POINT(1 1)')),(ST_PointFromText('POINT(2 2)'));
      Query OK, 2 rows affected (0.037 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> UPDATE t1 SET f = NULL WHERE f IN ( 'x', ST_PointFromText('POINT(1 1)') );
      Query OK, 1 row affected (0.065 sec)
      Rows matched: 1  Changed: 1  Warnings: 0
      

      Attachments

        Issue Links

          Activity

            People

              bar Alexander Barkov
              elenst Elena Stepanova
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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