From 422258e0d5cd216d3dafb6670dee0c93be269120 Mon Sep 17 00:00:00 2001 From: Jianjun Liao <36503113+Leavrth@users.noreply.github.com> Date: Thu, 29 Sep 2022 13:23:45 +0800 Subject: [PATCH] sync-diff-inspector: fix rows unclosed (#681) ref pingcap/tidb-tools#678 --- pkg/dbutil/table.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/dbutil/table.go b/pkg/dbutil/table.go index 63bf83325..211936f91 100644 --- a/pkg/dbutil/table.go +++ b/pkg/dbutil/table.go @@ -78,10 +78,13 @@ func addClusteredAnnotationForPrimaryKey(raw string, replace string) (string, er func isPKISHandle(ctx context.Context, db QueryExecutor, schemaName string, tableName string) bool { query := fmt.Sprintf("SELECT _tidb_rowid FROM %s LIMIT 0;", TableName(schemaName, tableName)) - _, err := db.QueryContext(ctx, query) + rows, err := db.QueryContext(ctx, query) if err != nil && strings.Contains(err.Error(), "Unknown column") { return true } + if rows != nil { + rows.Close() + } return false }