Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1.10
-
Ubuntu 14.04
-
10.1.11
Description
set session sql_mode ='NO_AUTO_VALUE_ON_ZERO';
|
|
drop table if exists test;
|
|
create table test (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`));
|
|
insert into test (id) values (0);
|
|
select id from test;
|
|
#+----+
|
# | id |
|
# +----+
|
# | 0 |
|
# +----+
|
|
drop table if exists test;
|
|
create table test (`id` int(10) unsigned NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`));
|
|
drop trigger if exists test_before_insert;
|
|
delimiter ;;
|
|
CREATE TRIGGER `test_before_insert`
|
BEFORE INSERT ON `test`
|
FOR EACH ROW
|
BEGIN
|
END ;;
|
|
delimiter ;
|
|
insert into test (id) values (0);
|
|
select id from test;
|
|
# +----+
|
# | id |
|
# +----+
|
# | 1 |
|
# +----+
|
|
Attachments
Issue Links
- relates to
-
MDEV-8605 MariaDB not use DEFAULT value even when inserted NULL for NOT NULLABLE column.
-
- Closed
-
Thanks for the report and the test case.
The problem was introduced by the following revision:
commit 0686c34d22a5cbf93015012eaf77a4a977b63afb
Author: Sergei Golubchik <serg@mariadb.org>
Date: Sat Nov 14 22:51:54 2015 +0100
MDEV-8605 MariaDB not use DEFAULT value even when inserted NULL for NOT NULLABLE column
NOT NULL constraint must be checked *after* the BEFORE triggers.
That is for INSERT and UPDATE statements even NOT NULL fields
must be able to store a NULL temporarily at least while
BEFORE INSERT/UPDATE triggers are running.