Merge pull request #290 from pingcap/siddontang/blob-text-option-length
parser: blob and text support field length option
This commit is contained in:
@ -3722,9 +3722,10 @@ BlobType:
|
||||
x.Collate = charset.CharsetBin
|
||||
$$ = x
|
||||
}
|
||||
| "BLOB"
|
||||
| "BLOB" OptFieldLen
|
||||
{
|
||||
x := types.NewFieldType(mysql.TypeBlob)
|
||||
x.Flen = $2.(int)
|
||||
x.Charset = charset.CharsetBin
|
||||
x.Collate = charset.CharsetBin
|
||||
$$ = x
|
||||
@ -3751,9 +3752,10 @@ TextType:
|
||||
$$ = x
|
||||
|
||||
}
|
||||
| "TEXT"
|
||||
| "TEXT" OptFieldLen
|
||||
{
|
||||
x := types.NewFieldType(mysql.TypeBlob)
|
||||
x.Flen = $2.(int)
|
||||
$$ = x
|
||||
}
|
||||
| "MEDIUMTEXT"
|
||||
|
||||
@ -426,6 +426,9 @@ func (s *testParserSuite) TestParser0(c *C) {
|
||||
// For national
|
||||
{"create table t (c1 national char(2), c2 national varchar(2))", true},
|
||||
|
||||
// For blob and text field length
|
||||
{"create table t (c1 blob(1024), c2 text(1024))", true},
|
||||
|
||||
// For check
|
||||
{"create table t (c1 bool, c2 bool, check (c1 in (0, 1)), check (c2 in (0, 1)))", true},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user