diff options
author | 2023-09-11 15:16:52 +0200 | |
---|---|---|
committer | 2023-09-11 15:16:52 +0200 | |
commit | 7011f57b09fc03bde9d48fef191e904110c09c4b (patch) | |
tree | 1118192d6c8d49715d2293ee19c79e50b89de64e /vendor/github.com/uptrace/bun/query_update.go | |
parent | [chore]: Bump golang.org/x/net from 0.14.0 to 0.15.0 (#2193) (diff) | |
download | gotosocial-7011f57b09fc03bde9d48fef191e904110c09c4b.tar.xz |
[chore] bump bun v1.1.14 -> v1.1.15 (#2195)
Diffstat (limited to 'vendor/github.com/uptrace/bun/query_update.go')
-rw-r--r-- | vendor/github.com/uptrace/bun/query_update.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/vendor/github.com/uptrace/bun/query_update.go b/vendor/github.com/uptrace/bun/query_update.go index 708bcfbce..146d695b8 100644 --- a/vendor/github.com/uptrace/bun/query_update.go +++ b/vendor/github.com/uptrace/bun/query_update.go @@ -271,10 +271,18 @@ func (q *UpdateQuery) mustAppendSet(fmter schema.Formatter, b []byte) (_ []byte, switch model := q.tableModel.(type) { case *structTableModel: + pos := len(b) b, err = q.appendSetStruct(fmter, b, model) if err != nil { return nil, err } + + // Validate if no values were appended after SET clause. + // e.g. UPDATE users SET WHERE id = 1 + // See issues858 + if len(b) == pos { + return nil, errors.New("bun: empty SET clause is not allowed in the UPDATE query") + } case *sliceTableModel: return nil, errors.New("bun: to bulk Update, use CTE and VALUES") default: |