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
-
Activity
Field | Original Value | New Value |
---|---|---|
Status | Open [ 1 ] | Confirmed [ 10101 ] |
Fix Version/s | 10.1 [ 16100 ] | |
Assignee | Sergei Golubchik [ serg ] | |
Labels | regression |
Sprint | 10.1.11 [ 30 ] |
Rank | Ranked higher |
Status | Confirmed [ 10101 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Stalled [ 10000 ] |
Fix Version/s | 10.1.11 [ 21202 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Resolution | Fixed [ 1 ] | |
Status | Closed [ 6 ] | Stalled [ 10000 ] |
Status | Stalled [ 10000 ] | In Progress [ 3 ] |
Status | In Progress [ 3 ] | Stalled [ 10000 ] |
Fix Version/s | 10.1.15 [ 22018 ] | |
Resolution | Fixed [ 1 ] | |
Status | Stalled [ 10000 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 73700 ] | MariaDB v4 [ 150010 ] |
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.