def double_quote(value)
      return if value.nil?

      case value.to_s
        # Ignore keys that contain double quotes or a Arel.star (*)[all columns]
        # or if a table has already been explicitly declared (ex: users.id)
      when "*", /((^".+"$)|(^[[:alpha:]]+\.[[:alnum:]]+))/
        value
      else
        PG::Connection.quote_ident(value.to_s)
      end
    end
def double_quote(value)
      return if value.nil?

      case value.to_s
        # Ignore keys that contain double quotes or a Arel.star (*)[all columns]
        # or if a table has already been explicitly declared (ex: users.id)
      when "*", /((^".+"$)|(^[[:alpha:]]+\.[[:alnum:]]+))/
        value
      else
        PG::Connection.quote_ident(value.to_s)
      end
    end
Ensures the given value is properly double quoted.
 This also ensures we don't have conflicts with reversed keywords.

 IE: `user` is a reserved keyword in PG. But `"user"` is allowed and works the same
     when used as an column/tbl alias.