Translating Canonical SQL to Imperative Code in Coq

03/16/2022
by   Véronique Benzaken, et al.
0

SQL is by far the most widely used and implemented query language. Yet, on some key features, such as correlated queries and NULL value semantics, many implementations diverge or contain bugs. We leverage recent advances in the formalization of SQL and query compilers to develop DBCert, the first mechanically verified compiler from SQL queries written in a canonical form to imperative code. Building DBCert required several new contributions which are described in this paper. First, we specify and mechanize a complete translation from SQL to the Nested Relational Algebra which can be used for query optimization. Second, we define Imp, a small imperative language sufficient to express SQL and which can target several execution languages including JavaScript. Finally, we develop a mechanized translation from the nested relational algebra to Imp, using the nested relational calculus as an intermediate step.

READ FULL TEXT

page 23

page 33

page 34

research
03/25/2020

A Formalization of SQL with Nulls

SQL is the world's most popular declarative language, forming the basis ...
research
02/22/2022

Relational Algebra and Calculus with SQL Null Values

The logic of nulls in databases has been subject of investigation since ...
research
06/23/2023

Relational Playground: Teaching the Duality of Relational Algebra and SQL

Students in introductory data management courses are often taught how to...
research
10/12/2020

PATSQL: Efficient Synthesis of SQL Queries from Example Tables with Quick Inference of Projected Columns

SQL is one of the most popular tools for data analysis and used by an in...
research
08/31/2020

SparkGOR: A unified framework for genomic data analysis

Motivation: Our goal was to combine the capabilities of Spark and GOR in...
research
07/23/2021

Comprehending nulls

The Nested Relational Calculus (NRC) has been an influential high-level ...
research
05/06/2019

Mixing set and bag semantics

The conservativity theorem for nested relational calculus implies that q...

Please sign up or login with your details

Forgot password? Click here to reset