Skip to content

fix(realtime): quote special text values in Postgres change IN filters - #2242

Merged
spydon merged 2 commits into
supabase:mainfrom
aslanmuradov:codex/quote-realtime-in-array-elements
Dec 2, 2026
Merged

spydon merged 2 commits into
supabase:mainfrom
aslanmuradov:codex/quote-realtime-in-array-elements

Conversation

@aslanmuradov

@aslanmuradov aslanmuradov commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

When a Realtime Postgres changes IN filter contains empty text, the text NULL, or braces, the Dart client emits those elements unquoted. The server converts the parentheses to a PostgreSQL array literal. That drops the distinction between the text NULL and SQL NULL and can produce a malformed array.

For example, ['', 'NULL', '{draft}', null] was sent as label=in.(,NULL,{draft},null). It now produces label=in.("","NULL","{draft}",null). Quoting is limited to the elements of the array. Realtime server filter parser · Clients are thin layers

The regression failed on main. All 17 Postgres change filter tests and package analysis passed with the fix. The broader local test runs each reported 466 passes and one failure in an HTTP broadcast test.

Summary by CodeRabbit

  • Bug Fixes
    • Improved serialization of values in in filters. Empty strings, the text NULL, and values containing braces are now quoted so they’re treated as literal values. Null values remain unquoted, and timestamp values retain their expected format.

@aslanmuradov
aslanmuradov requested a review from spydon as a code owner December 2, 2026 15:02
@coderabbitai

coderabbitai Bot commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The in filter now quotes empty strings, case-insensitive NULL, and strings containing braces. Scalar filter serialization retains its previous behavior. A test covers these array elements and a null element.

Changes: Array filter serialization

Layer / File(s) Summary
Array element quoting and test
packages/supabase_realtime/lib/src/types.dart, packages/supabase_realtime/test/postgres_change_filter_test.dart
_serializeScalar applies additional quoting rules when serializing non-null array elements. The in filter uses these rules, and a test checks the output for empty strings, NULL, braces, and null.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Suggested reviewers: filipecabaco

Merge Risk: Minimal · up to e59b6

This fixes how empty strings, the text NULL, and values containing braces are sent in Postgres change IN filters. The change is small and targeted, and no merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the change correctly: the fix quotes special text values (empty strings, the text NULL, and values with braces) in Postgres change IN filters. The raw summary and PR objectives both de…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the change correctly: the fix quotes special text values (empty strings, the text NULL, and values with braces) in Postgres change IN filters. The raw summary and PR objectives both describe this exact behavior, and the scope is limited to the realtime package. The title follows the conventional commit style and is specific enough for a reader scanning history to understand the main change.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 6887da7 and e59b68c.

Files selected for processing: 1

  • packages/supabase_realtime/lib/src/types.dart

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 1 remain after this review.

@spydon
spydon force-pushed the codex/quote-realtime-in-array-elements branch from 6887da7 to e59b68c Compare December 2, 2026 15:20
@spydon
spydon merged commit 8209d9e into supabase:main Dec 2, 2026
60 checks passed
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.

2 participants