Skip to content

Commit

Permalink
type/compatibility: fix show create table output of generated column (p…
Browse files Browse the repository at this point in the history
  • Loading branch information
bb7133 authored and winkyao committed May 5, 2019
1 parent b2f7fc7 commit 595d728
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions ast/functions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func (ts *testFunctionsSuite) TestConvert(c *C) {
ErrorMessage string
}{
{`SELECT CONVERT("abc" USING "latin1")`, "latin1", ""},
{`SELECT CONVERT("abc" USING laTiN1)`, "laTiN1", ""},
{`SELECT CONVERT("abc" USING laTiN1)`, "latin1", ""},
{`SELECT CONVERT("abc" USING "binary")`, "binary", ""},
{`SELECT CONVERT("abc" USING biNaRy)`, "binary", ""},
{`SELECT CONVERT(a USING a)`, "", `[parser:1115]Unknown character set: 'a'`}, // TiDB issue #4436.
Expand Down Expand Up @@ -78,7 +78,7 @@ func (ts *testFunctionsSuite) TestChar(c *C) {
ErrorMessage string
}{
{`SELECT CHAR("abc" USING "latin1")`, "latin1", ""},
{`SELECT CHAR("abc" USING laTiN1)`, "laTiN1", ""},
{`SELECT CHAR("abc" USING laTiN1)`, "latin1", ""},
{`SELECT CHAR("abc" USING "binary")`, "binary", ""},
{`SELECT CHAR("abc" USING binary)`, "binary", ""},
{`SELECT CHAR(a USING a)`, "", `[parser:1115]Unknown character set: 'a'`},
Expand Down
8 changes: 4 additions & 4 deletions parser.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -5604,14 +5604,14 @@ CharsetName:
StringName
{
// Validate input charset name to keep the same behavior as parser of MySQL.
_, _, err := charset.GetCharsetInfo($1.(string))
name, _, err := charset.GetCharsetInfo($1.(string))
if err != nil {
yylex.AppendError(ErrUnknownCharacterSet.GenWithStackByArgs($1))
return 1
}
// Use $1 instead of charset name returned from charset.GetCharsetInfo(),
// to keep upper-lower case of input for restore.
$$ = $1
// Use charset name returned from charset.GetCharsetInfo(),
// to keep lower case of input for generated column restore.
$$ = name
}
| binaryType
{
Expand Down

0 comments on commit 595d728

Please sign in to comment.