Will It Vibe logoWill It Vibe?
SQL-016Medium severity-8 points

No-op WHERE 1=1 guard on UPDATE/DELETE

Part of Code Quality & Syntax, which counts for 20% of the overall score. When this check fires it deducts 8 points from that category, once per scan, no matter how many places it turns up.

What it detects

WHERE 1=1 with no other condition does not restrict which rows are affected at all, so the statement still touches every row. This pattern is a legitimate leftover of dynamically-built queries in application code, but in a static migration/seed file it almost always means a real condition was meant to follow.

Why it matters

WHERE 1=1 with nothing else does not restrict which rows are affected at all: it is equivalent to no WHERE clause. This exact pattern is a legitimate leftover of dynamically-built queries in application code (a base clause that AND conditions get appended to at runtime), but in a static migration or seed file there is no runtime code appending anything further, so it almost always means a real condition was meant to follow and got dropped.

How to fix it

Replace 1=1 with the actual condition that was meant to scope this statement. If the statement genuinely needs to affect every row, remove the WHERE 1=1 entirely and make that explicit with a comment, the same way you would document an intentionally unscoped UPDATE or DELETE.

The paid report includes a ready-to-paste prompt for your AI coding agent for every check it finds, pointed at the exact findings from your scan. See pricing

Does your repo trip this check?

Paste a GitHub URL or drop a project folder. Scans run in your browser and take seconds.

Scan your repo

Related Code Quality & Syntax checks