Skip to content
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

executor: fix a bug that can not insert null into a not null column in the empty SQL mode #21237

Merged
merged 7 commits into from
Dec 25, 2020

Conversation

wjhuang2016
Copy link
Member

Signed-off-by: wjhuang2016 [email protected]

What problem does this PR solve?

Issue Number: close #11648

Problem Summary:

What is changed and how it works?

Set BadNullAsWarning to True if not StrictSQLMode.

Related changes

  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test

Side effects

Release note

  • fix a bug that can not insert null into a not null column in the empty SQL mode

Signed-off-by: wjhuang2016 <[email protected]>
@wjhuang2016 wjhuang2016 requested a review from a team as a code owner November 24, 2020 03:50
@wjhuang2016 wjhuang2016 requested review from SunRunAway and removed request for a team November 24, 2020 03:50
tk.MustExec("create table t (id int NOT NULL DEFAULT 8);")
tk.MustExec("SET sql_mode = '';")
tk.MustExec("insert into t values (1), (NULL), (2);")
tk.MustQuery("select * from t").Check(testkit.Rows("1", "0", "2"))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check the warning for this query.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

insert into t values (1), (NULL), (2);

Copy link
Member Author

@wjhuang2016 wjhuang2016 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MySQL reports an error if insert NULL only ...

@wjhuang2016 wjhuang2016 added type/bugfix This PR fixes a bug. and removed status/WIP labels Dec 24, 2020
Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot added the status/LGT1 Indicates that a PR has LGTM 1. label Dec 24, 2020
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ti-srebot ti-srebot removed the status/LGT1 Indicates that a PR has LGTM 1. label Dec 24, 2020
@ti-srebot ti-srebot added the status/LGT2 Indicates that a PR has LGTM 2. label Dec 24, 2020
@jackysp jackysp added the compatibility-breaker Violation of forwards/backwards compatibility in a design-time piece. label Dec 24, 2020
@wjhuang2016
Copy link
Member Author

/merge

@ti-srebot ti-srebot added the status/can-merge Indicates a PR has been approved by a committer. label Dec 24, 2020
@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@wjhuang2016 merge failed.

@wjhuang2016
Copy link
Member Author

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot
Copy link
Contributor

@wjhuang2016 merge failed.

@zhouqiang-cl
Copy link
Contributor

/run-e2e-test

@wjhuang2016
Copy link
Member Author

/merge

@ti-srebot
Copy link
Contributor

/run-all-tests

@ti-srebot ti-srebot merged commit c3e5496 into pingcap:master Dec 25, 2020
@wjhuang2016
Copy link
Member Author

/run-cherry-picker

@ti-srebot
Copy link
Contributor

cherry pick to release-4.0 in PR #27832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compatibility-breaker Violation of forwards/backwards compatibility in a design-time piece. component/expression sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Disabling STRICT_TRANS_TABLES should allow NULL insert into NOT NULL column with default value
5 participants