SQLLint - Detecting Semantic Errors in SQL Queries

Stefan, Brass, Christian Goldberg

We investigate classes of SQL queries which are syntactically correct,
but certainly not intended,
no matter for which task the query was written.
For instance, queries that are contradictory,
i.e. always return the empty set, are quite often written in exams of
database
courses. Current database management systems, e.g. Oracle, execute such
queries without any warning.
In this project, we explain serveral classes of such errors,
and develop algorithms for detecting them.
Of course,
questions like the satisfiability are in general undecidable,
but our algorithm can treat a significant subset of SQL queries.
We believe that future database management systems will
perform such checks and that the generated warnings will help to
develop code with fewer bugs in less time.

Load file with "['sqllint'].". (You may add a path before the filename.)
The program runs automatically.

Loading input file with "$r input_file".

Help with "$h".

Version info with "$v".

Quit with "$q". After exiting sqllint, end SWI-Prolog with "halt.".

This program reads the table definitions from CREATE TABLE statements in the input file (see example input file).

Old prototype of the Consistency Check, developed by Elvis Samson 2003: [prolog program]

Very short manual: Runs with SWI-Prolog. Consult file with "[prototyp]." Then type "run.". Enter an SQL (all lowercase) that refers to the tables defined at the end of the program (can easily be exchanged):