diff --git a/database/sql_helper.go b/database/sql_helper.go index 299043c82fc0a4842c11608c96967918939a17cc_ZGF0YWJhc2Uvc3FsX2hlbHBlci5nbw==..55a45a234677bd4103fc4aadb0bfee0ab9aa3a8c_ZGF0YWJhc2Uvc3FsX2hlbHBlci5nbw== 100644 --- a/database/sql_helper.go +++ b/database/sql_helper.go @@ -77,15 +77,17 @@ table string, colFrom string, colTo string, colFromValue string, colToValues []string, ) error { - // Upsert ts les couples - q := sq.Insert(table). - Columns(colFrom, colTo) - for _, value := range colToValues { - q = q.Values(colFromValue, value) - } - q = q.Suffix("ON CONFLICT DO NOTHING") - if _, err := h.Exec(q); err != nil { - return err + if len(colToValues) != 0 { + // Upsert ts les couples + q := sq.Insert(table). + Columns(colFrom, colTo) + for _, value := range colToValues { + q = q.Values(colFromValue, value) + } + q = q.Suffix("ON CONFLICT DO NOTHING") + if _, err := h.Exec(q); err != nil { + return err + } } filter := sq.And{sq.Eq{colFrom: colFromValue}}