Menu

A DELETE with no WHERE deletes every row — and it passes code review
📰

A DELETE with no WHERE deletes every row — and it passes code review

DEV Community: sql·R VIKRAM·6 days ago
#rkOeVwJ1
#devtosql#devto#dev#delete#query
Long article (649 words) — no AI summary yet.
Reading 0:00
15s threshold

A DELETE with no WHERE deletes every row — and it passes code review

The most dangerous line in most codebases is not exotic. It is DELETE FROM products; — a cleanup script that looks harmless, passes review, and wipes a table the day it runs against the wrong database. The same goes for SELECT * FROM orders CROSS JOIN customers; , which pairs every row with every row before anyone notices the report has 300 billion rows.

I built a free skill that catches these before production does: SQL Query Smell Detector.

TL;DR

Hand it a JSON file of queries (or a plain .sql file). A stdlib-only Python script runs deterministic static checks — destructive statements, cartesian joins, index killers, unbounded scans, implicit joins, OR across columns, DISTINCT band-aids — and emits a severity-ranked findings report with a concrete fix per finding. A second script validates the report.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.