typeinferer: Fix schema() function type infer bug (#2181)

This commit is contained in:
Shen Li
2016-12-06 15:44:33 +08:00
committed by GitHub
parent 4da8cfd3fa
commit f403dcfd4b
2 changed files with 2 additions and 1 deletions

View File

@ -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":

View File

@ -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"},