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

Conversion from INET6 to other types performed without errors or warnings

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.5
    • Fix Version/s: 10.5.0
    • Component/s: Data types
    • Labels:
      None

      Description

      create or replace table t1 (a inet6, b int);
      insert into t1 (a) values ('::');
      update t1 set b = a;
      

      10.5 b37386d8

      MariaDB [test]> update t1 set b = a;
      Query OK, 1 row affected (0.047 sec)
      Rows matched: 1  Changed: 1  Warnings: 0
       
      MariaDB [test]> select * from t1;
      +------+------+
      | a    | b    |
      +------+------+
      | ::   |    0 |
      +------+------+
      1 row in set (0.000 sec)
      

      Since explicit CAST from INET6 to INT is prohibited, I would expect that this conversion would be too, or at least it should cause a typical truncation warning/error.

      Same with TIMESTAMP, for example:

      MariaDB [test]> create or replace table t1 (a inet6, b timestamp);
      Query OK, 0 rows affected (0.355 sec)
       
      MariaDB [test]> insert into t1 (a) values ('::');
      Query OK, 1 row affected (0.045 sec)
       
      MariaDB [test]> update t1 set b = a;
      Query OK, 1 row affected (0.032 sec)
      Rows matched: 1  Changed: 1  Warnings: 0
       
      MariaDB [test]> select * from t1;
      +------+---------------------+
      | a    | b                   |
      +------+---------------------+
      | ::   | 0000-00-00 00:00:00 |
      +------+---------------------+
      1 row in set (0.001 sec)
      

      Can also be reproduced with ALTER:

      MariaDB [test]> create or replace table t1 (a inet6);
      Query OK, 0 rows affected (0.321 sec)
       
      MariaDB [test]> insert into t1 (a) values ('::');
      Query OK, 1 row affected (0.032 sec)
       
      MariaDB [test]> alter table t1 modify a date;
      Query OK, 1 row affected (0.926 sec)               
      Records: 1  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> select * from t1;
      +------------+
      | a          |
      +------------+
      | 2019-10-11 |
      +------------+
      1 row in set (0.001 sec)
      

      etc.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved: