Skip to content

Commit

Permalink
session: check redact when log compile error
Browse files Browse the repository at this point in the history
Signed-off-by: lance6716 <[email protected]>
  • Loading branch information
lance6716 authored and ti-chi-bot committed Mar 3, 2023
1 parent cf36a9c commit a7c47e2
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 @@ -2153,8 +2153,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 a7c47e2

Please sign in to comment.