One query change, caught before it runs

DBQC is most useful when a query change deserves more feedback than a late integration test can provide. This is a small billing query, but it has the shape of ordinary application work: a schema changes, an infrequently used path still refers to the old name, and the failure would otherwise wait for execution.

A DBQC query definition receives editor feedback, passes through compiler validation, becomes emitted SQL, and is then handed to the application's existing database driver.

1. Define the current schema and the query

The billing schema renamed payment_status to collection_status. The table definition already reflects the new schema; one query did not.

const invoices = table("invoices", {
  id: "uuid", tenant_id: "uuid", due_on: "date",
  collection_status: "text", balance_cents: "int8",
});

const overdueInvoices = invoices
  .where(
    col(invoices, "payment_status", "text") // old name in a real workflow
      .eq(lit("overdue", "text")),
  )
  .select({
    id: col(invoices, "id", "uuid"),
    balanceCents: col(invoices, "balance_cents", "int8"),
  });

This is not a claim that SQL is the problem. The relational intent is clear. The problem is that a query definition, its schema, and the delivery checks need to stay connected as the application changes.

2. See the mismatch where the query is written

The example starts with a query because that is where the work is. Its useful context comes from schema discovery: DBQC has generated the table and column definition from the database catalog. The VS Code extension then recognizes the DBQC table and column reference and shows this local schema diagnostic on the old name:

Column "payment_status" not found in table "invoices"

The compiler supplies the complete structural and dialect checks when the DBQC definition is compiled. In the editor, a compile action sends that definition to DBQC and shows diagnostics plus the emitted SQL—without running the application or opening a database connection. See VS Code Integration for the feature details and limits of the local schema cache.

3. Fix the definition, then inspect the artifact

const overdueInvoices = invoices
  .where(
    col(invoices, "collection_status", "text")
      .eq(lit("overdue", "text")),
  )
  .select({
    id: col(invoices, "id", "uuid"),
    balanceCents: col(invoices, "balance_cents", "int8"),
  });

The compile result contains the emitted target SQL, ordered parameters, result schema, errors, and warnings. That gives a team several useful choices:

fails the build; and

proof or counterexample rather than a visual diff alone.

4. Execute it with the code already responsible for execution

DBQC returns SQL and ordered parameters. It does not take database credentials, open a connection, start a transaction, or map the application's result rows. Pass the result to the existing driver instead:

const compiled = await Compiler.compile(overdueInvoices, "psql");
const orderedValues = compiled.paramOrder.map(valueForParameter);
const rows = await pg.query(compiled.sql, orderedValues);

The exact execution call remains yours—JDBC, psycopg, node-postgres, sqlx, Skunk, Doobie, or another established tool. DBQC adds evidence around the query change before that call; it is not another runtime data-access layer.

Try this with your own query

The best next step is not to rewrite an application. Choose one query that has real schema, reuse, portability, or review pressure and use the pilot guide to evaluate it. Commercial teams can do that on the Free plan for 30 days; personal and nonprofit use has no time limit within the Free daily allocation.