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

CONNECT: no error on conversion 0 -> NULL with strict mode

    XMLWordPrintable

    Details

      Description

      I don't know if this is really a bug, but this behavior is different from the one we rely on, with this SQL_MODE:

      MariaDB [test]> SELECT @@session.SQL_MODE;
      +-------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | @@session.SQL_MODE                                                                                                                                          |
      +-------------------------------------------------------------------------------------------------------------------------------------------------------------+
      | ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,STRICT_ALL_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
      +-------------------------------------------------------------------------------------------------------------------------------------------------------------+
      1 row in set (0.00 sec)
       
      MariaDB [test]> CREATE TABLE t (c INT NULL DEFAULT 0) ENGINE=CONNECT TABLE_TYPE=DOS FILE_NAME='t.dos';
      Query OK, 0 rows affected (0.09 sec)
       
      MariaDB [test]> INSERT INTO t VALUES (0), (DEFAULT);
      Query OK, 2 rows affected (0.00 sec)
      Records: 2  Duplicates: 0  Warnings: 0
       
      MariaDB [test]> SELECT * FROM t;
      +------+
      | c    |
      +------+
      | NULL |
      | NULL |
      +------+
      2 rows in set (0.00 sec)

      Both the DEFAULT 0 clause and the explicit 0 INSERT specify a value that is not supported for this data format. The strict mode is meant to prevent silent data changes. But even without strict mode, maybe a warnings is expected?

        Attachments

          Activity

            People

            • Assignee:
              bertrandop Olivier Bertrand
              Reporter:
              f_razzoli Federico Razzoli
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: