What You Should Know About Constraints in PostgreSQL (and What’s New in 18)
October 21–24
PostgreSQL 18 introduces significant enhancements to constraints, your first line of defense for maintaining data integrity. This talk focuses on the new capabilities brought by version 18, including non-overlapping PRIMARY KEY and UNIQUE constraints, named NOT NULL constraints, NOT ENFORCED constraints, and improved support for partitioned tables. We’ll look at what’s new, why it matters, and how to apply these features in real-world systems.
We will begin with a brief refresher on the different types of constraints (CHECK, NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY) to help you get the most out of PostgreSQL’s declarative integrity model. Then we’ll go into details of what's new in PostgreSQL 18, including: * Named NOT NULL constraints and their inclusion to foreign tables * NOT ENFORCED constraints for CHECK and foreign keys * WITHOUT OVERLAPS * ALTER TABLE ... ALTER CONSTRAINT ... [NO] INHERIT * Enhanced handling of constraints on partitioned tables * Requirements around deterministic/nondeterministic collations in primary/foreign key relationships