aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-10-30 10:17:40 +0100
committerGitHub <noreply@github.com>2021-10-30 10:17:40 +0100
commit76a3190b8a988e18a6b5d66dcc7324f04d83342f (patch)
tree0e3398cebd02d7c32f1da4895a71e8037e22b165 /models
parentf5bb788c4e6bff0593cc0dea14693a1bc667a04d (diff)
downloadgitea-76a3190b8a988e18a6b5d66dcc7324f04d83342f.tar.gz
gitea-76a3190b8a988e18a6b5d66dcc7324f04d83342f.zip
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>
Diffstat (limited to 'models')
-rw-r--r--models/consistency.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/models/consistency.go b/models/consistency.go
index 8af884365e..b9b590cfd4 100644
--- a/models/consistency.go
+++ b/models/consistency.go
@@ -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")
}