Follow up from limit the number of values for `IN` clause in queries
Overview
Follow-up from #432828 (closed)
As we merged a new cop to prevent the use of .pluck
without a limit, now we gained some time to think of a more feasible solution to detect and avoid problems related to .pluck
.
What?
Some suggestions from #432828 (comment 1670551402):
- Add a new patch to Postgres connection adapter that checks the query length and can either log or throw an error if the length is extremely high.
- Use Rspec to detect the use of
.pluck
(or any other method?) that can flood PostgresIN
clause - Patching active record in Rspec to log the use ofIN
without a proper limit
Edited by Leonardo da Rosa