Reflective Programming in the Relational Algebra

This paper introduces a reflective extension of the relational algebra. Reflection is achieved by storing and manipulating relational algebra programs as relations and by adding a LISP-like evaluation operation to the algebra. We first show that this extension, which we call the reflective algebra, can serve as a unifying formalization of various forms of procedural data management which have been considered in database systems research. We then study the expressive power and complexity of the reflective algebra. In particular, we establish a close correspondence between reflection and bounded looping, and between tail-recursive reflection and unbounded looping. These correspondences yield new logical characterizations of PTIME and PSPACE.