Why this matters
`CREATE TABLE foo` resolves through `search_path` and may land in an unintended schema. This rule is off by default in `configs.recommended` because many projects intentionally keep everything in `public`; enable it explicitly when you organize by schema.
Examples
Incorrect
CREATE TABLE users (id bigint PRIMARY KEY);Correct
CREATE TABLE app.users (id bigint PRIMARY KEY);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/require-schema-qualified-table": "warn",
},
},
]; Options
Edit the SQL — only require-schema-qualified-table 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
require-schema-qualified-table — plus no-syntax-error as a safety net.