Filtered postgres_changes fail with "permission denied for function check_equality_op"
Bug report
- [x] I confirm this is a bug with Supabase, not with my own application.
- [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Tenant migration 20260616120000_add_postgrest_filter_ops (re-applied by
20260626120000_readd_postgrest_filter_ops) introduces a new 5-arg overload of
realtime.check_equality_op(op, type_, val_1, val_2, negate) sourced from
walrus_migration_0015 (supabase/walrus#81). The migration creates the function with
no GRANT statements, so it only receives default privileges (postgres,
dashboard_user).
The old 4-arg overload has EXECUTE for anon, authenticated, service_role, and
PUBLIC, but realtime.is_visible_through_filters now calls the 5-arg overload
(negate := coalesce(f.negate, false)). When realtime.apply_rls evaluates filters
while impersonating the subscriber's role, the call is denied and the whole
list_changes poll fails:
PoolingReplicationError: %Postgrex.Error{
postgres: %{
code: :insufficient_privilege,
pg_code: "42501",
message: "permission denied for function check_equality_op",
where: "SQL function \"is_visible_through_filters\" statement 1
PL/pgSQL function realtime.apply_rls(jsonb,integer) line 191 at FOR over SELECT
rows
SQL function \"list_changes\" statement 1"
}
}
Because the batch is retried and keeps failing, no subscriber on the affected table receives events while the condition holds.
To Reproduce
- Hosted project with realtime migrations ≥
20260626120000applied. - Enable RLS on a table and add it to the realtime publication.
- Open more than 10
postgres_changessubscriptions on that table asauthenticated, each with a filter (e.g.filter: 'user=eq.<uuid>'). - INSERT or UPDATE a row.
- Realtime logs show the
PoolingReplicationErrorabove; no subscriber receives the event. With ≤10 subscriptions, everything works.
Expected behavior
The 5-arg overload should carry the same grants as the 4-arg overload it supersedes.
Hosted users cannot fix this themselves: the function is owned by supabase_admin and
postgres has EXECUTE without grant option.
Screenshots
System information
- Hosted Supabase (cloud), realtime tenant migrations through
20260626120000(applied to our project 2026-07-02)- Affects: Realtime
postgres_changeswith server-side filters - Observed continuously since 2026-07-02
- Affects: Realtime
Hi @Ruud14 thanks for the report. A fix is available on main now.
:tada: This issue has been resolved in version 2.112.5 :tada:
The release is available on GitHub release
Your semantic-release bot :package::rocket: