Jadwal Sholat

Memuat jadwal sholatโ€ฆ

Ilmu Komputer & AI editorial

Open AccessOA2026

Detecting DBMS Bugs by Constructing Equivalent Representations of Intermediate Query Results

ERIQ: A differential testing approach that exposes DBMS logic bugs through result consistency across VIEW, CTE, and TEMPT representations
Xiaoxu Niu; Gong Chen; Jinfu Chen; Xiaoyuan Xieยท 2026ยท DOI 10.48550/arXiv.2608.30385

The core problem

Database Management Systems (DBMSs) provide multiple SQL mechanisms for representing intermediate query results, notably VIEWs, Common Table Expressions (CTEs), and Temporary Tables (TEMPTs). When these mechanisms are used to express the same intermediate result, the corresponding queries are semantically equivalent and should return consistent results. However, the authors observe that such queries can return inconsistent results, which indicates potential logic bugs in the DBMS. Existing approaches for detecting DBMS logic bugs have never explored result consistency across these equivalent representations. This paper proposes ERIQ, a novel testing approach that detects DBMS logic bugs by checking result consistency across Equivalent Representations of Intermediate Query Results. The core insight is that if a DBMS correctly implements the semantics of VIEW, CTE, and TEMPT, then any query that uses one of these mechanisms to represent a given intermediate result should produce the same final output as a query that uses another mechanism for the same intermediate result. Any discrepancy reveals a logic bug in the DBMS. The paper evaluates ERIQ on four widely used open-source DBMSs:

Innovation

ERIQ was evaluated on four widely used open-source DBMSs: MySQL, MariaDB, Percona, and OceanBase. The evaluation detected a total of 64 bugs. Among them, 63 bugs were confirmed by developers, and two have been fixed at the time of writing. The confirmed bugs include 54 unique and previously unknown logic bugs, and one documentation issue. The distribution of bugs across the DBMSs is not detailed in the abstract, but the high confirmation rate (63 out of 64) indicates the effectiveness of the approach. The fact that 54 bugs were previously unknown highlights the novelty of the testing dimension. The two fixed bugs demonstrate that the reported issues are actionable and lead to improvements in the DBMSs. The results also show that result inconsistency across equivalent representations is a real and prevalent problem in DBMS implementations. The authors likely provide a breakdown of bug types and root causes in the full paper, but the abstract only summarizes the overall counts. The evaluation confirms that ERIQ can uncover deep logic bugs that traditional testing methods might miss.
Database Management Systems (DBMSs) provide multiple SQL mechanisms for representing intermediate query results, notably VIEWs, Common Table Expressions (CTEs), and Temporary Tables (TEMPTs). When these mechanisms are used to express the same intermediate result, the corresponding queries are semantically equivalent and should return consistent results. However, the authors observe that such queries can return inconsistent results, which indicates potential logic bugs in the DBMS. Existing approaches for detecting DBMS logic bugs have never explored result consistency across these equivalent representations. This paper proposes ERIQ, a novel testing approach that detects DBMS logic bugs by checking result consistency across Equivalent Representations of Intermediate Query Results. The core insight is that if a DBMS correctly implements the semantics of VIEW, CTE, and TEMPT, then any query that uses one of these mechanisms to represent a given intermediate result should produce the same final output as a query that uses another mechanism for the same intermediate result. Any discrepancy reveals a logic bug in the DBMS. The paper evaluates ERIQ on four widely used open-source DBMSs: MySQL, MariaDB, Percona, and OceanBase. In total, ERIQ detected 64 bugs, 63 of which were confirmed by developers, and two have been fixed. Among the confirmed bugs, 54 were unique and previously unknown logic bugs, and one was a documentation issue. This work introduces a new dimension for DBMS testing and demonstrates its effectiveness in practice.
ERIQ operates by constructing SQL variants that represent the same intermediate query result using a VIEW, a CTE, or a TEMPT. The approach consists of three main steps: (1) generating a base query that computes an intermediate result, (2) rewriting the query to use each of the three mechanisms to represent that intermediate result, and (3) executing the variants and comparing their returned results. If the results differ, a potential logic bug is reported. The process can be formalized as follows. Let be a query that computes an intermediate result . ERIQ generates three equivalent queries: , , and , each representing using the respective mechanism. The expected behavior is that for any database instance , the result sets satisfy:

Why it matters

The results demonstrate that checking result consistency across equivalent representations of intermediate query results is a powerful and previously unexplored approach for detecting DBMS logic bugs. The high number of confirmed and unique bugs (54 previously unknown) suggests that DBMS implementations often have subtle inconsistencies in how they handle VIEWs, CTEs, and TEMPTs. These inconsistencies can lead to incorrect query results, which may have serious consequences in applications relying on data integrity. The approach is lightweight and black-box, making it applicable to a wide range of DBMSs. However, the method relies on the availability of these three mechanisms; DBMSs that do not support all of them may not be fully testable. Future work could extend the approach to other equivalent representations, such as subqueries or derived tables, and to other SQL features. The authors also note that one bug was a documentation issue, indicating that inconsistencies may also exist in documentation, which can mislead developers. Overall, ERIQ introduces a new testing dimension and achieves strong results, with 63 out of 64 bugs confirmed and two already fixed. This work has the potential to improve the reliability of DBMSs and to inspire further research on differential testing of SQL semantics.

Who should read this

CS practitioners and researchers

Opening member contentโ€ฆ