Affected area
Migrations
Supabase CLI version
2.109.1
Operating system
macOS Sequoia (Apple Silicon)
Installation method
brew
Command
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 postgres role.
-
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:
A Supabase collaborator suggested opening this issue because the problem appears specific to the CLI migration execution.
Affected area
Migrations
Supabase CLI version
2.109.1
Operating system
macOS Sequoia (Apple Silicon)
Installation method
brew
Command
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 thepostgresrole and this workflow is documented for Realtime Authorization.Steps to reproduce
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()
);
supabase db push
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
Additional context
Additional investigation:
postgresrole.supabase db push.Cannot create RLS policy on realtime.messages from migration: "must be owner of relation messages" (SQLSTATE 42501) supabase#48812
A Supabase collaborator suggested opening this issue because the problem appears specific to the CLI migration execution.