DEV Community

Mads Hansen
Mads Hansen

Posted on

Natural-language SQL breaks quietly when schema context goes stale

Natural-language SQL breaks quietly when schema context goes stale.

The model may still produce SQL that looks reasonable.

The query may even run.

But if a column was renamed, a relationship changed, a view gained new filtering logic, or a metric moved to an approved surface, the answer can be wrong in a way that is hard to spot.

For MCP database servers, schema drift detection should be part of the tool contract.

Practical things I would want in production:

  • schema/context version on every tool result
  • metadata refresh timestamp
  • migration/catalog hash where possible
  • detection for changed tables/views/columns
  • refusal when context is stale
  • audit trail tying query output to the context used

Longer version: Schema drift detection for MCP database servers

The model cannot safely reason from yesterday's database shape.

Top comments (0)