Skip to content

supabase db push fails with "must be owner of relation messages" (SQLSTATE 42501) #6116

Description

@RMACTION

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

  1. Create a Supabase Cloud project.
  2. Configure Realtime Authorization following the official documentation.
  3. 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()
);

  1. Run:

supabase db push

  1. Observe:

ERROR: must be owner of relation messages
SQLSTATE 42501

  1. Execute the exact same SQL from the Supabase SQL Editor as the postgres role.

  2. 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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions