Skip to content
Preprint

Detecting DBMS Bugs by Constructing Equivalent Representations of Intermediate Query Results

Aug 2026 · 0 citations · 36 references
Computer Science

TL;DR

This paper proposes ERIQ, a novel testing approach for detecting DBMS logic bugs from the perspective of checking result consistency across Equivalent Representations of Intermediate Query Results, and evaluated ERIQ on four widely used open-source DBMSs.

Abstract

Database Management Systems (DBMSs) support multiple SQL mechanisms for representing intermediate query results, including VIEWs, Common Table Expressions (CTEs), and Temporary Tables (TEMPTs). When these mechanisms are used to represent the same intermediate query result, the corresponding queries are expected to produce consistent results. However, we observe that such queries can return inconsistent results, indicating potential DBMS logic bugs. Existing approaches for detecting DBMS logic bugs have never explored result consistency across such equivalent representations. In this paper, we propose ERIQ, a novel testing approach for detecting DBMS logic bugs from the perspective of checking result consistency across Equivalent Representations of Intermediate Query Results. ERIQ constructs SQL variants using a VIEW, a CTE, or a TEMPT to represent the same intermediate query result, executes these variants, and compares their returned results. We evaluated 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.

View source

Similar papers

Jul 2026

Detecting Data-Type-Related Logic Bugs in Relational DBMSs via Compatible Database Construction

Relational Database Management Systems (DBMSs) serve as foundational systems for data storage and management, supporting a rich variety of data types to specify storage formats and value ranges. These data types play a critical role in both data storage and computation. However, complex data computation operations (e.g...

Jiansen Song, Wensheng Dou, Ying-Ying Zheng et al. · 0 citations
Open access Sep 2026

MimicDB: Runtime Defense against Wrong-Result Bugs in Database Query Optimizers via Query-Rewriting Diversity

These findings characterize the potential of single-engine diversity to detect wrong-result failures and select correct results, together with the execution costs and reference-validity constraints that shape its practical use.

Ze-Lin Wang, Ping Chen, Jin Wei et al. · 0 citations
Preprint Aug 2026

EXPLAIN Yourself! Finding Query Planner Stalls Across DBMSes

It is found that although the queries triggering slow planning are largely DBMS-specific, recurring pathologies involving correlated subqueries, CTE expansion, repeated subquery expressions, disjunctive joins, and constant folding affect multiple systems.

Geoffrey X. Yu, Ryan Marcus, Tim Kraska · 0 citations
Open access Oct 2026

Testing Computation Pushdown in Distributed Database Systems

This paper introduces Controlled Pushdown Execution (CPE), a white-box method that enables systematic validation of computation pushdown and shows that CPE can control all supported operators across different systems.

Jinsheng Ba, Zu-Ming Jiang, Zhen-Dong Su · 0 citations
Book Open access Oct 2026

Query Analyzer: Framework-Agnostic, Confidence-Based N+1 Detection for the JVM

The N+1 query problem (issuing one database query per element of a collection instead of a single batched query) is among the most common and costly performance defects in data-access code, yet tool support on the Java Virtual Machine (JVM) is fragmented. Raw Java Database Connectivity (JDBC) interceptors log statement...

Mahmoud Khawaja · 0 citations

We use cookies to run the site and, with your consent, for analytics and to show ads. See our Cookie Policy.