Lune

SIGMOD2025Top-tier venue

Constant Optimization Driven Database System Testing

Chi Zhang, Manuel Rigger

Abstract

Logic bugs are bugs that can cause database management systems (DBMSs) to silently produce incorrect results for given queries. Such bugs are severe, because they can easily be overlooked by both developers and users, and can cause applications that rely on the DBMSs to malfunction. In this work, we propose Constant-Optimization-Driven Database Testing (CODDTest) as a novel approach for detecting logic bugs in DBMSs. This method draws inspiration from two well-known optimizations in compilers: constant folding and constant propagation. Our key insight is that for a certain database state and query containing a predicate, we can apply constant folding on the predicate by replacing an expression in the predicate with a constant, anticipating that the results of this predicate remain unchanged; any discrepancy indicates a bug in the DBMS. We evaluated CODDTest on five mature and extensively-tested DBMSs-SQLite, MySQL, CockroachDB, DuckDB, and TiDB-and found 45 unique, previously unknown bugs in them. Out of these, 24 are unique logic bugs. Our manual analysis of the state-of-the-art approaches indicates that 11 logic bugs are detectable only by CODDTest. We believe that CODDTest is easy to implement, and can be widely adopted in practice.

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.

6 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 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 Pivoted Query Synthesis
  • ValScope: Value-Semantics-Aware Metamorphic Testing for Detecting Logical Bugs in DBMSs cites Finding bugs in database systems via query partitioning
  • ValScope: Value-Semantics-Aware Metamorphic Testing for Detecting Logical Bugs in DBMSs cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • ValScope: Value-Semantics-Aware Metamorphic Testing for Detecting Logical Bugs in DBMSs cites Testing Database Engines via Pivoted Query Synthesis
  • Detecting Data-Type-Related Logic Bugs in Relational DBMSs via Compatible Database Construction cites Scaling Automated Database System Testing
  • Detecting Data-Type-Related Logic Bugs in Relational DBMSs via Compatible Database Construction cites Finding bugs in database systems via query partitioning
  • Detecting Data-Type-Related Logic Bugs in Relational DBMSs via Compatible Database Construction cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • Detecting Data-Type-Related Logic Bugs in Relational DBMSs via Compatible Database Construction cites Testing Database Engines via Pivoted Query Synthesis
  • Fawkes: Finding Data Durability Bugs in DBMSs via Recovered Data State Verification cites Finding bugs in database systems via query partitioning
  • Fawkes: Finding Data Durability Bugs in DBMSs via Recovered Data State Verification cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • Fawkes: Finding Data Durability Bugs in DBMSs via Recovered Data State Verification cites Testing Database Engines via Pivoted Query Synthesis
  • Finding bugs in database systems via query partitioning cites Validating SMT solvers via semantic fusion
  • 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 Testing Database Engines via Pivoted Query Synthesis
  • Detecting optimization bugs in database engines via non-optimizing reference engine construction cites Testing Database Engines via Pivoted Query Synthesis
  • Automated Discovery of Test Oracles for Database Management Systems Using LLMs cites Scaling Automated Database System Testing
  • Automated Discovery of Test Oracles for Database Management Systems Using LLMs cites Finding bugs in database systems via query partitioning
  • Automated Discovery of Test Oracles for Database Management Systems Using LLMs cites Detecting optimization bugs in database engines via non-optimizing reference engine construction
  • Automated Discovery of Test Oracles for Database Management Systems Using LLMs cites Testing Database Engines via Pivoted Query Synthesis
  • Automated Discovery of Test Oracles for Database Management Systems Using LLMs cites Evaluating Fuzz Testing
Builds onCited byLeft to right by year; the more cited, the higher.

Cited by top-tier papers6

  1. Scaling Automated Database System TestingSuyang Zhong, Manuel RiggerASPLOS 2026 · 4 citations
  2. Fawkes: Finding Data Durability Bugs in DBMSs via Recovered Data State VerificationZhiyong Wu, Jie Liang, Jingzhou Fu, Wenqian Deng et al.SOSP 2025 · 1 citation
  3. Automated Discovery of Test Oracles for Database Management Systems Using LLMsQiuyang Mang, Runyuan He, Suyang Zhong, Xiaoxuan Liu et al.SIGMOD 2026 · 1 citation
  4. ValScope: Value-Semantics-Aware Metamorphic Testing for Detecting Logical Bugs in DBMSsLi Lin, Liehang Chen, Rongxin WuOSDI 2026
  5. Detecting Data-Type-Related Logic Bugs in Relational DBMSs via Compatible Database ConstructionJiansen Song, Wensheng Dou, Yingying Zheng, Yu Gao et al.VLDB 2026

Builds on17

  1. Evaluating Fuzz TestingGeorge Klees, Andrew Ruef, Benji Cooper, Shiyi Wei et al.CCS 2018 · 753 citations
  2. Testing Database Engines via Pivoted Query SynthesisManuel Rigger, Zhendong SuOSDI 2020 · 150 citations
  3. Finding bugs in database systems via query partitioningManuel Rigger, Zhendong SuOOPSLA 2020 · 116 citations
  4. Detecting optimization bugs in database engines via non-optimizing reference engine constructionManuel Rigger, Zhendong SuFSE 2020 · 104 citations
  5. Validating SMT solvers via semantic fusionDominik Winterer, Chengyu Zhang, Zhendong SuPLDI 2020 · 80 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. SRS: Detecting Logic Bugs of Join Implementation in DBMSs via Set Relation SynthesisJinhui Lai, Chi Zhang, Bingyan Li, Chenglin Liang et al.SIGMOD 2026 · 4 citations
  3. EPSC: Testing Database Management Systems via Equivalent Prepared Statement ConstructionChi Zhang, Jie Liang, Zhiyong Wu, Dalong Shi et al.SIGMOD 2026 · 2 citations
  4. Detecting Logic Bugs in DBMSs via Equivalent Data ConstructionWenqian Deng, Jie Liang, Zhiyong Wu, Jingzhou Fu et al.SIGMOD 2026 · 1 citation
  5. Detecting Metadata-Related Logic Bugs in Database Systems via Raw Database ConstructionJiansen Song, Wensheng Dou, Yu Gao, Ziyu Cui et al.VLDB 2024 · 13 citations
Dusk over the sea between two cliffs drawn in fine vertical lines