You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(realtime): quote special text values in Postgres change IN filters - #2242
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.
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.
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: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
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
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When a Realtime Postgres changes
INfilter contains empty text, the textNULL, 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 textNULLand SQL NULL and can produce a malformed array.For example,
['', 'NULL', '{draft}', null]was sent aslabel=in.(,NULL,{draft},null). It now produceslabel=in.("","NULL","{draft}",null). Quoting is limited to the elements of the array. Realtime server filter parser · Clients are thin layersThe 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
infilters. Empty strings, the textNULL, 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.