def literal_key(key)
      case key
      when TrueClass  then "'t'"
      when FalseClass then "'f'"
      when Numeric    then key
      else
        key = key.to_s
        key.start_with?("'") && key.end_with?("'") ? key : "'#{key}'"
      end
    end
def literal_key(key)
      case key
      when TrueClass  then "'t'"
      when FalseClass then "'f'"
      when Numeric    then key
      else
        key = key.to_s
        key.start_with?("'") && key.end_with?("'") ? key : "'#{key}'"
      end
    end
Ensures the key is properly single quoted and treated as a actual PG key reference.