All rules

Safety

postgresql/consistent-drop-index-concurrently

Enforce a consistent stance on `CONCURRENTLY` for `DROP INDEX`.

  • Type suggestion
  • Recommended off
  • Fixable no

Why this matters

Plain `DROP INDEX` takes an `ACCESS EXCLUSIVE` lock on the table. `DROP INDEX CONCURRENTLY` waits for current users instead. The `never` style is for migration tools that wrap each step in `BEGIN`/`COMMIT` — concurrent drops cannot run inside a transaction. Non-index `DROP` statements are out of scope.

Examples

Incorrect

Incorrect
DROP INDEX idx_users;

Correct

Correct
DROP INDEX CONCURRENTLY idx_users;
Correct
DROP INDEX CONCURRENTLY IF EXISTS idx_orders;

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-drop-index-concurrently": [
        "warn",
        {
          style: "always",
        },
      ],
    },
  },
];

Options

style "always" | "never" default: "always"
`always` (default) requires `CONCURRENTLY`. `never` forbids it.
Try this rule

Edit the SQL — only consistent-drop-index-concurrently 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-drop-index-concurrently — 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