All rules

Style

postgresql/consistent-explicit-outer-join

Enforce a consistent stance on the explicit `OUTER` keyword in `LEFT/RIGHT/FULL OUTER JOIN`.

  • Type layout
  • Recommended off
  • Fixable yes

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

Incorrect
SELECT u.id FROM users u LEFT JOIN orders o ON o.user_id = u.id;
Incorrect
SELECT u.id FROM users u RIGHT JOIN orders o ON o.user_id = u.id;
Incorrect
SELECT u.id FROM users u FULL JOIN orders o ON o.user_id = u.id;

Correct

Correct
SELECT u.id FROM users u LEFT OUTER JOIN orders o ON o.user_id = u.id;
Correct
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

style "always" | "never" default: "always"
`always` (default) requires the explicit `OUTER`. `never` removes it.
Try this rule

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.

0 errors 0 warnings parse 0ms · rules 0ms
Diagnostics

No issues found.

2 rules enabled.

Rule under test consistent-explicit-outer-join — plus no-syntax-error as a safety net.
eslint-plugin-postgresql

An ESLint plugin that lints .sql files with real PostgreSQL grammar and a curated set of best-practice rules.

© 2026 eslint-plugin-postgresql contributors Built on libpg-query · PostgreSQL 17