Module: Arel::Visitors::PgAnyWhereVisitor
- Defined in:
- lib/pg_any_where/arel_visitor.rb
Overview
Arel visitor extension that rewrites IN / NOT IN predicates for PostgreSQL to use the array operators ANY and ALL.
Prepended onto Arel::Visitors::PostgreSQL via PgAnyWhere.patch!.
SQL shape produced:
-- non-empty, inclusive
"table"."column" = ANY($1::integer[])
-- empty, inclusive (no 1=0 footgun)
"table"."column" = ANY(ARRAY[]::integer[])
-- non-empty, exclusive
"table"."column" != ALL($1::integer[])
-- empty, exclusive (no 1=1 footgun)
"table"."column" != ALL(ARRAY[]::integer[])
rubocop:disable Naming/MethodName – Arel visitor method names mirror node class names