arXiv:cs/0106035v1 [cs.LO] 14 Jun 2001
Polymorphic type inference for the relational algebra Jan Van den Bussche Limburgs Universitair Centrum Belgium
[email protected] Emmanuel Waller LRI, Universite Paris Sud France
[email protected] Abstract We give a polymorphic account of the relational algebra. We introduce a formalism of \type formulas" speci cally tuned for relational algebra expressions, and present an algorithm that computes the \principal" type for a given expression. The principal type of an expression is a formula that speci es, in a clear and concise manner, all assignments of types (sets of attributes) to relation names, under which a given relational algebra expression is well-typed, as well as the output type that expression will have under each of these assignments. Topics discussed include complexity and polymorphic expressive power.
1
Introduction
The operators of the relational algebra (the basis of all relational query languages) are polymorphic. We can take the natural join of any two relations, regardless of their sets of attributes. We can take the union of any two relations over the same set of attributes. We can take the cartesian product of 1
any two relations having no attributes in common. We can perform a selection A