Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.4.27
-
None
-
None
-
Linux 4.19.0-22-amd64 #1 SMP Debian 4.19.260-1 (2022-09-29) x86_64 GNU/Linux
Description
After upgrading from 10.3.37 to 10.4.27 a trigger stopped working.
The trigger relied on sql_mode: NO_UNSIGNED_SUBTRACTION to set a temporary negative value out of subtraction from two BIGINT UNSIGNED values.
Code that is working on 10.3 and stopped working on 10.4.27
create database test;
|
use test;
|
|
MariaDB [test]> select @@sql_mode;
|
+------------+
|
| @@sql_mode |
|
+------------+
|
| |
|
+------------+
|
1 row in set (0.000 sec)
|
|
MariaDB [test]> select @@global.sql_mode;
|
+-------------------+
|
| @@global.sql_mode |
|
+-------------------+
|
| |
|
+-------------------+
|
1 row in set (0.000 sec)
|
|
|
/**/
|
create table article (id int unsigned not null auto_increment primary key, size bigint unsigned default 0);
|
insert into article values(NULL, 10);
|
|
DELIMITER $$
|
SET sql_mode = 'NO_UNSIGNED_SUBTRACTION';
|
CREATE TRIGGER article_update_quota BEFORE UPDATE ON `article`
|
FOR EACH ROW
|
BEGIN
|
DECLARE _size_diff BIGINT DEFAULT 0;
|
IF OLD.size != NEW.size THEN
|
*SET _size_diff = NEW.size - OLD.size;*
|
END IF;
|
END;
|
SET sql_mode = @@global.sql_mode;
|
$$
|
|
DELIMITER ;
|
update article set size=9; // FAILS with "BIGINT value is out of range in 'NEW.size - OLD.size'" altough trigger sql_mode: NO_UNSIGNED_SUBTRACTION
|
Attachments
Issue Links
- relates to
-
MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers
- In Testing