supabase db push fails with "must be owner of relation messages" (SQLSTATE 42501)
Maintainers usually reply within 1 day
@7ttp is already working on this.
Since Aug 8, 2026.
Assessment
This issue has not been assessed yet.
Description
Affected area
Migrations
Supabase CLI version
2.109.1
Operating system
macOS Sequoia (Apple Silicon)
Installation method
brew
Command
supabase db push
Actual output
Applying migration ...
ERROR: must be owner of relation messages
SQLSTATE: 42501
The migration aborts and no policy is created.
The exact same SQL succeeds when executed manually from the Supabase SQL Editor as the `postgres` role.
Expected behavior
The migration should execute successfully and create the RLS policy on realtime.messages, since the same SQL executes successfully from the Supabase SQL Editor as the postgres role and this workflow is documented for Realtime Authorization.
Steps to reproduce
- Create a Supabase Cloud project.
- Configure Realtime Authorization following the official documentation.
- Add a migration containing:
CREATE POLICY authorize_record_edit_presence
ON realtime.messages
FOR ALL
TO authenticated
USING (
realtime.topic() LIKE 'record_edit:%'
AND split_part(realtime.topic(), ':', 2)::uuid = fn_get_current_user_unit_id()
);
- Run:
supabase db push
- Observe:
ERROR: must be owner of relation messages
SQLSTATE 42501
-
Execute the exact same SQL from the Supabase SQL Editor as the
postgresrole. -
The policy is created successfully.
Crash report ID
No response
Docker and service versions
Docker Desktop 29.6.2
Docker Engine 29.6.2
Go version go1.26.5
API version 1.55
Additional context
Additional investigation:
- The SQL matches the official Realtime Authorization documentation.
- The same SQL succeeds from the SQL Editor using the
postgresrole. - The failure only occurs when executed through
supabase db push. - No ALTER OWNER, REASSIGN OWNED or manual ownership changes have been performed.
- Current owners:
- realtime.messages -> supabase_realtime_admin
- realtime schema -> supabase_admin
- Supabase Discussion:
https://github.com/supabase/supabase/discussions/48812
A Supabase collaborator suggested opening this issue because the problem appears specific to the CLI migration execution.
- Dominant language
- TypeScript
- Stars
- 2.4k
- Forks
- 526
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 321
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from supabase/cli
-
🐛 Bug supabase/cli
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
config diff reports api.enabled = true after config push disables the Data API (pg_pgrst_no_exposed_schemas)Possibly taken @7ttp claimed this 1 day ago. Open🐛 Bug supabase/cli
supabase/cli#6932 · 1 assignee ·
Maintainers usually reply within 1 day
-
supabase db reset intermittently fails: temporary Realtime init job races with the running Realtime service on "schema_migrations_pkey"Possibly taken @7ttp claimed this 2 days ago. Open🐛 Bug supabase/cli
supabase/cli#6915 · 1 assignee ·
Maintainers usually reply within 1 day
-
🐛 Bug supabase/cli
Difficulty 4/5 3-5 days Newbie friendliness 48/100
Maintainers usually reply within 1 day
-
🐛 Bug supabase/cli
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
aiko-chan-ai/DiscordBotClient#380 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
vercel/ai-elements#507 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 Half a day Newbie friendliness 84/100
anaclumos/qa-interns#148 · 1 comment ·
Maintainers usually reply within 1 day