forked from mysql/mysql-server
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BUG#22202665 - ADDING A TRIGGER TO A TABLE CHANGES THE BEHAVIOUR OF N…
…ULL DETECTION For non-strict mode attempt to implicitly insert NULL value into NOT NULL column led to a different results depending on whether trigger is set or not. Implicit insert means here the following use case: CREATE TABLE t1 (a INT, b INT NOT NULL); SET sql_mode= ''; INSERT INTO t1 (a) VALUES (1); For such use case for mysql server before 5.7 the warning 1364 "Field 'b' doesn't have a default value" was issued. In 5.7 the error 1048 "Column 'b' cannot be null" is issued. Such behaviour broke backward compatibility with 5.6. The reason for different behaviour in error handling of implicit NOT NULL constraint violation was that prior 5.7 checking for presense of all non-default values in INSERT statement was done before filling record by column values. So any attempt to INSERT a record without specifying all columns that doesn't have default values led to warning 1364. As of 5.7 checking for presence of non-default values is done after record is filled and NOT NULL constraints has been already checked for ever table's field. This leads to the fact that error 1048 is issued instead of warning 1364. To fix the bug that broke backward compatibility checking for NOT NULL violation is done only for fields set during handling INSERT statement. In other words, for only those fields that is set in field->table->fields_set_during_insert checking for NOT NULL is done.
- Loading branch information
Dmitry Shulga
committed
Dec 17, 2015
1 parent
b06546e
commit 8f1be5b
Showing
4 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters