BUG #96310 INSERT accepts invalid date from default val With Binlog Open #617
+46
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bugfix for https://bugs.mysql.com/bug.php?id=96310
I have signed OCA and my account in Oracle is kindaichweng@gmail.com
PROBLEM:
When variable 'log_bin' is ON (that is, mysql will generate binary log for DML query) some invalid date from default value will be accepted by mysql.
Repeat:
SET sql_mode='';
CREATE TABLE default_date(a DATE NOT NULL DEFAULT '0000-00-00');
SET sql_mode=default;
INSERT INTO default_date VALUES(); -- invalid data will be accepted.
Solution:
We need not mark_columns_per_binlog_row_image IN TABLE::mark_columns_needed_for_insert, which is unnecessary and will change table->write_set and validate_default_values_of_unset_fields will skip data check finally