Skip to content

fix: evaluate postgres_changes filters against the raw wal2json values - #2362

Open
mandar1045 wants to merge 1 commit into
supabase:mainfrom
mandar1045:fix/filter-on-raw-wal-values
Open

mandar1045 wants to merge 1 commit into
supabase:mainfrom
mandar1045:fix/filter-on-raw-wal-values

Conversation

@mandar1045

Copy link
Copy Markdown
Contributor

Fixes #2361

apply_rls was passing filters the jsonb-cast column values, so check_equality_op got ["a"] for an array instead of {a} and raised, dropping the whole batch for everyone.

This makes apply_rls build the filter columns straight from the wal2json values, which are already in Postgres literal form. The cast columns are still used for the payload, so the output doesn't change. is_visible_through_filters and check_equality_op are untouched.

  • New migration that re-creates apply_rls with that change only
  • Regenerated tenant_schema and the pg15/pg17 dumps
  • Added an array filter case to postgres_changes_filters_test.exs

Walrus suite passes on 15 and 17, from both the dumps and the migrations.

apply_rls passed filters the jsonb-cast column values, so check_equality_op
got ["a"] for an array instead of {a} and raised, dropping the whole
list_changes batch for every subscriber.

Build the filter columns from the wal2json values, which are already in
Postgres literal form. The cast columns are still used for the payload.

Fixes supabase#2361
@mandar1045
mandar1045 force-pushed the fix/filter-on-raw-wal-values branch 2 times, most recently from 028ebab to 5414596 Compare October 7, 2026 12:25
@mandar1045

Copy link
Copy Markdown
Contributor Author

The only failing job (multigres partition 3) is the schema "realtime" does not exist setup flake that #2319 fixes. Everything else passed, including the new filter test on every backend. Could someone re-run it?

This branch has not been deployed

No deployments
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.

Filter on an array column breaks postgres_changes for the whole project

1 participant