[MDEV-31200] STRICT_TRANS_TABLES doesn't work in DELETE statement Created: 2023-05-05  Updated: 2023-11-28

Status: Open
Project: MariaDB Server
Component/s: Configuration
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
Fix Version/s: 10.4, 10.5, 10.6, 10.11

Type: Bug Priority: Major
Reporter: Takeshi Terada Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: None
Environment:

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)



 Comments   
Comment by Oleksandr Byelkin [ 2023-09-26 ]

yes behaviour should be consistent.

and UPDATE should not issue error on problem in WHERE as well as DELETE.

Generated at Thu Feb 08 10:22:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.