All rules
Style
postgresql/
Enforce a consistent stance on the explicit `OUTER` keyword in `LEFT/RIGHT/FULL OUTER JOIN`.
Why this matters
PostgreSQL accepts `LEFT JOIN` as shorthand for `LEFT OUTER JOIN`. The `always` style spells `OUTER` out so the join shape is unmistakable; the `never` style drops `OUTER`. `INNER JOIN` and `CROSS JOIN` are out of scope.
Examples
Incorrect
SELECT u.id FROM users u LEFT JOIN orders o ON o.user_id = u.id;SELECT u.id FROM users u RIGHT JOIN orders o ON o.user_id = u.id;SELECT u.id FROM users u FULL JOIN orders o ON o.user_id = u.id;Correct
SELECT u.id FROM users u LEFT OUTER JOIN orders o ON o.user_id = u.id;SELECT u.id FROM users u FULL OUTER JOIN orders o ON o.user_id = u.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/consistent-explicit-outer-join": [
"warn",
{
style: "always",
},
],
},
},
]; Options
Edit the SQL — only consistent-explicit-outer-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
consistent-explicit-outer-join — plus no-syntax-error as a safety net.