Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
From manual inspection of the code, when GRANT is on . the visitInfo collected the dbName even if it is not applicable:
|
if dbName == "" { |
|
dbName = sctx.GetSessionVars().CurrentDB |
|
} |
|
vi = appendVisitInfo(vi, mysql.GrantPriv, dbName, tableName, "", nil) |
|
|
|
var allPrivs []mysql.PrivilegeType |
|
for _, item := range stmt.Privs { |
|
if item.Priv == mysql.AllPriv { |
|
switch stmt.Level.Level { |
|
case ast.GrantLevelGlobal: |
|
allPrivs = mysql.AllGlobalPrivs |
|
case ast.GrantLevelDB: |
|
allPrivs = mysql.AllDBPrivs |
|
case ast.GrantLevelTable: |
|
allPrivs = mysql.AllTablePrivs |
|
} |
|
break |
|
} |
|
vi = appendVisitInfo(vi, item.Priv, dbName, tableName, "", nil) |
|
} |
|
|
|
for _, priv := range allPrivs { |
|
vi = appendVisitInfo(vi, priv, dbName, tableName, "", nil) |
|
} |
2. What did you expect to see? (Required)
It should be if dbName == "" && stmt.Level.Level != ast.GrantLevelGlobal {. There are also no tests on visitInfo for GrantLevelGlobal.
3. What did you see instead (Required)
if dbName == "" {
dbName = sctx.GetSessionVars().CurrentDB
}
4. What is your TiDB version? (Required)
master
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
From manual inspection of the code, when GRANT is on . the
visitInfocollected thedbNameeven if it is not applicable:tidb/planner/core/planbuilder.go
Lines 2268 to 2291 in adfe029
2. What did you expect to see? (Required)
It should be
if dbName == "" && stmt.Level.Level != ast.GrantLevelGlobal {. There are also no tests onvisitInfoforGrantLevelGlobal.3. What did you see instead (Required)
4. What is your TiDB version? (Required)
master