DBQC Compiler — Query Safety Comparison

28 compile-time checks—8 errors and 20 warnings—that catch silent SQL bugs before they reach your database.

DBQC is a Database Query Compiler; query safety is one part of the compiler's job. It turns structured query definitions into validated SQL, resolving dependencies, schemas, parameters, and dialect syntax for PostgreSQL, MySQL, SQLite, DuckDB, and—with DBQC Pro—Oracle, SQL Server, and DB2.

These checks move repeatable mistakes earlier: an error stops compilation, while a warning makes a risky choice visible in the editor, local development, and CI. That means the database team can spend less time finding preventable query problems and more time on schema design, performance, reliability, and the decisions that require expertise. The checks add feedback before execution; they do not replace database planning or runtime control.

The comparison below shows where DBQC detects each issue relative to the broad categories of tools that claim to validate queries.

A large query graph passes through a validation gateway that captures risky changes before a controlled database deployment.

Tool category Checks
DBQC 28
ORMs 0–3
SQL Linters 0
IDE Plugins 2–4
DB Runtime 3–5

Null & Three-Valued Logic

Check DBQC ORMs Linters IDEs DB Runtime
= NULL / != NULL — always UNKNOWN, use IS NULL ERR — — — —
NOT IN with nullable subquery — silently returns zero rows WARN — — — —

Join Issues

Check DBQC ORMs Linters IDEs DB Runtime
Cartesian join (no predicate) — cross product of all rows WARN — — — —
LEFT JOIN nullified by WHERE — silently converts to INNER WARN — — — —
Unused join source — joined table never referenced WARN — — — —
JOIN ON type mismatch — kills index, MySQL VARCHAR=0 matches all WARN — — ~ —

Aggregation & GROUP BY

Check DBQC ORMs Linters IDEs DB Runtime
Ungrouped column in aggregate — MySQL picks random row ERR — — ~ ~
Aggregate function in WHERE — use HAVING instead ERR — — Yes Yes

Window Functions

Check DBQC ORMs Linters IDEs DB Runtime
Window function in WHERE — needs wrapping subquery ERR — — Yes Yes
Window without ORDER BY — nondeterministic results WARN — — — —

Expression Bugs

Check DBQC ORMs Linters IDEs DB Runtime
Always-true predicate (col = col) — copy-paste mistake WARN — — — —
Always-false predicate (col != col) — always false or NULL WARN — — — —
Contradictory predicates (col='a' AND col='b') — always zero rows WARN — — — —
Integer division truncation — 3/4 = 0, every ratio is wrong WARN — — — —
CASE without ELSE — silently returns NULL WARN — — — —
LIKE without wildcard — equivalent to = with worse perf WARN — — — —
Empty IN list — syntax error or always false WARN — — — ~

DML Safety

Check DBQC ORMs Linters IDEs DB Runtime
DELETE/UPDATE without WHERE — accidental full-table wipe WARN — — ~ —
Write-read conflict (same table) — undefined execution order WARN — — — —

Query Structure

Check DBQC ORMs Linters IDEs DB Runtime
ORDER BY in subquery — silently stripped by optimizer WARN — — — —
Unbounded query (no LIMIT) — memory/timeout bomb WARN — — — —
LIMIT without ORDER BY — nondeterministic pagination WARN — — — —
Redundant DISTINCT — nested DISTINCT, wasted CPU WARN — — — —

Schema & Identifiers

Check DBQC ORMs Linters IDEs DB Runtime
Column not found — with fuzzy "did you mean?" suggestions ERR Yes — Yes Yes
Type mismatch — ColRef type vs schema type ERR Yes — Yes Yes
Column collision in join — ambiguous SELECT * ERR ~ — — ~
Empty / null-byte column name — silent truncation, driver crash ERR — — — —
Identifier exceeds dialect limit — PG: 63, MySQL: 64, Oracle 12c: 30 WARN — — — ~

Legend

Methodology

130 SQL gotchas collected from 80+ published sources (erikdarling.com, red-gate.com, modern-sql.com, brentozar.com, blog.jooq.org, use-the-index-luke.com, SQL Antipatterns by Bill Karwin, and others). Each was evaluated for static detectability from query AST + schema metadata alone. DBQC implements every check that is feasible without runtime data.

"DB Runtime" means the database engine itself rejects the query — but only at execution time, after deployment, with an unhelpful error message. DBQC catches it before compilation completes, with an actionable fix suggestion.