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 <art27@cantab.net>
This commit is contained in:
		
							parent
							
								
									718e0db12e
								
							
						
					
					
						commit
						34650b925b
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -302,7 +302,7 @@ func DeleteOrphanedIssues() error { | ||||||
| // CountOrphanedObjects count subjects with have no existing refobject anymore
 | // CountOrphanedObjects count subjects with have no existing refobject anymore
 | ||||||
| func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) { | func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error) { | ||||||
| 	return x.Table("`"+subject+"`"). | 	return x.Table("`"+subject+"`"). | ||||||
| 		Join("LEFT", refobject, joinCond). | 		Join("LEFT", "`"+refobject+"`", joinCond). | ||||||
| 		Where(builder.IsNull{"`" + refobject + "`.id"}). | 		Where(builder.IsNull{"`" + refobject + "`.id"}). | ||||||
| 		Count("id") | 		Count("id") | ||||||
| } | } | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue