<p>I attended a <a href="http://wwwinfo.deis.unical.it/~frank/biss2009/" rel="nofollow">course on database theory</a> some time ago, but I’m a bit rusty on the topic, so take what follows with a grain of salt.</p>

<p>If by “safe” you mean “domain independent”, then I think you’re out of luck: domain independence is undecidable, as unsatisfiability of relational calculus queries reduces to it.</p>

<p>I believe you can find the details on the slides for the above-mentioned course, and in the book <a href="http://webdam.inria.fr/Alice/" rel="nofollow"><em>Foundations of Databases</em></a> by Abiteboul, Hull, and Vianu.</p>

CC BY-SA 2.5
2010-12-14T04:23:13.677Z
It would be good to mention that the **unsatisfiability** problem is not always undecidable. For instance, deciding the unsatisfiability of a CNF formula is in coNP. Yet, say in first-order logic, unsatisfiability is undecidable.
Sadeq Dousti
CC BY-SA 2.5
2010-12-14T05:39:33.137Z
Yes, I was referring to the satisfiability of relational calculus queries; I edited the answer to clarify that.
Antonio E. Porreca
CC BY-SA 2.5
2010-12-13T22:57:59.573Z
2010-12-14T05:39:57.457Z
2010-12-14T05:39:57.457Z
Antonio E. Porreca
<p>How do I determine whether query in <a href="http://en.wikipedia.org/wiki/Tuple_relational_calculus" rel="nofollow">tuple relational calculus</a> is a <a href="http://en.wikipedia.org/wiki/Tuple_relational_calculus#Safe_queries" rel="nofollow">safe query</a>?</p>

CC BY-SA 2.5
2010-12-13T13:59:17.660Z
Hi @tomp: What is a tuple relational calculus? What is a safe query? While google or wiki provide some explanations, maybe you should put them into your question by using the edit function above. This will makes your question more readable, and increases the possibility of being answered.
Hsien-Chih Chang 張顯之
<pl.programming-languages><db.databases>
How to recognize safe queries in tuple relational calculus?
Tom Pažourek
# How to recognize safe queries in tuple relational calculus?

(Asked by: username_0 on 2010-12-13)

How do I determine whether query in [tuple relational calculus](http://en.wikipedia.org/wiki/Tuple_relational_calculus) is a [safe query](http://en.wikipedia.org/wiki/Tuple_relational_calculus#Safe_queries)?

**Tags:** pl.programming-languages, db.databases
> **Comments:**
> **username_1**: Hi @tomp: What is a tuple relational calculus? What is a safe query? While google or wiki provide some explanations, maybe you should put them into your question by using the edit function above. This will makes your question more readable, and increases the possibility of being answered.  

---

## 1 answers

### Answer by username_2 on 2010-12-13. Score: 4

I attended a [course on database theory](http://wwwinfo.deis.unical.it/~frank/biss2009/) some time ago, but I’m a bit rusty on the topic, so take what follows with a grain of salt.

If by “safe” you mean “domain independent”, then I think you’re out of luck: domain independence is undecidable, as unsatisfiability of relational calculus queries reduces to it.

I believe you can find the details on the slides for the above-mentioned course, and in the book [*Foundations of Databases*](http://webdam.inria.fr/Alice/) by Abiteboul, Hull, and Vianu.

> **Comments:**
> **username_3**: It would be good to mention that the **unsatisfiability** problem is not always undecidable. For instance, deciding the unsatisfiability of a CNF formula is in coNP. Yet, say in first-order logic, unsatisfiability is undecidable.  
> **username_2**: Yes, I was referring to the satisfiability of relational calculus queries; I edited the answer to clarify that.  

---

