Skip to content

feat(postgrest): filter rows matching any of several patterns - #989

Merged
Tr00d merged 2 commits into
masterfrom
feat/database.using_filters.like_any
Dec 1, 2026
Merged

Tr00d merged 2 commits into
masterfrom
feat/database.using_filters.like_any

Conversation

@Tr00d

@Tr00d Tr00d commented Dec 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A caller can keep only the rows where a column matches any of several patterns, case-sensitively.

Capability: database.using_filters.like_any - Filter Like Any Pattern.

Public API

New enum member Constants.Operator.LikeAny = 25, used through the existing Filter, Not, Or and And. No new methods.

var users = await client.Table<User>()
    .Filter("username", Operator.LikeAny, new List<string> { "super%", "kiwi%" })
    .Get();

Behavior

  • Sends <column>=like(any).{"p1","p2"} as a query parameter on any filtered request.
  • % in a pattern becomes *, as for Like. Each item is double-quoted, with \ and " escaped, so commas and braces stay inside the item.
  • An empty list is sent as {}; PostgREST answers it with no rows (checked against the local stack). The SDK does not validate it.
  • A criterion that is not a list throws PostgrestException with Reason = InvalidArgument, like In.
  • Server errors map as for any other filter.

Deviations from supabase-js

Items are quoted and escaped; supabase-js joins them raw. Exposed through the operator enum only, not a dedicated method.

Tests

Tier Class Pins
E2E LikeAnyFilterTests rows selected, */% inside quoted items, case sensitivity, empty list, comma inside a pattern, negation
Contract LikeAnyRequestTests query parameter on the wire, plain and negated
Unit LikeAnyFilterRenderingTests rendering, wildcard translation, quoting and escaping, non-list criterion

Diff coverage: 100% (7 lines). Mutation: 15/15 testable mutants on changed lines killed (2 more were compile errors), 0 survivors.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Tr00d
Tr00d marked this pull request as ready for review December 1, 2026 07:57
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@Tr00d
Tr00d merged commit f4d1828 into master Dec 1, 2026
11 checks passed
@Tr00d
Tr00d deleted the feat/database.using_filters.like_any branch December 1, 2026 08:05
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.

1 participant