Skip to content

Commit

Permalink
infoschema: fix bit, year column metadata is not compatible with mysql
Browse files Browse the repository at this point in the history
Signed-off-by: Weizhen Wang <wangweizhen@pingcap.com>
  • Loading branch information
hawkingrei committed Nov 15, 2022
1 parent 9d7117b commit cfbb6af
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions executor/infoschema_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,11 @@ func TestColumnsTables(t *testing.T) {
tk.MustExec("drop table if exists t")
tk.MustExec("create table t (a bit DEFAULT (rand()))")
tk.MustQuery("select column_default from information_schema.columns where TABLE_NAME='t' and TABLE_SCHEMA='test';").Check(testkit.Rows("rand()"))

tk.MustExec("drop table if exists t")
tk.MustExec("CREATE TABLE t (`COL3` bit(1) NOT NULL,b year) ;")
tk.MustQuery("select column_type from information_schema.columns where TABLE_SCHEMA = 'test' and TABLE_NAME = 't';").
Check(testkit.Rows("bit(1)", "year(4)"))
}

func TestEngines(t *testing.T) {
Expand Down Expand Up @@ -866,12 +871,3 @@ func TestNullColumns(t *testing.T) {
tk.MustQuery("select * from information_schema.columns where TABLE_SCHEMA = 'test' and TABLE_NAME = 'v_test';").
Check(testkit.Rows("def test v_test type 1 <nil> YES binary 0 0 <nil> <nil> <nil> <nil> <nil> binary(0) select,insert,update,references "))
}

func TestIssue25472(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("use test")
tk.MustExec("CREATE TABLE t (`COL3` bit(1) NOT NULL,b year) ;")
tk.MustQuery("select column_type from information_schema.columns where TABLE_SCHEMA = 'test' and TABLE_NAME = 't';").
Check(testkit.Rows("bit(1)", "year(4)"))
}

0 comments on commit cfbb6af

Please sign in to comment.