diff --git a/ast/meta.go b/ast/meta.go index 48323ffd86c1c75c9adb8ea281aeb71770e91c77..9015087ea713d8e666df2df300a6768e2eb5bb2a 100644 --- a/ast/meta.go +++ b/ast/meta.go @@ -297,8 +297,11 @@ func FindEQColsInWhere(node sqlparser.SQLNode) []*common.Column { } default: - if _, ok := eqOperators[node.Operator]; ok { - newCols = FindColumn(node) + switch node.Left.(type) { + case *sqlparser.ColName: + if _, ok := eqOperators[node.Operator]; ok { + newCols = FindColumn(node) + } } } diff --git a/ast/meta_test.go b/ast/meta_test.go index cc685b2202555564a0fdef32f015d635dc50eafa..653491d16919b8fd2cd28c441b31ddcb517b1e9b 100644 --- a/ast/meta_test.go +++ b/ast/meta_test.go @@ -85,7 +85,10 @@ func TestGetParseTableWithStmt(t *testing.T) { func TestFindCondition(t *testing.T) { common.Log.Debug("Entering function: %s", common.GetFunctionName()) - for _, sql := range common.TestSQLs { + sqls := []string{ + `SELECT * FROM film WHERE length % 20 = 4;`, + } + for _, sql := range append(sqls, common.TestSQLs...) { fmt.Println(sql) stmt, err := sqlparser.Parse(sql) // pretty.Println(stmt) diff --git a/doc/install.md b/doc/install.md index a649dd309509b9bb53831cb950727fe375e8a1ea..c808263eb47de5639d52b9dfcb14737ea63a1957 100644 --- a/doc/install.md +++ b/doc/install.md @@ -14,7 +14,7 @@ chmod a+x soar 一般依赖 -* Go 1.10+ +* Go 1.12+ * git 高级依赖(仅面向开发人员)