Why this matters
If the intent really is a cartesian product, write `JOIN ... ON true` so the intent reads back. PostgreSQL rejects `INNER JOIN b` without `ON`/`USING`, so the explicit `CROSS JOIN` is the only form this rule sees in practice.
Examples
Incorrect
SELECT * FROM a CROSS JOIN b;Correct
SELECT * FROM a JOIN b ON a.id = b.id;SELECT * FROM a JOIN b ON true; -- intentional cartesianConfigure it
// eslint.config.js
import postgresql from "eslint-plugin-postgresql";
export default [
{
files: ["**/*.sql"],
languageOptions: {
parser: postgresql.configs.recommended.languageOptions.parser,
},
plugins: { postgresql },
rules: {
"postgresql/no-cross-join": "warn",
},
},
]; Options
Edit the SQL — only no-cross-join is enabled.
Pre-filled with the first incorrect example. Toggle off in the rule shelf to see how the diagnostic disappears.
Diagnostics
No issues found.
2 rules enabled.
Rule under test
no-cross-join — plus no-syntax-error as a safety net.