Repository navigation
Conversation
6 tasks done
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What kind of change does this PR introduce?
Bug fix. Moves the filter-value correction to the server, as requested by @leandrocp in supabase/supabase-js#2738 (comment).
What is the current behavior?
The subscription parser replaces the outer parentheses of an
inlist with braces and passes its contents directly to PostgreSQL. PostgreSQL then interprets unquotedNULLas a null element, rejects empty elements, and treats braces as array syntax. For example,details=in.(NULL,{tag},a{b},)cannot preserve those four strings.What is the new behavior?
Quote empty elements, case-insensitive
NULLtext, and braces when constructing the PostgreSQL array literal. Apply the same conversion tonot.in. Keep ordinary values and already quoted elements unchanged, including escaped quotes, backslashes, commas, and parentheses.The list scanner recognizes quoted values after every comma, including optional leading whitespace. Top-level filter splitting and scalar operators retain their existing behavior. No migration or client dependency change is needed.
in.()still represents an empty list. A single empty string must be written asin.(""): the wire format cannot distinguish an empty list from a client's one-element list serialized without quotes. This preserves the server's existing empty-list behavior.Additional context
Tests cover parsing for both operators, stored PostgreSQL array values, and actual row delivery through
realtime.list_changesfor matching and nonmatching subscriptions.Validated locally with the repository-pinned Elixir 1.19.5 / OTP 28.5.0.4 and
supabase/postgres:17.11.0.014, using the external tenant DB backend:mix test test/extensions/postgres_cdc_rls/ test/integration/rt_channel/postgres_changes_test.exs test/integration/rt_channel/postgres_changes_filters_test.exs --max-failures 5: 12 doctests, 318 tests, zero failures (6 backend-specific exclusions).mix compile --force --warnings-as-errors,mix format --check-formatted,mix credo, andgit diff --checkpass.The full-suite attempt is not green:
mix test --max-failures 5stopped after 22 doctests and 1,744 tests with five failures outside the changed parser: a catalog fixture's function-source mismatch, a missingpgdeltaexecutable, a 500 ms column-selection WebSocket timeout, IPv6 DNS resolution, and a WAL-slot lag assertion. After installing the pinnedpgdelta, a targeted rerun with the unchanged upstream parser still failed on DNS (ipv6.google.comreturnednxdomain) and the slot-lag assertion (slot_inactiverather thanlag_too_high); the other selected checks passed. The six-version PostgreSQL CI matrix has not been run locally.