From 2cadfbedff935d0edd53c488b6759adfd76fe05f Mon Sep 17 00:00:00 2001 From: wubin1989 <328454505@qq.com> Date: Mon, 18 Dec 2023 00:37:52 +0800 Subject: [PATCH] fix bug --- toolkit/caches/caches.go | 21 +++++++++++++++++++-- version/version.go | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/toolkit/caches/caches.go b/toolkit/caches/caches.go index beb854fb..481ff1c5 100644 --- a/toolkit/caches/caches.go +++ b/toolkit/caches/caches.go @@ -186,8 +186,25 @@ func getTablesPostgres(db *gorm.DB) []string { sql := db.Statement.SQL.String() w := &walk.AstWalker{ Fn: func(ctx interface{}, node interface{}) (stop bool) { - if tableName, ok := node.(*tree.TableName); ok { - tableNames = append(tableNames, tableName.Table()) + //log.Printf("%T", node) + switch expr := node.(type) { + case *tree.TableName: + tableNames = append(tableNames, expr.Table()) + case *tree.Insert: + fmtCtx := tree.NewFmtCtx(tree.FmtSimple) + expr.Table.Format(fmtCtx) + tableName := fmtCtx.String() + tableNames = append(tableNames, tableName) + case *tree.Update: + fmtCtx := tree.NewFmtCtx(tree.FmtSimple) + expr.Table.Format(fmtCtx) + tableName := fmtCtx.String() + tableNames = append(tableNames, tableName) + case *tree.Delete: + fmtCtx := tree.NewFmtCtx(tree.FmtSimple) + expr.Table.Format(fmtCtx) + tableName := fmtCtx.String() + tableNames = append(tableNames, tableName) } return false }, diff --git a/version/version.go b/version/version.go index fbe32f61..cd23109f 100644 --- a/version/version.go +++ b/version/version.go @@ -1,3 +1,3 @@ package version -const Release = "v2.2.0" +const Release = "v2.2.1"