Lune

OSDI2024Top-tier venue

Detecting Logic Bugs in Database Engines via Equivalent Expression Transformation

Zu-Ming Jiang, Zhendong Su

Abstract

Database management systems (DBMSs) are crucial for storing and fetching data. To improve the reliability of such systems, approaches have been proposed to detect logic bugs that cause DBMSs to process data incorrectly. These approaches manipulate queries and check whether the query results produced by DBMSs follow the expectations. However, such query-level manipulation cannot handle complex query semantics and thus needs to limit the patterns of generated queries, degrading testing effectiveness.

In this paper, we tackle the problem using a fine-grained methodology-expression-level manipulation-which empowers the proposed approach to be applicable to arbitrary queries. To find logic bugs in DBMSs, we design a novel and general approach, equivalent expression transformation (EET). Our core idea is that manipulating expressions of a query in a semantic-preserving manner also preserves the semantics of the entire query and is independent of query patterns. EET validates DBMSs by checking whether the transformed queries still produce the same results as the corresponding original queries. We realize our approach and evaluate it on 5 widely used and extensively tested DBMSs: MySQL, PostgreSQL, SQLite, ClickHouse, and TiDB. In total, EET found 66 unique bugs, 35 of which are logic bugs. We expect the generality and effectiveness of EET to inspire follow-up research and benefit the reliability of many DBMSs.

Ask Lune

Know this paper in minutes, not an afternoon.

Lune can read every page of it and the top-tier papers that cite it, and gives you its claims, its evidence and its limits, each one cited to the paper it comes from. No skimming, no AI slop.

12 top-tier papers have cited it since. Know what they found before your reviewers do.

Questions to start from

Lune can draw on

the full paper · the top-tier papers that cite it · related work

Get the answer

Free to start. No credit card required.

Lineage

  • Scaling Automated Database System Testing cites Constant Optimization Driven Database System Testing
  • Scaling Automated Database System Testing cites Finding bugs in database systems via query partitioning
  • Scaling Automated Database System Testing cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • Scaling Automated Database System Testing cites Testing Database Engines via Query Plan Guidance
  • Scaling Automated Database System Testing cites Testing Database Engines via Pivoted Query Synthesis
  • Constant Optimization Driven Database System Testing cites Finding bugs in database systems via query partitioning
  • Constant Optimization Driven Database System Testing cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • Constant Optimization Driven Database System Testing cites Testing Database Engines via Query Plan Guidance
  • Constant Optimization Driven Database System Testing cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
  • Constant Optimization Driven Database System Testing cites Testing Database Engines via Pivoted Query Synthesis
  • DDLumos: Understanding and Detecting Atomic DDL Bugs in DBMSs cites Finding bugs in database systems via query partitioning
  • DDLumos: Understanding and Detecting Atomic DDL Bugs in DBMSs cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • DDLumos: Understanding and Detecting Atomic DDL Bugs in DBMSs cites Testing Database Engines via Pivoted Query Synthesis
  • Testing Graph Databases with Synthesized Queries cites Finding bugs in database systems via query partitioning
  • Testing Graph Databases with Synthesized Queries cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • Testing Graph Databases with Synthesized Queries cites Testing Database Engines via Pivoted Query Synthesis
  • Finding bugs in database systems via query partitioning cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • Finding bugs in database systems via query partitioning cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
  • Finding bugs in database systems via query partitioning cites Testing Database Engines via Pivoted Query Synthesis
  • Detecting optimization bugs in database engines via non-optimizing reference engine construction cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
  • Detecting optimization bugs in database engines via non-optimizing reference engine construction cites Testing Database Engines via Pivoted Query Synthesis
  • QTRAN: Extending Metamorphic-Oracle Based Logical Bug Detection Techniques for Multiple-DBMS Dialect Support cites Finding bugs in database systems via query partitioning
  • QTRAN: Extending Metamorphic-Oracle Based Logical Bug Detection Techniques for Multiple-DBMS Dialect Support cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • QTRAN: Extending Metamorphic-Oracle Based Logical Bug Detection Techniques for Multiple-DBMS Dialect Support cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
  • QTRAN: Extending Metamorphic-Oracle Based Logical Bug Detection Techniques for Multiple-DBMS Dialect Support cites Testing Database Engines via Pivoted Query Synthesis
  • Testing Database Engines via Query Plan Guidance cites Finding bugs in database systems via query partitioning
  • Testing Database Engines via Query Plan Guidance cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • Testing Database Engines via Query Plan Guidance cites APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database Systems
  • Testing Database Engines via Query Plan Guidance cites Testing Database Engines via Pivoted Query Synthesis
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers12

  1. Constant Optimization Driven Database System TestingChi Zhang, Manuel RiggerSIGMOD 2025 · 8 citations
  2. Scaling Automated Database System TestingSuyang Zhong, Manuel RiggerASPLOS 2026 · 4 citations
  3. DDLumos: Understanding and Detecting Atomic DDL Bugs in DBMSsZhiyong Wu, Jie Liang, Jingzhou Fu, Wenqian Deng et al.USENIX ATC 2025 · 2 citations
  4. Testing Graph Databases with Synthesized QueriesZijing Yin, Si Liu, David A. BasinSIGMOD 2026 · 2 citations
  5. QTRAN: Extending Metamorphic-Oracle Based Logical Bug Detection Techniques for Multiple-DBMS Dialect SupportLi Lin, Qinglin Zhu, Hongqiao Chen, Zhuangda Wang et al.ISSTA 2025 · 2 citations

Builds on13

  1. Testing Database Engines via Pivoted Query SynthesisManuel Rigger, Zhendong SuOSDI 2020 · 150 citations
  2. Finding bugs in database systems via query partitioningManuel Rigger, Zhendong SuOOPSLA 2020 · 116 citations
  3. Detecting optimization bugs in database engines via non-optimizing reference engine constructionManuel Rigger, Zhendong SuFSE 2020 · 104 citations
  4. APOLLO: Automatic Detection and Diagnosis of Performance Regressions in Database SystemsJinho Jung, Hong Hu, Joy Arulraj, Taesoo Kim et al.VLDB 2020 · 77 citations
  5. Testing Database Engines via Query Plan GuidanceJinsheng Ba, Manuel RiggerICSE 2023 · 39 citations

Related papers

  1. Testing Database Systems via Differential Query ExecutionJiansen Song, Wensheng Dou, Ziyu Cui, Qianwang Dai et al.ICSE 2023 · 26 citations
  2. Detecting Logic Bugs in DBMSs via Equivalent Data ConstructionWenqian Deng, Jie Liang, Zhiyong Wu, Jingzhou Fu et al.SIGMOD 2026 · 1 citation
  3. Mozi: Discovering DBMS Bugs via Configuration-Based Equivalent TransformationJie Liang, Zhiyong Wu, Jingzhou Fu, Mingzhe Wang et al.ICSE 2024 · 18 citations
  4. EPSC: Testing Database Management Systems via Equivalent Prepared Statement ConstructionChi Zhang, Jie Liang, Zhiyong Wu, Dalong Shi et al.SIGMOD 2026 · 2 citations
  5. Detecting Schema-Related Logic Bugs in Relational DBMSs via Equivalent Database ConstructionJiansen Song, Wensheng Dou, Yingying Zheng, Yu Gao et al.VLDB 2025 · 6 citations
Dusk over the sea between two cliffs drawn in fine vertical lines