title: How to use ANY instead of IN in a WHERE clause?
body: <p>I used to have a query like in Rails:</p>
  <pre><code>MyModel.where(id: ids)
  </code></pre>
  <p>Which generates sql query like:</p>
  <pre><code>SELECT &quot;my_models&quot;.* FROM &quot;my_models&quot;
  WHERE  &quot;my_models&quot;.&quot;id&quot; IN (1, 28, 7, 8, 12)
  </code></pre>
  <p>Now I want to change this to use <code>ANY</code> instead of <code>IN</code>. I created this:</p>
  <pre><code>MyModel.where(&quot;id = ANY(VALUES(#{ids.join '),('}))&quot;
  </code></pre>
  <p>Now when I use empty array <code>ids = []</code> I get the folowing error:</p>
  <pre><code>MyModel Load (53.0ms)  SELECT &quot;my_models&quot;.* FROM &quot;my_models&quot;  WHERE (id = ANY(VALUES()))
  ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: syntax error at or near &quot;)&quot;
  ActiveRecord::StatementInvalid: ActiveRecord::JDBCError: org.postgresql.util.PSQLException: ERROR: syntax error at or near &quot;)&quot;
  Position: 75: SELECT &quot;social_messages&quot;.* FROM &quot;social_messages&quot;  WHERE (id = ANY(VALUES()))
      from arjdbc/jdbc/RubyJdbcConnection.java:838:in `execute_query'
  </code></pre>