Why this matters
An `UPDATE` without `WHERE` rewrites every row in the table. The rule fires only on plain `UPDATE` statements; CTE-driven and view-based updates are not analyzed.
Examples
Incorrect
UPDATE users SET active = false;Correct
UPDATE users SET active = false WHERE id = 1;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-where-in-update": "error",
},
},
]; Options
Edit the SQL — only require-where-in-update 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-where-in-update — plus no-syntax-error as a safety net.