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 committed Mar 1, 2023
1 parent 24c24a8 commit ae3f72c
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 ae3f72c

Please sign in to comment.