arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2406.09469cs.DB
收藏

关系型 DBMS 针对 SQL 规范的一致性测试

Conformance Testing of Relational DBMS Against SQL Specifications

Shuang Liu, Chenglin Tian, Jun Sun, Ruifeng Wang, Wei Lu, Yongxin Zhao, Yinxing Xue, Junjie Wang, Xiaoyong Du

AI总结:

本文提出用 Prolog 形式化实现 SQL 语义并作为参考 RDBMS,通过差分测试检验 MySQL、TiDB、SQLite 和 DuckDB 的语义一致性,发现 19 个缺陷与 11 处不一致。

摘要:

关系型数据库管理系统(RDBMS)是支撑大量应用的基础软件之一,因此识别这些系统中的缺陷至关重要。目前已有大量关于测试 RDBMS 的积极研究,其中多数采用崩溃或使用蜕变关系作为测试预言。尽管现有方法能够检测 RDBMS 中的缺陷,但它们远不能全面评估 RDBMS 的正确性(即在 SQL 语义方面的正确性)。在本工作中,我们提出了一种测试 RDBMS 语义一致性的方法,即检验其行为是否遵循 SQL 的预期语义。具体而言,我们形式化地定义了 SQL 的语义,并在 Prolog 中实现了这些语义。随后,该 Prolog 实现充当参考 RDBMS,从而能够对现有 RDBMS 进行差分测试。我们将该方法应用于四个广泛使用且经过充分测试的 RDBMS,即 MySQL、TiDB、SQLite 和 DuckDB。总体而言,我们的方法发现了 19 个缺陷和 11 处不一致,它们均与违反 SQL 规范或规范缺失/不明确有关,从而证明了该方法的有效性和适用性。

英文摘要:

A Relational Database Management System (RDBMS) is one of the fundamental software that supports a wide range of applications, making it critical to identify bugs within these systems. There has been active research on testing RDBMS, most of which employ crash or use metamorphic relations as the oracle. Although existing approaches can detect bugs in RDBMS, they are far from comprehensively evaluating the RDBMS's correctness (i.e., with respect to the semantics of SQL). In this work, we propose a method to test the semantic conformance of RDBMS i.e., whether its behavior respects the intended semantics of SQL. Specifically, we have formally defined the semantics of SQL and implemented them in Prolog. Then, the Prolog implementation serves as the reference RDBMS, enabling differential testing on existing RDBMS. We applied our approach to four widely-used and thoroughly tested RDBMSs, i.e., MySQL, TiDB, SQLite, and DuckDB. In total, our approach uncovered 19 bugs and 11 inconsistencies, which are all related to violating the SQL specification or missing/unclear specification, thereby demonstrating the effectiveness and applicability of our approach.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑