Skip to content

Fix nested filter arrays when a column receives 3+ values - #208

Merged
rjschmitt merged 1 commit into
raphiniert-com:masterfrom
fzaninotto:fix/parse-filters-nested-arrays
Oct 1, 2026
Merged

rjschmitt merged 1 commit into
raphiniert-com:masterfrom
fzaninotto:fix/parse-filters-nested-arrays

Conversation

@fzaninotto

Copy link
Copy Markdown
Contributor

Problem

parseFilters checks Array.isArray(result[key]) instead of Array.isArray(result.filter[key]).
The check is always true, so from the third value on, the existing array gets wrapped instead of appended to:

  • { 'q@ilike': 'a b c' } → { q: [['ilike.*a*', 'ilike.*b*'], 'ilike.*c*'] }
  • inside @or, this yields an invalid logic tree: or=(q.ilike.*a*,ilike.*b*,q.ilike.*c*),
    which PostgREST rejects with failed to parse logic tree.

It affects any search with 3+ words, and any column with 3+ operators (e.g. age@gt, age@lt, age@neq).

Fix

Check result.filter[key]. Added tests for 3-word like, 3-word ilike inside @or, and 3 operators on one column.

@fzaninotto

Copy link
Copy Markdown
Contributor Author

Hi, is there something missing in this PR?

@rjschmitt
rjschmitt merged commit d29dd5e into raphiniert-com:master Oct 1, 2026
4 checks passed
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.

2 participants