Clarification of Realtime PG Changes Filter Syntax
Is the
filter
argument described in the guide page [1] would seem to follow the syntax of the .or
filter [2] but in the API reference for RC2 it seems to reference the event
argument instead.
Can you confirm the correct syntax for the this parameter?
[1] https://supabase.com/docs/guides/realtime/postgres-changes
[2] https://supabase.com/docs/reference/javascript/next/or
[3] https://supabase.com/docs/reference/javascript/next/subscribe7 Replies
Not clear what you are asking about. The filter format is
col=eq.val
With eq being the only filter right now.I'm wondering if its possible to filter by multiple columns in the same way as the
or
filter for select
does; but I guess you answered my question.Not yet. It is evidently in the plan to have more filter options.
Thanks for the clarification @garyaustin. I just noticed additionally a note in the subscribe section of the supabase Realtime docs:
Row level security is not applied to delete statements.This is sounds a bit concerning and I was hoping for clarification, because I don't really understand how it applies to Realtime subscriptions....
If you are subscribing to table to watch deletes, you will get them all, even if RLS would normally let you see that row. By default realtime only returns a record(row) id for delete messages to prevent leaking info.
This doesn't sound that bad I guess, since only the ID is leaked and the record is deleted anyway; the main risk is triggering the callback more often than one should but since the filter would still work it should be ok.
Yeah, just to clarify why it works this way. Realtime uses replication feature of Postgres. That sends changes out to the realtime server, which then makes a call back to the database to check RLS. Because the row is gone from the database at this point it can't be checked. Or so my understanding goes.