Skip to content

Commit

Permalink
typeinferer: Fix schema() function type infer bug (pingcap#2181)
Browse files Browse the repository at this point in the history
  • Loading branch information
shenli authored Dec 6, 2016
1 parent 4da8cfd commit f403dcf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion plan/typeinferer.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ func (v *typeInferrer) handleFuncCallExpr(x *ast.FuncCallExpr) {
}
case "str_to_date":
tp = types.NewFieldType(mysql.TypeDatetime)
case "dayname", "version", "database", "user", "current_user",
case "dayname", "version", "database", "user", "current_user", "schema",
"concat", "concat_ws", "left", "lcase", "lower", "repeat",
"replace", "ucase", "upper", "convert", "substring",
"substring_index", "trim", "ltrim", "rtrim", "reverse", "hex", "unhex", "date_format":
Expand Down
1 change: 1 addition & 0 deletions plan/typeinferer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func (ts *testTypeInferrerSuite) TestInferType(c *C) {
{"dayname('2007-02-03')", mysql.TypeVarString, "utf8"},
{"version()", mysql.TypeVarString, "utf8"},
{"database()", mysql.TypeVarString, "utf8"},
{"schema()", mysql.TypeVarString, "utf8"},
{"user()", mysql.TypeVarString, "utf8"},
{"current_user()", mysql.TypeVarString, "utf8"},
{"CONCAT('T', 'i', 'DB')", mysql.TypeVarString, "utf8"},
Expand Down

0 comments on commit f403dcf

Please sign in to comment.