arXiv:2610.41090cs.AIOct 2026

Manuscript Offprint

arXiv:2610.41090

Verifying Text-to-SQL Queries under Changing Business Semantics

Genliang Zhu, Xiaobo Chen, Ziyuan Wang, Chu Wang

GENLIANG ZHU, Accentrust, Canada and Georgia Institute of Technology, USA

XIAOBO CHEN, University of Massachusetts Amherst, USA

ZIYUAN WANG, Duke University, USA

CHU WANG, Accentrust, Canada and University of Illinois Urbana-Champaign, USA

In text-to-SQL and AI-agent analytics, successful SQL execution does not establish semantic correctness under changing business definitions. We study revalidation of fixed queries after changes to refund attribution, tax treatment, eligible populations and exchange-rate dates. An executable verification profile binds the requested revision and knowledge cutoff to legal counterexample data and exact monetary comparison. A preregistered confirmation on 32 newly authored revision families and two local producer bundles retains 192 query-definition cells: 144 nonconforming, 36 finite-suite agreeing and 12 unresolved. Of the nonconforming cells, 63 agree on the current snapshot. At an eight-ledger budget, obligation-guided checking detects 137 discrepancies versus 127 for generic ordering, a paired difference of 6.9 percentage points (family bootstrap 95% interval [2.1, 13.6]; exact family sign-flip p=0.0156p = 0.0156). Every ledger arm rejects zero of the 36 agreeing cells. Current-obligation and equal-weight scoring match the guided result, identifying coverage rather than revision-specific priority as the observed source of benefit. Controlled assays, a natural-query pilot and repeated samples provide separate mechanism and robustness evidence. A legal discrepancy refutes conformance; agreement remains restricted to the recorded suite. The study establishes an auditable business-semantic revalidation profile within its authored schema and local-model scope.

Additional Key Words and Phrases: text-to-SQL, SQL verification, semantic correctness, business semantics, metric definitions, counterexample testing, semantic drift, AI agents

1 Introduction

Natural-language analytics translates a business question into a query and presents its result. Enterprise questions frequently depend on knowledge outside a schema: which transactions count, when a refund is recognized, whether an amount includes tax, and which date selects an exchange rate. EntSQL directly studies enterprise knowledge grounding [10]. Spider 2.0 studies realistic enterprise text-to-SQL workflows [8], and BIRD emphasizes database content and efficient execution [9]. These capabilities are necessary for useful analytics, but successful execution alone does not establish that a query implements the requested definition.

Consider a January report with knowledge available through February. One approved definition subtracts refunds in their occurrence month; another explicitly restates the original sale month. A database with no refunds yields the same January value under both definitions. A legal February refund against a January sale separates them. A query filtering refunds to January can therefore agree with the new definition on the current database while implementing the old definition. This concerns query meaning, not a claim that the current numeric answer has already become wrong.

Definition updates make the distinction operational. Historical reports, cached SQL, and ad-hoc compositions may survive an update. A new revision does not make every old query invalid: changes can affect an unrelated metric or documentation only, and a user may explicitly request a historical definition. Revalidation must identify the requested interpretation and admissible data before declaring a discrepancy.

Authors' Contact Information: Genliang Zhu, Accentrust, Vancouver, Canada and Georgia Institute of Technology, School of Computer Science, Atlanta, Georgia, USA, research@accentrust.com; Xiaobo Chen, University of Massachusetts Amherst, Amherst, Massachusetts, USA; Ziyuan Wang, Duke University, Durham, North Carolina, USA; Chu Wang, Accentrust, Vancouver, Canada and University of Illinois Urbana-Champaign, Department of Computer Science, Urbana, Illinois, USA.

Table 1. Claims, executed evidence and interpretation. Qualification and future designs do not enlarge the empirical denominator.

ClaimExecuted evidenceInterpretation
Revision-bound con-formanceSeparate policy evaluator, legalitychecks and old/new query-definitionmatrixLegal discrepancy refutes the requestedprofile; passing tests do not provefull-domain conformance.
Coverage componentControlled decomposition;natural-query pilot and repeatedsamplesCurrent-only/equal-weight resultsdistinguish coverage from priorityweighting.
Local confirmation32 new families, two bundles, 192 cells;eight-ledger paired comparison137/144 versus 127/144 detection;authored-schema/local-bundle scope.
Native supportOriginal ParEval, PV-SQL andMetricFlow qualification pathsSupport measurements, not aneffectiveness ranking of completesystems.

Counterexample databases and SQL equivalence evaluation are established research areas. Distilled test suites [17], XData [1], ParEval [2], and SpotIt [7] address accidental agreement. SpotIt+ incorporates database constraints [15]. Building on these foundations, we study how explicit business-definition transitions, temporal applicability and business legality determine revalidation of an already fixed query.

The contribution is business-semantic revalidation of an already fixed query, with explicit evidence about what each tested component adds:

(1) A correctness contract binds query, requested business revision, event time, knowledge cutoff and legal input domain. It preserves valid historical requests and distinguishes a replayable discrepancy from finite agreement or an unresolved result.

(2) An executable temporal/monetary profile constructs legal test obligations from approved definitions and checks them against a separately implemented evaluator. An old/new query-definition matrix distinguishes semantic revisions, documentation-only updates and unrelated metrics.

(3) An empirical decomposition separates generic ordering, current-definition coverage and revision-priority scores. A natural-query pilot, repeated samples and a registered new-family confirmation show coverage benefits under a common budget; matching current-only and equal-weight results identify the measured component.

The profile integrates established counterexample testing, exact arithmetic, constraint-aware verification and greedy coverage around the business-revision contract. Table 1 maps its contract, implementation and empirical findings to their evidence. In the controlled assay the coverage orders coincide; in the confirmation their eight-ledger detection counts coincide, while shorter prefixes can differ.

Direct compilation remains an important alternative. If a trusted metric layer completely expresses a request, executing its approved definition is preferable to asking a model to rediscover it. Our setting concerns existing SQL, heterogeneous interfaces, and compositions requiring revalidation. Native metric compilation and checking an already fixed query are therefore distinct evaluation paths.

Relation to strong alternatives. Distilled suites and ParEval test SQL equivalence using generated databases; SpotIt+ searches for distinguishing instances under database constraints [2, 15, 17].

This profile treats the approved business definition and its temporal applicability as explicit verification inputs for an existing query. The approaches can complement one another: a qualified reference compilation and business-constraint mapping could connect the revision profile to native equivalence checking. Reported native outcomes are limited to the interfaces actually qualified; an unexecuted mapping remains an integration proposal, rather than a baseline failure.

References (12)