{
  "id": 8199605,
  "title": "Query Fingerprints or Literal Text Diffs: A Debate for Agent SQL Regression",
  "url": "https://urgent.news/2026/09/18/query-fingerprints-or-literal-text-diffs-a-debate-for-agent-sql",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-09-18T07:45:27.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/dataio_4921/query-fingerprints-or-literal-text-diffs-a-debate-for-agent-sql-regression-4emi"
  },
  "original_language": "en",
  "account": "A debate rages over whether agent-written SQL queries should be evaluated based on their fingerprint or literal text differences. The article presents a two-sided argument with supporting evidence and a decision rule. The key points are:\n\n1. Agent-written SQL often changes formatting, such as whitespace, alias names, literal formatting, and CTE labels, while preserving the join graph and predicates. This makes raw text comparison unreliable for regression gates.\n\n2. Fingerprint comparison focuses on the underlying workload identity, stripping literals, comments, and whitespace. Equivalent restyles result in green CI tests, but join, filter, or projection changes cause a fingerprint mismatch and CI failure. However, this approach loses information about specific literals.\n\n3. Literal text diff comparison ensures every changed character represents a potential new table, broader predicate, or function with different volatility. git diff on sqlfmt output is simple, understandable for compliance, and does not rely on a maintainable normalizer. However, this approach generates noise from formatting differences and struggles with bind-parameter style.\n\n4. The article proposes a dual-gate fixture that stores a golden fingerprint and a canonical text file. The CI system can then apply different rules per query class using distinct exit codes. The fixture is labeled \"unexecuted\" until a controlled replica loads the schema.\n\nIn summary, the debate centers on whether to normalize SQL to a fingerprint for identity verification or keep literal text diffs to ensure changes are intentional. Both approaches have their merits and drawbacks, and a dual-gate solution may provide a balanced approach.",
  "summary": "A Tuesday review queue held three agent rewrites of the same reporting query, each formatted differently and each carrying a new bind value. The text diff looked noisy, the join graph looked unchanged, and the reviewer had twelve minutes before a freeze window. None of the candidates touched writes, yet one rewrite moved a date filter from orders.created_at onto a denormalized snapshot column.…",
  "key_points": [
    "Agent-written SQL queries change formatting while preserving join graph and predicates",
    "Fingerprint comparison focuses on underlying workload identity, ignoring literals and formatting",
    "Literal text diff comparison ensures every changed character represents a potential new element"
  ],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}