go back

Volume 18, No. 7

Detecting Schema-Related Logic Bugs in Relational DBMSs via Equivalent Database Construction

Authors:
Jiansen Song, Wensheng Dou, Yingying Zheng, Yu Gao, Ziyu Cui, Wei Wang, Jun Wei

Abstract

Relational Database Management Systems (DBMSs) provide flexible DDL (Data Definition Language) statements that enable the creation, modification, and deletion of database schemas. In addition to database schemas, relational DBMSs typically manage various schema-related information internally, e.g., schema changes, tablespace allocation, and block-level data layout. However, incorrect implementations related to schema-related information maintenance and utilization can introduce schema-related logic bugs. These bugs can cause DQL (Data Query Language) statements to return incorrect query results and DML (Data Manipulation Language) statements to create incorrect database states. Existing approaches mainly focus on detecting logic bugs in DQL statements, but are ineffective in detecting schema-related logic bugs. In this paper, we propose a novel and general testing approach, DDLCheck , to effectively detect schema-related logic bugs in relational DBMSs. We first generate a complex DDL sequence 𝑠𝑒𝑞 𝑔𝑒𝑛 that consists of various types of DDL statements, and then synthesize a rather simple DDL sequence 𝑠𝑒𝑞 𝑠𝑦𝑛 , which utilizes CREATE statements to create the same database schema as 𝑠𝑒𝑞 𝑔𝑒𝑛 . Executing the same SQL statements on the two databases created by 𝑠𝑒𝑞 𝑔𝑒𝑛 and 𝑠𝑒𝑞 𝑠𝑦𝑛 should yield the same execution results. Any discrepancy between their execution results indicates a schema-related logic bug. To improve the testing efficiency of DDLCheck , we further design a DDL-sequence-oriented testing optimization strategy, which can help DDLCheck explore diverse schema-related information and detect schema-related logic bugs quickly. We implement and evaluate DDLCheck on six widely-used relational DBMSs. We have detected 34 bugs in these DBMSs, of which 29 bugs have been confirmed as previously unknown bugs and 9 bugs have been fixed.

PVLDB is part of the VLDB Endowment Inc.

Privacy Policy