supabase / realtime

Broadcast, Presence, and Postgres Changes via WebSockets
https://supabase.com/realtime
Apache License 2.0
6.82k stars 315 forks source link

Postgres changes with jsonb filters #1090

Open fvaldes33 opened 4 months ago

fvaldes33 commented 4 months ago

Bug report

Describe the bug

When using realtime postgres_changes, I noticed that filtering on jsonb columns doesn't work. I maybe have a bug somewhere but without the filter or with a filter on a regular text column works.

const channel = supabase
  .channel(`queue:${organization.id}`)
  .on(
    "postgres_changes",
    {
      event: "*",
      schema: "pgboss",
      table: "job",
      filter: `data->>organization_id=eq.${organization.id}`,
    },
    (payload) => {
      console.log("queue/pgboss/job", payload);
    }
  )
  .subscribe();

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a table with a jsonb column (and enable realtime/rls/etc on that table)
  2. Create realtime subscription for postgres_changes and target that table and filter on a jsonb field value you know is present.
  3. Make a change to the table
  4. See no changes are published

Expected behavior

I would expect the jsonb->>field=eq.value to work as it does with supabase-js or regular postgrest requests.

System information