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

CONVERT produces a warning and result depends on strict mode

    Details

      Description

      MariaDB [test]> set sql_mode='';
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> select convert(_big5 0xC84041 using ucs2);
      +------------------------------------+
      | convert(_big5 0xC84041 using ucs2) |
      +------------------------------------+
      | ?A                                 |
      +------------------------------------+
      1 row in set, 1 warning (0.00 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+--------------------------------------------------+
      | Level   | Code | Message                                          |
      +---------+------+--------------------------------------------------+
      | Warning | 1977 | Cannot convert 'big5' character 0xC840 to 'ucs2' |
      +---------+------+--------------------------------------------------+
      1 row in set (0.00 sec)
      

      MariaDB [test]> set sql_mode='STRICT_ALL_TABLES';
      Query OK, 0 rows affected (0.00 sec)
       
      MariaDB [test]> select convert(_big5 0xC84041 using ucs2);
      +------------------------------------+
      | convert(_big5 0xC84041 using ucs2) |
      +------------------------------------+
      | NULL                               |
      +------------------------------------+
      1 row in set, 1 warning (0.01 sec)
       
      MariaDB [test]> show warnings;
      +---------+------+--------------------------------------------------+
      | Level   | Code | Message                                          |
      +---------+------+--------------------------------------------------+
      | Warning | 1977 | Cannot convert 'big5' character 0xC840 to 'ucs2' |
      +---------+------+--------------------------------------------------+
      1 row in set (0.00 sec)
      

      I don't know whether it should produce the warning, but in any case I don't think it should return different results in strict/non-strict mode while producing the same warning in both.

      It started happening in 10.1.
      MariaDB 5.5, 10.0, MySQL 5.5-5.7 produce the non-null result without any warnings regardless the strict mode.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated: