Skip to content

Commit 1c86463

Browse files
committed
executor: avoid duplicated SchemaByName calls
close #66867
1 parent e697fe6 commit 1c86463

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pkg/executor/grant.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,12 @@ func (e *GrantExec) Next(ctx context.Context, _ *chunk.Chunk) error {
124124
// This makes `t` and `T` write to the same privilege row.
125125
e.Level.TableName = tbl.Meta().Name.O
126126
}
127-
if db, succ := schema.SchemaByName(dbNameStr); succ {
127+
db, succ := schema.SchemaByName(dbNameStr)
128+
if succ {
128129
dbName = db.Name.O
129130
}
130131
if len(e.Level.DBName) > 0 {
131132
// The database name should also match.
132-
db, succ := schema.SchemaByName(dbNameStr)
133133
if !succ || db.Name.L != dbNameStr.L {
134134
return infoschema.ErrTableNotExists.GenWithStackByArgs(dbName, e.Level.TableName)
135135
}

0 commit comments

Comments
 (0)