Your migration ran an ALTER TABLE on realtime.messages , and PostgreSQL refuses that from anyone but the table's owner, which on Supabase is an internal role rather than postgres . Policy statements are allowed on that table; ALTER TABLE is not. Remove the alter, keep the policy, and the migration goes through.
What you are looking at
ERROR: 42501: must be owner of table messages
Enter fullscreen mode
Exit fullscreen mode
What is this error? It is PostgreSQL's ordinary ownership check: only a table's owner may alter it, and 42501 is its insufficient_privilege code. Proven on a real PostgreSQL: a role that does not own the table gets exactly this message from alter table realtime.messages enable row level security , and the same refusal from any other ALTER TABLE on it.…