Skip to main content

Declarative Debugging of Wrong and Missing Answers for SQL Views

  • Conference paper

Part of the book series: Lecture Notes in Computer Science ((LNTCS,volume 7294))

Abstract

This paper presents a debugging technique for diagnosing errors in SQL views. The debugger allows the user to specify the error type, indicating if there is either a missing answer (a tuple was expected but it is not in the result) or a wrong answer (the result contains an unexpected tuple). This information is employed for slicing the associated queries, keeping only those parts that might be the cause of the error. The validity of the results produced by sliced queries is easier to determine, thus facilitating the location of the error. Although based on the ideas of declarative debugging, the proposed technique does not use computation trees explicitly. Instead, the logical relations among the nodes of the trees are represented by logical clauses that also contain the information extracted from the specific questions provided by the user. The atoms in the body of the clauses correspond to questions that the user must answer in order to detect an incorrect relation. The resulting logic program is executed by selecting at each step the unsolved atom that yields the simplest question, repeating the process until an erroneous relation is detected. Soundness and completeness results are provided. The theoretical ideas have been implemented in a working prototype included in the Datalog system DES.

Work partially supported by the Spanish projects STAMP (TIN2008-06622-C03-01), Prometidos-CM (S2009TIC-1465) and GPD (UCM-BSCH-GR35/10-A-910502).

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. Agrawal, H., Horgan, J.R.: Dynamic program slicing. SIGPLAN Not. 25, 246–256 (1990)

    Article  Google Scholar 

  2. ApexSQL Debug (2011), http://www.apexsql.com/sql_tools_debug.aspx/

  3. Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F.: A Theoretical Framework for the Declarative Debugging of Datalog Programs. In: Schewe, K.-D., Thalheim, B. (eds.) SDKB 2008. LNCS, vol. 4925, pp. 143–159. Springer, Heidelberg (2008)

    Chapter  Google Scholar 

  4. Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F.: Algorithmic Debugging of SQL Views. In: Clarke, E., Virbitskaite, I., Voronkov, A. (eds.) PSI 2011. LNCS, vol. 7162, pp. 77–85. Springer, Heidelberg (2012)

    Google Scholar 

  5. Caballero, R., López-Fraguas, F.J., Rodríguez-Artalejo, M.: Theoretical Foundations for the Declarative Debugging of Lazy Functional Logic Programs. In: Kuchen, H., Ueda, K. (eds.) FLOPS 2001. LNCS, vol. 2024, pp. 170–184. Springer, Heidelberg (2001)

    Chapter  Google Scholar 

  6. Ceri, S., Gottlob, G.: Translating SQL Into Relational Algebra: Optimization, Semantics, and Equivalence of SQL Queries. IEEE Trans. Softw. Eng. 11, 324–345 (1985)

    Article  Google Scholar 

  7. Cui, Y., Widom, J., Wiener, J.L.: Tracing the lineage of view data in a warehousing environment. ACM Trans. Database Syst. 25, 179–227 (2000)

    Article  Google Scholar 

  8. Garcia-Molina, H., Ullman, J.D., Widom, J.: Database Systems: The Complete Book. Prentice Hall PTR, Upper Saddle River (2008)

    Google Scholar 

  9. Glavic, B., Alonso, G.: Provenance for nested subqueries. In: Proceedings of the 12th International Conference on Extending Database Technology: Advances in Database Technology, EDBT 2009, pp. 982–993. ACM, New York (2009)

    Chapter  Google Scholar 

  10. Grefen, P.W., de By, R.A.: A multi-set extended relational algebra: a formal approach to a practical issue. In: ICDE 1994, pp. 80–88. IEEE (1994)

    Google Scholar 

  11. Naish, L.: A Declarative Debugging Scheme. Journal of Functional and Logic Programming 3 (1997)

    Google Scholar 

  12. Nilsson, H.: How to look busy while being lazy as ever: The implementation of a lazy functional debugger. Journal of Functional Programming 11(6), 629–671 (2001)

    Article  MathSciNet  MATH  Google Scholar 

  13. Rapid SQL Developer Debugger (2011), http://docs.embarcadero.com/products/rapid_sql/

  14. Sáenz-Pérez, F.: Datalog Educational System v3.0 (March 2012), http://des.sourceforge.net/

  15. Sáenz-Pérez, F., Caballero, R., García-Ruiz, Y.: A Deductive Database with Datalog and SQL Query Languages. In: Yang, H. (ed.) APLAS 2011. LNCS, vol. 7078, pp. 66–73. Springer, Heidelberg (2011)

    Chapter  Google Scholar 

  16. Shapiro, E.: Algorithmic Program Debugging. ACM Distiguished Dissertation. MIT Press (1982)

    Google Scholar 

  17. Silva, J.: A survey on algorithmic debugging strategies. Advances in Engineering Software 42(11), 976–991 (2011)

    Article  Google Scholar 

  18. SQL, ISO/IEC 9075:1992, 3rd edn. (1992)

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2012 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Caballero, R., García-Ruiz, Y., Sáenz-Pérez, F. (2012). Declarative Debugging of Wrong and Missing Answers for SQL Views. In: Schrijvers, T., Thiemann, P. (eds) Functional and Logic Programming. FLOPS 2012. Lecture Notes in Computer Science, vol 7294. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-642-29822-6_9

Download citation

  • DOI: https://doi.org/10.1007/978-3-642-29822-6_9

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-642-29821-9

  • Online ISBN: 978-3-642-29822-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics