<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Constraints on Nalar</title>
    <link>https://nalar.dev/tags/constraints/</link>
    <description>Recent content in Constraints on Nalar</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Tue, 01 Sep 2026 00:00:00 +0700</lastBuildDate>
    <atom:link href="https://nalar.dev/tags/constraints/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Enforce Non-Overlapping Time Ranges with PostgreSQL Exclusion Constraints</title>
      <link>https://nalar.dev/postgresql-exclusion-constraints-non-overlapping-ranges/</link>
      <pubDate>Tue, 01 Sep 2026 00:00:00 +0700</pubDate>
      <guid>https://nalar.dev/postgresql-exclusion-constraints-non-overlapping-ranges/</guid>
      <description>&lt;p&gt;Applications that schedule rooms, equipment, or maintenance windows often need a simple invariant: two active reservations for the same resource must not overlap. Checking for conflicts in application code looks easy, but concurrent transactions can both pass the check before either inserts.&lt;/p&gt;&#xA;&lt;p&gt;PostgreSQL can enforce this invariant inside the database with range types and exclusion constraints.&lt;/p&gt;&#xA;&lt;h2 id=&#34;model-the-interval-explicitly&#34;&gt;Model the interval explicitly&lt;/h2&gt;&#xA;&lt;p&gt;A half-open timestamp range includes its start and excludes its end. That lets adjacent bookings touch without overlapping.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
