Skip running empty set of queries

This commit is contained in:
Murat Kabilov
2017-08-01 10:09:09 +02:00
committed by GitHub
parent 6183203f4d
commit 1211220208
+4
View File
@@ -118,6 +118,10 @@ func (s DefaultUserSyncStrategy) alterPgUser(user spec.PgUser, db *sql.DB) (err
grantStmt := produceGrantStmt(user)
resultStmt = append(resultStmt, grantStmt)
}
if len(resultStmt) == 0 {
return nil
}
query := fmt.Sprintf(doBlockStmt, strings.Join(resultStmt, ";"))
_, err = db.Query(query) // TODO: Try several times