Skip to content

Commit c2977a0

Browse files
committed
Quote the table name in CountOrphanedObjects (go-gitea#17487)
Backport go-gitea#17487 CountOrphanedObjects needs to quote the table it is joining with as this table may be `user`. Fix go-gitea#17485 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 6110ddc commit c2977a0

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)