You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
db diff misses reloption-only changes on existing
views #5476
The PR for #3973 restores WITH (...) on newly created views. A related but distinct gap remains: when a view already exists and only its reloptions change, db diff emits nothing.
Repro
Declare a view with with (security_invoker=true), run supabase db diff -f initial and apply the migration.
Change the schema file to with (security_invoker=false) (or any other reloption swap).
The old value (true) silently persists in the database. For security_invoker specifically, that means a view can remain SECURITY DEFINER after the user thinks they've moved it to SECURITY INVOKER — same risky failure mode as #3973, just on updates instead of creations.
Root cause
The underlying diff engines used by db diff (djrobstep/migra, @pgkit/migra) do not read pg_class.reloptions when comparing views, so reloption-only differences are invisible to them. The #3973 fix paper-overs this for the create path by re-attaching reloptions from the live target catalog into emitted CREATE VIEW statements; there is no CREATE VIEW statement to patch in the update case.
Possible directions
Extend the post-processor to also diff source-vs-target reloptions and emit ALTER VIEW ... SET (...) / RESET (...) for reloption-only changes.
Or, accept this as one more reason to move declarative-schema workflows over to pg-delta (per commit 6c19b38), and document the migra limitation in the meantime.
Activity
fix(pg-delta-next): capture view and table reloptions
avallete commentedon Jun 22, 2026
This is natively handled by pg-delta as mentionned here: #3973 (comment)
The way forward is to move from
migratopg-deltafor diffing. Closing this one.