Repository navigation
Fix WHERE fallback, _N field names, and LIKE in aggregates - #39
Merged
Merged
Conversation
- Untranslatable WHERE clauses compiled to an empty filter, so UPDATE and
DELETE with e.g. NOT (...), LOWER(x) = ..., or 1 = 0 hit every document.
Now NOT (...) and constant conditions are supported and anything else
throws instead of matching everything.
- Field names ending in _<number> (phone_1, address_line_2) were rewritten
to array paths (phone.1), breaking filters, projections, sorting, and
making UPDATE write to the wrong field. The parser fallback now uses the
same unambiguous __ARRAY_ encoding, so the _N decoding is removed.
- LIKE in any query compiled to an aggregation pipeline (aliases, nested
fields, GROUP BY, JOIN) failed with "$regex has to be a string" because
the executor flattened the RegExp into {}. Non-plain objects are now
left intact.
Claude-Session: https://claude.ai/code/session_01GFv5U1awSDVVk9HWzCqrpw
- WHERE values that aren't literals (columns, functions, subqueries, casts, parameters, arithmetic) were embedded in the filter as raw AST objects. With <>, != or NOT IN that matched every document, so e.g. DELETE ... WHERE a <> b or WHERE id NOT IN (SELECT ...) wiped the collection. These now throw "Unsupported value in WHERE clause". - UPDATE with JOIN, FROM or multiple tables and DELETE with JOIN or multiple tables silently dropped the other tables and their join conditions; UPDATE a JOIN b ON ... SET ... ran with no filter at all. These now throw instead. Claude-Session: https://claude.ai/code/session_01GFv5U1awSDVVk9HWzCqrpw
Compiler-level counterparts to regressions.integration.test.ts so these regressions are caught by yarn test:unit without Docker. Claude-Session: https://claude.ai/code/session_01GFv5U1awSDVVk9HWzCqrpw
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DELETE with e.g. NOT (...), LOWER(x) = ..., or 1 = 0 hit every document.
Now NOT (...) and constant conditions are supported and anything else
throws instead of matching everything.
to array paths (phone.1), breaking filters, projections, sorting, and
making UPDATE write to the wrong field. The parser fallback now uses the
same unambiguous _ARRAY encoding, so the _N decoding is removed.
fields, GROUP BY, JOIN) failed with "$regex has to be a string" because
the executor flattened the RegExp into {}. Non-plain objects are now
left intact.
Claude-Session: https://claude.ai/code/session_01GFv5U1awSDVVk9HWzCqrpw