$ the-wire · showcase
PostgreSQL triggers stay disabled after failed yield
By RepoJournal · Filed · About Rails
A Rails fix wraps trigger re-enabling in an ensure block so foreign keys are not left disabled when disable_referential_integrity raises.
Rails fixed a latent database-safety bug in PostgreSQL: `disable_referential_integrity` now re-enables triggers even when the yielded block raises [1]. Previously, on PostgreSQL versions before 18.4 (those without `NOT ENFORCED`), the method disabled triggers with `ALTER TABLE ... DISABLE TRIGGER ALL`, ran the block, then relied on normal execution to re-enable them. A raised exception left every foreign key in the database disabled for all later connections, unless the whole call happened inside a rolled-back transaction. This is a breaking change only in the sense that failures no longer corrupt catalog state; upgrade before running destructive fixtures or seed scripts.
Routing test assertions now respect PATCH and QUERY when you use `method: :all` [2]. `assert_recognizes` and `assert_routing` previously iterated only GET, POST, PUT, and DELETE, so a route drawn with `via: [:get, :post, :put, :delete]` could pass an `:all` assertion even though PATCH and QUERY routes were not checked. The fix brings the test helper in line with how `via: :all` actually dispatches.
Bootsnap fixed a precompilation bug where regenerating an existing cache entry of the same size would silently produce an empty cache file [3]. This only affects precompilation (not regular cache reads), so most apps will notice it only if they regenerate caches in CI or at deploy time. Upstream says "The source would be read twice but without rewinding, hence emptying it" [3].
Action items
- → Upgrade Rails to pick up the PostgreSQL trigger ensure fix if you rely on disable_referential_integrity outside transactions rails/rails [immediate]
- → Upgrade bootsnap before precompiling cache files if you regenerate entries of the same size rails/bootsnap [plan]
- → Run routes tests after Rails upgrade to catch newly enforced PATCH/QUERY assertions rails/rails [plan]
References