Skip to content

parity(realtime): add postgres_changes filter builder, new operators and select [from supabase-js] #269

Description

@grdsdev

Warning

Auto-generated parity issue — may be a false positive.

This issue was created automatically by /sync-sdk-parity from a heuristic
analysis of recent supabase-js commits. The tooling has limited insight
into language-specific idioms and may have:

  • misidentified a JS-only change as cross-language relevant,
  • missed an existing implementation in this SDK under a different name,
  • or proposed an API shape that doesn't fit this language's conventions.

It is the SDK author's responsibility to validate the need before
implementing.
If this change does not apply to this SDK, please close the
issue with a short note explaining why.


SDK Parity: C# implementation needed

A change was made in supabase-js that may need to be implemented in this repository for SDK parity. Please confirm applicability before starting work.

Reference Implementation (supabase-js)

What Changed

Two new capabilities for postgres_changes subscriptions:

  1. postgresChangesFilter() fluent builder — type-checked filter composition. Operators: eq, neq, gt, gte, lt, lte, in, like, ilike, match, imatch, is, isDistinct, not. Auto-quotes reserved characters.

  2. select: string[] column restriction — subscriber receives only specified columns, reducing payload size.

Code Reference

channel.on('postgres_changes', {
  event: 'UPDATE',
  schema: 'public',
  table: 'orders',
  filter: postgresChangesFilter().gt('amount', 100).not('status', 'in', ['draft', 'archived']),
}, (payload) => console.log(payload))

channel.on('postgres_changes', {
  event: '*',
  schema: 'public',
  table: 'users',
  select: ['id', 'first_name'],
}, (payload) => Console.WriteLine(payload.NewRecord))

Implementation Guidance

Expected API Surface (C#)

// Fluent builder — C# method chaining fits naturally
var channel = supabase.Realtime.Channel("room1");
channel.Register(new PostgresChangesOptions("public", "orders") {
    Event = PostgresChangesOptions.ListenType.Updates,
    Filter = new PostgresChangesFilterBuilder()
        .Gt("amount", 100)
        .Not("status", PostgresChangesFilterBuilder.Operator.In, new[] { "draft", "archived" }),
    Select = new[] { "id", "first_name" }
});

// or as method chain:
channel.OnPostgresChange<Order>(
    schema: "public",
    table: "orders",
    filter: PostgresChangesFilter.Gt("amount", 100).NotIn("status", "draft", "archived"),
    callback: (sender, change) => Console.WriteLine(change.NewRecord)
);

Key Behaviors to Match

  • Builder serializes to column=operator.value wire format; conditions AND-combined with commas
  • Values with reserved chars auto-quoted PostgREST-style
  • in format: column=in.(val1,val2)
  • not prefix negates any operator
  • Raw string filters remain backward compatible
  • Select forwarded in join payload; server returns only those columns

Acceptance Criteria

  • PostgresChangesFilterBuilder class with all operators
  • Correct serialization with reserved-char quoting
  • Select: string[] forwarded in join payload
  • Raw string filters remain backward compatible
  • Unit tests for filter builder

Context

  • supabase-js version: v2.110.0
  • Parity tracking: This issue was auto-generated by SDK parity analysis
  • Related Linear issues: SDK-1170 (dart), SDK-1171 (py), SDK-1172 (swift)

Generated with Claude Code /sync-sdk-parity

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions