From a67cdb164621cbc747a39a5a952a1b974e91cb62 Mon Sep 17 00:00:00 2001 From: liipx Date: Wed, 24 Oct 2018 09:41:13 +0800 Subject: [PATCH] fix #17 --- ast/meta.go | 2 +- ast/testdata/TestPretty.golden | 2 ++ common/cases.go | 3 +++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ast/meta.go b/ast/meta.go index 12a3f81..2762146 100644 --- a/ast/meta.go +++ b/ast/meta.go @@ -95,7 +95,7 @@ func GetMeta(stmt sqlparser.Statement, meta common.Meta) common.Meta { meta[db2] = common.NewDB(db2) } - meta[db1].Table[tb2] = common.NewTable(tb2) + meta[db2].Table[tb2] = common.NewTable(tb2) } return false, nil diff --git a/ast/testdata/TestPretty.golden b/ast/testdata/TestPretty.golden index b333aea..e437b49 100644 --- a/ast/testdata/TestPretty.golden +++ b/ast/testdata/TestPretty.golden @@ -630,6 +630,8 @@ ALTER TABLE t1 CHANGE b a INT NOT NULL; ALTER TABLE t1 CHANGE b a INT NOT NULL; +create table hello.t (id int unsigned); +create table hello. t (id int unsigned); SELECT * FROM film WHERE length = 86; SELECT diff --git a/common/cases.go b/common/cases.go index 6775f4c..46a5ae1 100644 --- a/common/cases.go +++ b/common/cases.go @@ -23,6 +23,9 @@ func init() { // 所有的SQL都要以分号结尾,-list-test-sqls参数会打印这个list,以分号结尾可方便测试 // 如:./soar -list-test-sql | ./soar TestSQLs = []string{ + // DDL + "create table hello.t (id int unsigned);", + // single equality "SELECT * FROM film WHERE length = 86;", // index(length) "SELECT * FROM film WHERE length IS NULL;", // index(length) -- GitLab