Skip to content

Commit 76a3190

Browse files
authored
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 <[email protected]>
1 parent f5bb788 commit 76a3190

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

models/consistency.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ func DeleteOrphanedIssues() error {
301301
// CountOrphanedObjects count subjects with have no existing refobject anymore
302302
func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) {
303303
return db.GetEngine(db.DefaultContext).Table("`"+subject+"`").
304-
Join("LEFT", refobject, joinCond).
304+
Join("LEFT", "`"+refobject+"`", joinCond).
305305
Where(builder.IsNull{"`" + refobject + "`.id"}).
306306
Count("id")
307307
}

0 commit comments

Comments
 (0)