diff --git a/tidb_test.go b/tidb_test.go index bebd9a66c5..0ae4c43e62 100644 --- a/tidb_test.go +++ b/tidb_test.go @@ -894,6 +894,24 @@ func (s *testSessionSuite) TestBootstrap(c *C) { mustExecSQL(c, se, "USE test;") } +func (s *testSessionSuite) TestEnum(c *C) { + store := newStore(c, s.dbName) + se := newSession(c, store, s.dbName) + + mustExecSQL(c, se, "drop table if exists t") + mustExecSQL(c, se, "create table t (c enum('a', 'b', 'c'))") + mustExecSQL(c, se, "insert into t values ('a'), (2), ('c')") + r := mustExecSQL(c, se, "select * from t where c = 'a'") + row, err := r.FirstRow() + c.Assert(err, IsNil) + match(c, row, "a") + + r = mustExecSQL(c, se, "select c + 1 from t where c = 2") + row, err = r.FirstRow() + c.Assert(err, IsNil) + match(c, row, "3") +} + func newSession(c *C, store kv.Storage, dbName string) Session { se, err := CreateSession(store) c.Assert(err, IsNil)