Skip to content

fix: support jsonb expression filters - #2104

Open
qtjg wants to merge 1 commit into
supabase:mainfrom
qtjg:contrib/issue-1090-jsonb-filters
Open

fix: support jsonb expression filters#2104
qtjg wants to merge 1 commit into
supabase:mainfrom
qtjg:contrib/issue-1090-jsonb-filters

Conversation

@qtjg

@qtjg qtjg commented Aug 17, 2026

Copy link
Copy Markdown

Summary

This PR adds support for filtering Postgres Changes subscriptions on a JSONB text-extraction expression such as data->>organization_id=eq.org_123.

Fixes #1090.

What changed

  • Validate a single jsonb_column->>key filter expression during subscription creation.
  • Require the base column to have the jsonb type and validate the comparison value as text.
  • Extract the requested JSONB key with PostgreSQL’s ->> operator during row-visibility evaluation.
  • Add a data jsonb field to the shared integration fixture.
  • Add an end-to-end regression test proving that a matching JSONB value is delivered and a different value is ignored.

The implementation keeps the existing filter wire format and equality-operator machinery. It does not use dynamic SQL for the JSONB key; the base column and key are parsed and validated before the value is passed to the existing comparison function.

Testing

  • The standalone Elixir parser check for data->>organization_id=eq.org_123 passes.
  • git diff --check passes.
  • The integration test is included but the full Mix suite was not run in this environment because the repository pins Elixir 1.19.5 / OTP 28, while the available runtime is Elixir 1.14 / OTP 25.

Coordination note

A previous comment on issue #1090 says that krishvsoni wanted to work on this issue. I am opening this PR transparently so maintainers can confirm whether the work is still available. If that contributor is actively implementing the fix, I am happy to defer or adapt this branch based on maintainer guidance.

Review focus

Please review the accepted expression syntax, behavior for missing JSONB keys and NULL, and interactions with not., in, is null, and delete/update old-row filtering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Postgres changes with jsonb filters

1 participant