realtime icon indicating copy to clipboard operation
realtime copied to clipboard

Postgres changes with jsonb filters

Open fvaldes33 opened this issue 7 months ago • 0 comments

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

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

  • OS: macOS
  • Version of supabase-js: 2.39.7
  • Version of Node.js: 20

fvaldes33 avatar Jul 10 '24 03:07 fvaldes33