From eed9966ad6cb2e6b0828733ab50cc133f16fc332 Mon Sep 17 00:00:00 2001 From: Unknwon Date: Wed, 9 Mar 2016 23:18:39 -0500 Subject: #2727 fix incompatible SQL in PostgreSQL --- models/org.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'models') diff --git a/models/org.go b/models/org.go index 1fee4f522d..c2665902ad 100644 --- a/models/org.go +++ b/models/org.go @@ -1071,11 +1071,10 @@ WHERE team_user.org_id = ? AND team_user.uid = ?`, org.Id, userID).Find(&teams); } repos := make([]*Repository, 0, 5) - if err = x.Sql(`SELECT repository.* FROM repository + if err = x.Sql(fmt.Sprintf(`SELECT repository.* FROM repository INNER JOIN team_repo ON team_repo.repo_id = repository.id -WHERE (repository.owner_id = ? AND repository.is_private = ?) OR team_repo.team_id IN (?) -GROUP BY repository.id`, - org.Id, false, strings.Join(teamIDs, ",")).Find(&repos); err != nil { +WHERE (repository.owner_id = ? AND repository.is_private = ?) OR team_repo.team_id IN (%s) +GROUP BY repository.id`, strings.Join(teamIDs, ",")), org.Id, false).Find(&repos); err != nil { return fmt.Errorf("get repositories: %v", err) } org.Repos = repos -- cgit v1.2.3