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

STRICT_TRANS_TABLES doesn't work in DELETE statement

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
    • 10.4, 10.5, 10.6, 10.11
    • Configuration
    • None
    • 10.11.2-MariaDB-1:10.11.2+maria~ubu2204

    Description

      As shown below, STRICT_TRANS_TABLES works in UPDATE, but it doesn't in DELETE statement.
      I think DELETE should raise an error just like UPDATE does.

      MariaDB [vuln]> select @@SQL_MODE, @@GLOBAL.SQL_MODE;
      +-------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------+
      | @@SQL_MODE                                                                                | @@GLOBAL.SQL_MODE                                                                         |
      +-------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------+
      | STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION | STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION |
      +-------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------------+
      1 row in set (0.000 sec)
       
      MariaDB [vuln]> create table tbl1 (id varchar(20));
      Query OK, 0 rows affected (0.005 sec)
       
      MariaDB [vuln]> insert into tbl1 values ('abc');
      Query OK, 1 row affected (0.001 sec)
       
      MariaDB [vuln]> update tbl1 set id='x' where id=0;
      ERROR 1292 (22007): Truncated incorrect DECIMAL value: 'abc'
       
      MariaDB [vuln]> delete from tbl1 where id=0;
      Query OK, 1 row affected, 1 warning (0.001 sec)
       
      MariaDB [vuln]> show warnings;
      +---------+------+------------------------------------------+
      | Level   | Code | Message                                  |
      +---------+------+------------------------------------------+
      | Warning | 1292 | Truncated incorrect DECIMAL value: 'abc' |
      +---------+------+------------------------------------------+
      1 row in set (0.000 sec)
       
      MariaDB [vuln]> select * from tbl1;
      Empty set (0.000 sec)
       
      MariaDB [vuln]> select version();
      +-----------------------------------------+
      | version()                               |
      +-----------------------------------------+
      | 10.11.2-MariaDB-1:10.11.2+maria~ubu2204 |
      +-----------------------------------------+
      1 row in set (0.000 sec)
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            tterada Takeshi Terada
            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.