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
DROP INDEX idx_users;Correct
DROP INDEX CONCURRENTLY idx_users;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
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.
Diagnostics
No issues found.
2 rules enabled.
Rule under test
consistent-drop-index-concurrently — plus no-syntax-error as a safety net.