When the Application Layer Is Disposable: Putting Integrity Constraints Back in the Database
Hasara Kalumin, Amol Deshpande
Abstract
Integrity constraints have been central to the relational model since its inception. However, beyond keys, single-row CHECKs, and referential integrity, most constraints are enforced by application layers today. SQL ASSERTIONs, standardized in SQL-92, remain poorly supported by major RDBMSs. This has become increasingly unacceptable due to two developments. First, LLM-driven applications and agents increasingly issue queries and updates directly against databases, bypassing application layers where invariants reside. Such code may be generated on demand and discarded afterwards, making the database the only durable component that can encode and enforce these invariants. Second, natural constraints in higher-level conceptual models, such as E/R and property graphs, become fragmented across relations under mappings chosen for performance. The resulting multi-relation constraints lack direct database support, and only some can be efficiently enforced using existing mechanisms such as triggers. These developments motivate an overhaul of how constraints are defined, mined, managed, and enforced in data management systems. As a first concrete step, we introduce constraint indexes, which represent constraints spanning multiple relations as transactional access paths, and implement a proof of concept as a PostgreSQL extension. Constraint indexes enforce constraints arising from distributed inheritance hierarchies, folded relationships, and folded weak entities, as well as cardinality bounds and functional dependencies, at low overhead relative to no enforcement. Across these workloads, they outperform the better of the correctness-preserving baselines by up to 2.41 times. We also show that LLM-driven writers frequently violate unenforced constraints and behave erratically when provided with a list of constraints to enforce. We close by discussing a few research challenges raised by this agenda.
Create a lesson
Related papers
The Value Semantics Layer: Enabling Machine-Understandable Databases for Agentic AI
Shared title terminology · Jalal Mahmud, Eser Kandogan
Logical Scalability in Big Data Architectures: Impact of Data Modeling on the Database Layer
Shared title terminology · Rosario Napoli, Mark Adrian Gambito, Antonio Celesti et al.
Recursively Testing and Vibe Debugging a Google AI Studio Generated Vibe-Coded Database Software Application
Shared title terminology · Christian Mancas, Cristina Mancas
MetaDB: Putting File-System Structure Back into Distributed Databases
Shared title terminology · Zebin Ren, Biao Cao, Kang Chen et al.
On Enforcing Database Constraints Using MS VBA Event Driven Procedures and SQL Server
Shared title terminology · Diana Christina Mancas
Testability of Homomorphism Inadmissibility: Property Testing Meets Database Theory
Shared title terminology · Hubie Chen, Yuichi Yoshida