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 bad null error handling for insert statement when disabling the strict SQL mode #10161

Merged
merged 7 commits into from
Apr 21, 2019

Conversation

jackysp
Copy link
Member

@jackysp jackysp commented Apr 16, 2019

What problem does this PR solve?

Fix #10153 , disabling the strict SQL mode should not ignore the bad null error.

What is changed and how it works?

Fix it when resetting the context of the statement.

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Related changes

  • Need to cherry-pick to the release branch

@jackysp jackysp added type/bugfix This PR fixes a bug. sig/execution SIG execution labels Apr 16, 2019
@jackysp jackysp requested review from bb7133 and lysu April 16, 2019 02:44
@jackysp
Copy link
Member Author

jackysp commented Apr 16, 2019

/run-all-tests

@codecov
Copy link

codecov bot commented Apr 16, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@7cc7323). Click here to learn what that means.
The diff coverage is 100%.

@@             Coverage Diff             @@
##             master     #10161   +/-   ##
===========================================
  Coverage          ?   77.9766%           
===========================================
  Files             ?        407           
  Lines             ?      83139           
  Branches          ?          0           
===========================================
  Hits              ?      64829           
  Misses            ?      13511           
  Partials          ?       4799

@@ -1767,8 +1767,13 @@ func (s *testSuite) TestSQLMode(c *C) {

tk.MustExec("set sql_mode = ''")
tk.MustExec("insert t values ()")
tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1364 Field 'a' doesn't have a default value"))
_, err = tk.Exec("insert t values (null)")
Copy link
Member

Choose a reason for hiding this comment

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

Can we have a insert ignore t values (null) test? A warning is expected in non-strict mode

Copy link
Member Author

Choose a reason for hiding this comment

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

PTAL @bb7133 .

@bb7133
Copy link
Member

bb7133 commented Apr 17, 2019

LGTM

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao merged commit 70c3718 into pingcap:master Apr 21, 2019
jackysp added a commit to jackysp/tidb that referenced this pull request Apr 24, 2019
zz-jason pushed a commit that referenced this pull request Apr 24, 2019
@jackysp jackysp deleted the strict_mode_insert branch May 29, 2019 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

disable strict sql mode should not ignore bad null error
4 participants