Skip to content

Commit

Permalink
*: Fix TiDBSkipConstraintCheck session scope variable bug (pingcap#2035)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenli authored Nov 19, 2016
1 parent 5f457a2 commit 470d6dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sessionctx/variable/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ func (s *SessionVars) GetSystemVar(key string) types.Datum {
if ok {
d.SetString(sVal)
}
// TiDBSkipConstraintCheck is a session scope vars. We do not store it in the global table.
if key == TiDBSkipConstraintCheck {
d.SetString(SysVars[TiDBSkipConstraintCheck].Value)
}
return d
}

Expand Down
4 changes: 4 additions & 0 deletions sessionctx/variable/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ func (*testSessionSuite) TestSession(c *C) {

c.Assert(v.SetSystemVar("character_set_results", types.Datum{}), IsNil)

// Test case for get TiDBSkipConstraintCheck session variable
d := v.GetSystemVar(variable.TiDBSkipConstraintCheck)
c.Assert(d.GetString(), Equals, "0")

// Test case for tidb_skip_constraint_check
c.Assert(v.SkipConstraintCheck, IsFalse)
v.SetSystemVar(variable.TiDBSkipConstraintCheck, types.NewStringDatum("0"))
Expand Down

0 comments on commit 470d6dc

Please sign in to comment.