Skip to content

Commit

Permalink
session: check redact when log compile error (#41832)
Browse files Browse the repository at this point in the history
close #41831
  • Loading branch information
lance6716 authored Mar 3, 2023
1 parent ab935cd commit 5ba709f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -2201,8 +2201,12 @@ func (s *session) ExecuteStmt(ctx context.Context, stmtNode ast.StmtNode) (sqlex
// Mute the warning for internal SQLs.
if !s.sessionVars.InRestrictedSQL {
if !variable.ErrUnknownSystemVar.Equal(err) {
sql := stmtNode.Text()
if s.sessionVars.EnableRedactLog {
sql = parser.Normalize(sql)
}
logutil.Logger(ctx).Warn("compile SQL failed", zap.Error(err),
zap.String("SQL", stmtNode.Text()))
zap.String("SQL", sql))
}
}
return nil, err
Expand Down

0 comments on commit 5ba709f

Please sign in to comment.