adamchainz / django-perf-rec

Keep detailed records of the performance of your Django code.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`IN` queries should not distinguish between single and multiple value variants

danpalmer opened this issue · comments

Currently, if an IN used in a query has a single value it's rendered in to the test file as #, and if it has multiple it's rendered as .... This means that if a test changes from querying for 1 value to querying for n > 1, a test failure will be recorded.

Given the nature of IN and how it is used for filtering, this difference between 1 and n > 1 is not a useful distinction to make. It may indicate differences in test behaviour, but that difference is no different to a change from 2 to 3 values in the IN clause, which would not be caught by django-perf-rec.

My recommendation is to render all IN clauses as IN (...) even if they only have a single value passed. The alternative would be to render these clauses as IN (#, #), with the same number of values passed in, thus being more specific about the query being used.