Inferring a Hierarchical Input Type for Plug-and-Play SQL
摘要
Plug-and-play queries simplify the process of writing SQL queries. In plug-and-play SQL a programmer uses a query guard to specify a query’s input type. The input type is the shape of the data needed by a query. The input type can be matched to a database’s schema to determine whether the query can be safely evaluated. Plug-and-play queries are portable, easier to write, and are type safe. But plug-and-play queries depend on the programmer to provide an input type. Since the programmer could err in sketching the input type this paper shows how to infer the input type from the query itself, thereby removing the need for manual construction. We consider two cases for inferring the input type: with and without knowledge of the database’s schema. Knowing the schema can help to prune the input type, making it smaller and more flexible. This paper describes the inference algorithm.