Why this matters
Join columns are implicit. Add a column with a matching name to either side later and the join silently changes shape. Use `JOIN ... USING (...)` or `JOIN ... ON ...`.
Examples
Incorrect
SELECT * FROM a NATURAL JOIN b;Correct
SELECT * FROM a JOIN b USING (id);SELECT * FROM a JOIN b ON a.id = b.id;Configure 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-natural-join": "error",
},
},
]; Options
Edit the SQL — only no-natural-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-natural-join — plus no-syntax-error as a safety net.