Skip to content

BUG #96310 INSERT accepts invalid date from default val With Binlog Open #617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 8.0
Choose a base branch
from

Conversation

beifangxiuwhx
Copy link

@beifangxiuwhx beifangxiuwhx commented Jul 16, 2025

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

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

fix
@mysql-oca-bot
Copy link

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/
Please make sure to include your MySQL bug system user (email) in the returned form.
Thanks

@beifangxiuwhx
Copy link
Author

Hi, thank you for submitting this pull request. In order to consider your code we need you to sign the Oracle Contribution Agreement (OCA). Please review the details and follow the instructions at https://oca.opensource.oracle.com/ Please make sure to include your MySQL bug system user (email) in the returned form. Thanks

I have signed OCA and my account in Oracle is kindaichweng@gmail.com

@beifangxiuwhx
Copy link
Author

I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it.

@beifangxiuwhx
Copy link
Author

"I confirm the code being submitted is offered under the terms of the OCA, and that I am authorized to contribute it."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants