From ea0e68f25c1103cd25e509b186c90b99856d3ce8 Mon Sep 17 00:00:00 2001 From: Leon Zhang Date: Fri, 22 Jan 2021 23:53:15 +0800 Subject: [PATCH] by pass sub querey for ARG.014, ARG.004, ARG.005 --- advisor/heuristic.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/advisor/heuristic.go b/advisor/heuristic.go index 511e556..a43c1ab 100644 --- a/advisor/heuristic.go +++ b/advisor/heuristic.go @@ -2636,6 +2636,10 @@ func (q *Query4Audit) RuleIn() Rule { switch strings.ToLower(n.Operator) { case "in": switch r := n.Right.(type) { + case *sqlparser.Subquery: + // 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"] @@ -2653,6 +2657,8 @@ func (q *Query4Audit) RuleIn() Rule { rule = HeuristicRules["ARG.005"] return false, nil } + //default: // debug + // fmt.Println("Type: ", reflect.TypeOf(n.Right).String()) } case "not in": switch r := n.Right.(type) { -- GitLab