Symbolic Query Exploration

  • Margus Veanes
  • Pavel Grigorenko
  • Peli de Halleux
  • Nikolai Tillmann
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 5885)


We study the problem of generating a database and parameters for a given parameterized SQL query satisfying a given test condition. We introduce a formal background theory that includes arithmetic, tuples, and sets, and translate the generation problem into a satisfiability or model generation problem modulo the background theory. We use the satisfiability modulo theories (SMT) solver Z3 in the concrete implementation. We describe an application of model generation in the context of the database unit testing framework of Visual Studio.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
  2. 2.
    Binnig, C., Kossmann, D., Lo, E., Özsu, M.T.: Qagen: generating query-aware test databases. In: SIGMOD 2007: Proceedings of the 2007 ACM SIGMOD international conference on Management of data, pp. 341–352. ACM, New York (2007)CrossRefGoogle Scholar
  3. 3.
    Bjørner, N., Tillmann, N., Voronkov, A.: Path feasibility analysis for string-manipulating programs. In: Kowalewski, S., Philippou, A. (eds.) TACAS 2009. LNCS, vol. 5505, pp. 307–321. Springer, Heidelberg (2009)Google Scholar
  4. 4.
    Boyer, R.S., Moore, J.S.: A computational logic handbook. Academic Press Professional, Inc., San Diego (1988)zbMATHGoogle Scholar
  5. 5.
    Chakravarthy, U.S., Grant, J., Minker, J.: Logic-based approach to semantic query optimization. ACM Trans. Database Syst. 15(2), 162–207 (1990)CrossRefGoogle Scholar
  6. 6.
    Chays, D., Shahid, J., Frankl, P.G.: Query-based test generation for database applications. In: Proceedings of the 1st International Workshop on Testing Database Systems (DBTest 2008), pp. 1–6. ACM, New York (2008)CrossRefGoogle Scholar
  7. 7.
    Chinaei, H.R.: An ordered bag semantics of SQL. Master’s thesis, University of Waterloo, Waterloo, Ontario, Canada (2007)Google Scholar
  8. 8.
    Cook, B., Kröning, D., Sharygina, N.: Cogent: Accurate theorem proving for program verification. In: Etessami, K., Rajamani, S.K. (eds.) CAV 2005. LNCS, vol. 3576, pp. 296–300. Springer, Heidelberg (2005)Google Scholar
  9. 9.
    Dantsin, E., Voronkov, A.: Complexity of query answering in logic databases with complex values. In: Adian, S., Nerode, A. (eds.) LFCS 1997. LNCS, vol. 1234, pp. 56–66. Springer, Heidelberg (1997)Google Scholar
  10. 10.
    de Moura, L., Bjørner, N.: Z3: An efficient SMT solver. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 337–340. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  11. 11.
    Deng, Y., Frankl, P., Chays, D.: Testing database transactions with AGENDA. In: ICSE 2005: Proceedings of the 27th international conference on Software engineering, pp. 78–87. ACM, New York (2005)CrossRefGoogle Scholar
  12. 12.
    Emmi, M., Majumdar, R., Sen, K.: Dynamic test input generation for database applications. In: Proceedings of the 2007 International Symposium on Software Testing and Analysis (ISSTA 2007), pp. 151–162. ACM, New York (2007)Google Scholar
  13. 13.
    Jackson, D.: Automating first-order relational logic. SIGSOFT Softw. Eng. Notes 25(6), 130–139 (2000)CrossRefGoogle Scholar
  14. 14.
    Jackson, D.: Software Abstractions. MIT Press, Cambridge (2006)Google Scholar
  15. 15.
    Khalek, S.A., Elkarablieh, B., Laleye, Y.O., Khurshid, S.: Query-aware test generation using a relational constraint solver. In: ASE, pp. 238–247 (2008)Google Scholar
  16. 16.
    Negri, M., Pelagatti, G., Sbattella, L.: Formal semantics of SQL queries. ACM Transactions on Database Systems 17(3), 513–534 (1991)CrossRefMathSciNetGoogle Scholar
  17. 17.
  18. 18.
  19. 19.
    Sheard, T., Stemple, D.: Automatic verification of database transaction safety. ACM Trans. Database Syst. 14(3), 322–368 (1989)CrossRefGoogle Scholar
  20. 20.
    Tillmann, N., de Halleux, J.: Pex - white box test generation for .NET. In: Beckert, B., Hähnle, R. (eds.) TAP 2008. LNCS, vol. 4966, pp. 134–153. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  21. 21.
    Tsai, W.T., Volovik, D., Keefe, T.F.: Automated test case generation for programs specified by relational algebra queries. IEEE Trans. Softw. Eng. 16(3), 316–324 (1990)CrossRefGoogle Scholar
  22. 22.
    Veanes, M., Bjørner, N.: Symbolic bounded conformance checking of model programs. In: Pnueli, A., Virbitskaite, I., Voronkov, A. (eds.) Perspectives of System Informatics (PSI 2009). LNCS. Springer, Heidelberg (2009)Google Scholar
  23. 23.
    Veanes, M., Bjørner, N., Gurevich, Y., Schulte, W.: Symbolic bounded model checking of abstract state machines. Int. J. Software Informatics 3(2-3), 149–170 (2009)Google Scholar
  24. 24.
    Veanes, M., Grigorenko, P., de Halleux, P., Tillmann, N.: Symbolic query exploration. Technical Report MSR-TR-2009-65, Microsoft Research (May 2009)Google Scholar
  25. 25.

Copyright information

© Springer-Verlag Berlin Heidelberg 2009

Authors and Affiliations

  • Margus Veanes
    • 1
  • Pavel Grigorenko
    • 2
  • Peli de Halleux
    • 1
  • Nikolai Tillmann
    • 1
  1. 1.Microsoft ResearchRedmondUSA
  2. 2.Institute of CyberneticsTallinn University of TechnologyTallinnEstonia

Personalised recommendations