Browse Source

Quote the table name in CountOrphanedObjects (#17487)

CountOrphanedObjects needs to quote the table it is joining with as this table may
be `user`.

Fix #17485

Signed-off-by: Andrew Thornton <art27@cantab.net>
tags/v1.16.0-rc1
zeripath 2 years ago
parent
commit
76a3190b8a
No account linked to committer's email address
1 changed files with 1 additions and 1 deletions
  1. 1
    1
      models/consistency.go

+ 1
- 1
models/consistency.go View File

@@ -301,7 +301,7 @@ func DeleteOrphanedIssues() error {
// CountOrphanedObjects count subjects with have no existing refobject anymore
func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) {
return db.GetEngine(db.DefaultContext).Table("`"+subject+"`").
Join("LEFT", refobject, joinCond).
Join("LEFT", "`"+refobject+"`", joinCond).
Where(builder.IsNull{"`" + refobject + "`.id"}).
Count("id")
}

Loading…
Cancel
Save