Skip to content

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):

  1. 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.
  2. Use Rspec to detect the use of .pluck (or any other method?) that can flood Postgres IN clause - Patching active record in Rspec to log the use of IN without a proper limit