Skip to content

Commit 34650b9

Browse files
authored
Quote the table name in CountOrphanedObjects (#17487) (#17488)
Backport #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 718e0db commit 34650b9

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
@@ -302,7 +302,7 @@ func DeleteOrphanedIssues() error {
302302
// CountOrphanedObjects count subjects with have no existing refobject anymore
303303
func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) {
304304
return x.Table("`"+subject+"`").
305-
Join("LEFT", refobject, joinCond).
305+
Join("LEFT", "`"+refobject+"`", joinCond).
306306
Where(builder.IsNull{"`" + refobject + "`.id"}).
307307
Count("id")
308308
}

0 commit comments

Comments
 (0)