diff --git a/server/channels/store/sqlstore/user_store.go b/server/channels/store/sqlstore/user_store.go index cc63bc038a644..729fc151520ef 100644 --- a/server/channels/store/sqlstore/user_store.go +++ b/server/channels/store/sqlstore/user_store.go @@ -2140,7 +2140,11 @@ func (us SqlUserStore) IsEmpty(excludeBots bool) (bool, error) { From("Users") if excludeBots { - builder = builder.LeftJoin("Bots ON Users.Id = Bots.UserId").Where("Bots.UserId IS NULL") + if us.DriverName() == model.DatabaseDriverPostgres { + builder = builder.LeftJoin("Bots ON Users.Id = Bots.UserId").Where("Bots.UserId IS NULL") + } else { + builder = builder.Where(sq.Expr("Users.Id NOT IN (SELECT UserId FROM Bots)")) + } } builder = builder.Suffix(")")