All rules

Schema

postgresql/require-schema-qualified-table

Require schema-qualified `CREATE TABLE` (off by default).

  • Type suggestion
  • Recommended off
  • Fixable no

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

Incorrect
CREATE TABLE users (id bigint PRIMARY KEY);

Correct

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

This rule has no options.

Try this rule

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.

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

No issues found.

2 rules enabled.

Rule under test require-schema-qualified-table — 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