From 4ee31813b4fcb653b95abc195841715b336bf8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Fri, 22 Mar 2019 11:29:44 +0800 Subject: [PATCH] =?UTF-8?q?=E9=81=BF=E5=85=8Dmysql=20=5F=20=E6=98=AF?= =?UTF-8?q?=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/cloudcommon/db/metadata.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/cloudcommon/db/metadata.go b/pkg/cloudcommon/db/metadata.go index 42504cbb76..4f2e7bc2d6 100644 --- a/pkg/cloudcommon/db/metadata.go +++ b/pkg/cloudcommon/db/metadata.go @@ -288,7 +288,7 @@ func (manager *SMetadataManager) SetAll(ctx context.Context, obj IModel, store m } records := []SMetadata{} - q := manager.Query().Equals("id", idStr).NotLike("key", SYS_TAG_PREFIX+"%") + q := manager.Query().Equals("id", idStr).NotLike("key", `\_\_%`) //避免删除系统内置的metadata, _ 在mysql里面有特殊含义,需要转义 switch delRange { case TAG_DELETE_RANGE_USER: q = q.Like("key", USER_TAG_PREFIX+"%")