Skip to content

AM05 — Implicit cross join; use an explicit JOIN clause

Group: Ambiguity · Auto-fixable: no

Comma-separated tables in FROM produce a cross join joined only by the WHERE clause. A missing predicate then yields an accidental cartesian product. An explicit JOIN … ON states the relationship and fails loudly when it is missing.

bad: SELECT * FROM patient, orders WHERE patient.id = orders.patient_id;
good: SELECT * FROM patient JOIN orders ON orders.patient_id = patient.id;

Disable this rule in banshee.toml:

[lint]
exclude = ["AM05"]

Or silence one line with -- noqa: AM05. See Linting.