Ensure that all IN limits are called with at least one element

Limiting to IN with an empty arrayref generates the invalid SQL
"main.SomeField IN ()"; this was introduced most notably in 13ce5b02,
for charts with no results, but also applies to the changes in b14df0ee.

Prevent this by either bailing out before applying the limit (in most
existing cases), or by ensuring that the limit contains at least a 0,
making it into a null set.  Whether the situation calls for a no-op
limit (by bailing out early) or a null-set limit (by adding a 0) depends
on the context.
Merge branch '4.2/empty-in-clause' into 4.2-trunk