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

parser: support long varchar #5920

Merged
merged 10 commits into from
Mar 3, 2018
1 change: 1 addition & 0 deletions parser/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ var tokenMap = map[string]int{
"LOCALTIME": localTime,
"LOCALTIMESTAMP": localTs,
"LOCK": lock,
"LONG": long,
"LONGBLOB": longblobType,
"LONGTEXT": longtextType,
"LOW_PRIORITY": lowPriority,
Expand Down
6 changes: 6 additions & 0 deletions parser/parser.y
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ import (
utcTimestamp "UTC_TIMESTAMP"
utcTime "UTC_TIME"
values "VALUES"
long "LONG"
varcharType "VARCHAR"
varbinaryType "VARBINARY"
virtual "VIRTUAL"
Expand Down Expand Up @@ -5724,6 +5725,11 @@ TextType:
x := types.NewFieldType(mysql.TypeLongBlob)
$$ = x
}
| "LONG" "VARCHAR"
{
x := types.NewFieldType(mysql.TypeMediumBlob)
$$ = x
}


DateAndTimeType:
Expand Down
3 changes: 3 additions & 0 deletions parser/parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,9 @@ func (s *testParserSuite) TestDDL(c *C) {

// for issue 4740
{"create table t (a int1, b int2, c int3, d int4, e int8)", true},

// for issue 5918
{"create table t (lv long varchar null)", true},
}
s.RunTest(c, table)
}
Expand Down