drupal 7, db_select(), strange behavior : malformed query
If the array is empty, you'll get WHERE foo IN (). That's invalid SQL syntax.

To prevent, use a conditional:

if (!empty($values)) {
  // Run the query.
}