Skip to content

Don't cache Query.any/all built on an uncacheable sub-query - #651

Open
56steve wants to merge 1 commit into
msiemens:masterfrom
56steve:fix-any-all-uncacheable-subquery
Open

56steve wants to merge 1 commit into
msiemens:masterfrom
56steve:fix-any-all-uncacheable-subquery

Conversation

@56steve

@56steve 56steve commented Nov 5, 2026

Copy link
Copy Markdown

Query.any() and Query.all() put the sub-query into their cache key, but an uncacheable sub-query (for example one using a callable in its path via map()) has no hash of its own, so every such sub-query compares equal. Two searches like where('val').any(where('x').map(f) == 1) and where('val').any(where('x').map(f) == 5) therefore shared one cache entry, and the second search returned the first one's documents.

any() and all() are now uncacheable when the condition they are given is uncacheable, the same way & and | already behave. The new test in test_tables.py runs both queries against a table and checks that each returns its own documents and that nothing ends up in the query cache.

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