Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao committed Apr 3, 2018
1 parent 504feff commit 9972787
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 6 additions & 4 deletions session/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ const (
// CreateTablePrivTable is the SQL statement creates table scope privilege table in system db.
CreateTablePrivTable = `CREATE TABLE if not exists mysql.tables_priv (
Host CHAR(60),
DB CHAR(64),
User CHAR(16),
DB CHAR(64),
User CHAR(32),
Table_name CHAR(64),
Grantor CHAR(77),
Timestamp Timestamp DEFAULT CURRENT_TIMESTAMP,
Expand All @@ -106,8 +106,8 @@ const (
// CreateColumnPrivTable is the SQL statement creates column scope privilege table in system db.
CreateColumnPrivTable = `CREATE TABLE if not exists mysql.columns_priv(
Host CHAR(60),
DB CHAR(64),
User CHAR(16),
DB CHAR(64),
User CHAR(32),
Table_name CHAR(64),
Column_name CHAR(64),
Timestamp Timestamp DEFAULT CURRENT_TIMESTAMP,
Expand Down Expand Up @@ -585,6 +585,8 @@ func upgradeToVer18(s Session) {

func upgradeToVer19(s Session) {
doReentrantDDL(s, "ALTER TABLE mysql.db MODIFY User CHAR(32)")
doReentrantDDL(s, "ALTER TABLE mysql.tables_priv MODIFY User CHAR(32)")
doReentrantDDL(s, "ALTER TABLE mysql.columns_priv MODIFY User CHAR(32)")
}

// updateBootstrapVer updates bootstrap version variable in mysql.TiDB table.
Expand Down
2 changes: 2 additions & 0 deletions session/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,8 @@ func (s *testSessionSuite) TestRollbackOnCompileError(c *C) {

func (s *testSessionSuite) TestDBUserNameLength(c *C) {
tk := testkit.NewTestKitWithInit(c, s.store)
tk.MustExec("create table if not exists t (a int)")
// Test user name lengh can be longer than 16.
tk.MustExec(`grant all privileges on test.* to 'abcddfjakldfjaldddds'@'%' identified by ''`)
tk.MustExec(`grant all privileges on test.t to 'abcddfjakldfjaldddds'@'%' identified by ''`)
}

0 comments on commit 9972787

Please sign in to comment.