From cb484a6b0e3d56efc16f52dcfb155579c21c2eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Tue, 4 Dec 2018 22:07:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0sqlchemy?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vendor/yunion.io/x/sqlchemy/update.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/vendor/yunion.io/x/sqlchemy/update.go b/vendor/yunion.io/x/sqlchemy/update.go index 43ac815135..2f6c1c4327 100644 --- a/vendor/yunion.io/x/sqlchemy/update.go +++ b/vendor/yunion.io/x/sqlchemy/update.go @@ -85,12 +85,14 @@ func (us *SUpdateSession) saveUpdate(dt interface{}) (map[string]SUpdateDiff, er k := c.Name() of := ofields[k] nf := fields[k] - if c.IsPrimary() && !c.IsZero(of) { // skip update primary key - primaries[k] = of - continue - } else if c.IsKeyIndex() && !c.IsZero(of) { - keyIndexes[k] = of - continue + if !gotypes.IsNil(of) { + if c.IsPrimary() && !c.IsZero(of) { // skip update primary key + primaries[k] = of + continue + } else if c.IsKeyIndex() && !c.IsZero(of) { + keyIndexes[k] = of + continue + } } nc, ok := c.(*SIntegerColumn) if ok && nc.IsAutoVersion {