diff --git a/app/models/role.rb b/app/models/role.rb
index <HASH>..<HASH> 100644
--- a/app/models/role.rb
+++ b/app/models/role.rb
@@ -165,8 +165,8 @@ class Role < ActiveRecord::Base
     end
 
     Permission.joins(:verbs, :resource_type).joins(
-        "left outer join 'permissions_tags' on permissions.id == permissions_tags.permission_id").joins(
-        "left outer join 'tags' on tags.id == permissions_tags.tag_id").where(query_hash).count(to_count, :distinct => true) == item_count
+        "left outer join permissions_tags on permissions.id = permissions_tags.permission_id").joins(
+        "left outer join tags on tags.id = permissions_tags.tag_id").where(query_hash).count(to_count, :distinct => true) == item_count
     # TODO - for now we just compare count - this is dangerous - we need to compare the content
   end
fixing sql error to hopefully work with postgresql