= Safe tuple relational calculus
<Safe tuple relational calculus> restricts <tuple relational calculus> so that output values come from the finite input relations or explicit constants, with suitable restrictions on quantification. This prevents an apparently simple <database query> from demanding an infinite result over an unrestricted value universe. <Database query safety> is a semantic requirement; merely writing a familiar-looking formula does not ensure it.<Relational Model slides for Database System Concepts by Abraham Silberschatz and others>[slides3.82 and3.86, Safety of Expressions]{ref}
For a finite unary relation $R=\{(1),(3)\}$, the <database query> $\{t:R(t)\land t.x>1\}$ safely returns $\{(3)\}$. In contrast, $\{t:\neg R(t)\}$ over all <integers> requests every other unary <database tuple>, an infinite collection. Restricting negation to tuples already drawn from another finite relation gives an expressible finite <set difference>. Under the usual finite relational model, the safe calculus and <relational algebra> express the same queries.
Back to article page