Skip to content

fix(postgres): flatten multi-value _id predicates - #1417

Open
Gordex2014 wants to merge 1 commit into
mainfrom
bugfix/1413-postgres-wide-chain-id
Open

Gordex2014 wants to merge 1 commit into
mainfrom
bugfix/1413-postgres-wide-chain-id

Conversation

@Gordex2014

@Gordex2014 Gordex2014 commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Fixes #1413.

What changed

  • Build positive multi-value _id filters as a flat PostgreSQL IN predicate instead of a left-deep OR tree.
  • Keep single-value _id and all _id:not behavior unchanged.
  • Add regression coverage for 12,000 IDs across result and count queries.
  • Assert that forward chain and _has resolution produce positive _id filters.

Compatibility

Tenant and resource type scoping, placeholder offsets, repeated-parameter AND behavior, _list, _include, and Bulk Export matching semantics are unchanged.

Validation

  • PostgreSQL test target: 268 passed, 0 failed.
  • The 12,000-ID regression passed in PostgreSQL 16 for both search() and search_count().
  • Forward chain, _has, wide two-level chain, single _id, and _id:not tests passed.
  • Formatting, diff checks, and standard Clippy completed successfully.

Strict Clippy with -D warnings remains blocked by existing Rust 1.97 warnings outside the changed code.

Visual explanation

View the nested OR versus flat IN explanation.

Temporary review evidence expires 2026-09-26T16:55:00.190Z.

Known limit

The query still uses one bind per ID. Lists near PostgreSQL's protocol limit of roughly 65,000 binds require a separate array-binding change.

@Gordex2014
Gordex2014 marked this pull request as ready for review September 21, 2026 16:57
@codecov

codecov Bot commented Sep 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

search(postgres): wide chained and _has results 500 when the _id rewrite builds a nested OR

1 participant