Class: PgCanary::Rules::CartesianJoin
- Defined in:
- lib/pg_canary/rules/definitions/cartesian_join.rb
Overview
A JOIN with no join condition — an explicit CROSS JOIN between real tables, or a comma join whose WHERE clause never connects the tables — produces a cross product whose row count is the product of both sides.
Instance Method Summary collapse
Methods inherited from Base
all, check, default_enabled, enabled?, #initialize, option, options, rule_name
Constructor Details
This class inherits a constructor from PgCanary::Rules::Base
Instance Method Details
#check ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/pg_canary/rules/definitions/cartesian_join.rb', line 13 def check detections = [] each_scope do |scope| scope.stmt.from_clause.each do |item| each_join(item.unwrap) do |join| detections << join_detection(join) if unconditioned?(join) end end detections << comma_detection(scope) if comma_cartesian?(scope) end detections end |