From d2b4d726e74614a537b65b1be08a2f4d311f4739 Mon Sep 17 00:00:00 2001 From: Leon Zhang Date: Thu, 28 Jan 2021 01:37:09 +0800 Subject: [PATCH] fix ARG.014 swich case add wrong place --- advisor/heuristic.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/advisor/heuristic.go b/advisor/heuristic.go index a43c1ab..f5c6f89 100644 --- a/advisor/heuristic.go +++ b/advisor/heuristic.go @@ -2640,10 +2640,6 @@ func (q *Query4Audit) RuleIn() Rule { // by pass sub query // id in (select id from tb where xxx) break - case sqlparser.ColTuple: - // id in (1, 2, id), always true. - rule = HeuristicRules["ARG.014"] - return false, nil case sqlparser.ValTuple: // IN (NULL) for _, v := range r { @@ -2651,6 +2647,11 @@ func (q *Query4Audit) RuleIn() Rule { case *sqlparser.NullVal: rule = HeuristicRules["ARG.004"] return false, nil + + case *sqlparser.ColName: + // id in (1, 2, id), always true. + rule = HeuristicRules["ARG.014"] + return false, nil } } if len(r) > common.Config.MaxInCount { -- GitLab