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

sessionctx: supports set character_set_results = null #7314

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion executor/set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ func (s *testSuite) TestSetVar(c *C) {
c.Assert(charset, Equals, "utf8")
c.Assert(collation, Equals, "utf8_bin")

tk.MustExec("set @@character_set_results = NULL")
tk.MustExec("set character_set_results = NULL")
tk.MustQuery("select @@character_set_results").Check(testkit.Rows(""))

// Test set transaction isolation level, which is equivalent to setting variable "tx_isolation".
tk.MustExec("SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED")
Expand Down
10 changes: 5 additions & 5 deletions sessionctx/variable/varsutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ func SetSessionSystemVar(vars *SessionVars, name string, value types.Datum) erro
if sysVar == nil {
return UnknownSystemVar
}
if value.IsNull() {
return vars.deleteSystemVar(name)
}
var sVal string
sVal := ""
var err error
sVal, err = value.ToString()
if !value.IsNull() {
//return vars.deleteSystemVar(name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we need this comment?

sVal, err = value.ToString()
}
if err != nil {
return errors.Trace(err)
}
Expand Down