Why this matters
Two valid stances exist: (a) always use `CREATE INDEX CONCURRENTLY` so the build avoids the table-level `SHARE` lock and doesn't block writers, or (b) never use it so each `CREATE INDEX` can run inside a migration transaction. Pick one with the `style` option. Off by default because the right answer depends on your migration framework.
Examples
Incorrect
CREATE INDEX idx_users_email ON users (email);Correct
CREATE INDEX CONCURRENTLY idx_users_email ON users (email);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-create-index-concurrently": [
"warn",
{
style: "always",
},
],
},
},
]; Options
Edit the SQL — only consistent-create-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-create-index-concurrently — plus no-syntax-error as a safety net.