Download PDFOpen PDF in browser

Verifying SQL queries using theories of tables and relations

19 pagesPublished: May 26, 2024

Abstract

We present a number of first- and second-order extensions to SMT theories specifically aimed at representing and analyzing SQL queries with join, projection, and selection op- erations. We support reasoning about SQL queries with either bag or set semantics for database tables. We provide the former via an extension of a theory of finite bags and the latter via an extension of the theory of finite relations. Furthermore, we add the ability to reason about tables with null values by introducing a theory of nullable sorts based on an extension of the theory of algebraic datatypes. We implemented solvers for these theories in the SMT solver cvc5 and evaluated them on a set of benchmarks derived from public sets of SQL equivalence problems.

Keyphrases: bags, relations, sets, smt, sql, tables

In: Nikolaj Bjørner, Marijn Heule and Andrei Voronkov (editors). Proceedings of 25th Conference on Logic for Programming, Artificial Intelligence and Reasoning, vol 100, pages 445-463.

BibTeX entry
@inproceedings{LPAR2024:Verifying_SQL_queries_using,
  author    = {Mudathir Mahgoub Yahia Mohamed and Andrew Reynolds and Cesare Tinelli and Clark Barrett},
  title     = {Verifying SQL queries using theories of tables and relations},
  booktitle = {Proceedings of 25th Conference on Logic for Programming, Artificial Intelligence and Reasoning},
  editor    = {Nikolaj Bjørner and Marijn Heule and Andrei Voronkov},
  series    = {EPiC Series in Computing},
  volume    = {100},
  publisher = {EasyChair},
  bibsource = {EasyChair, https://easychair.org},
  issn      = {2398-7340},
  url       = {/publications/paper/MWDj},
  doi       = {10.29007/rlt7},
  pages     = {445-463},
  year      = {2024}}
Download PDFOpen PDF in browser