Repository navigation
fix(query): reject unbound :find variables and unknown :find functions up front (#406, #414) - #483
Merged
Merged
Conversation
…s up front (#406, #414) A :find variable that no :where clause binds (plain, or a window function's argument, :partition-by or :order-by variable) is now a parse error, PRS-080, instead of an empty result. Aggregate and window function names are resolved against the function registry before the query runs, so an unknown one is QRY-010 / QRY-011 whether or not any row matches; INT-029 / INT-030 stay registered for internal inconsistencies only. The PreparedQuery doc example had exactly the #406 bug (?name never bound) and is fixed. Refs #406, #414 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
Two v3.0.0 behavior breaks that turn silent empty results into errors.
#406 — unbound
:findvariable →PRS-080(parse time,execute()/query()/prepare())outer_boundset as the existing aggregate (PRS-023) and:with(PRS-022) checks: pattern positions, rule-call args, expression bindings,or-joinjoin vars, vars in everyorbranch.:partition-byand:order-byvariables, which were unchecked.not/not-joinand?_wildcards are not bound. Bind slots are values, so they are unaffected.#414 — unknown aggregate / window function →
QRY-010/QRY-011check_find_functionsresolves every:findaggregate and window function against theFunctionRegistryat the top ofexecute_query, before the rules branch, so the plain, rules, prepared and cursor paths all get it and the result no longer depends on the data.INT-029/INT-030stay registered (codes are never removed); ERROR_REFERENCE notes they now signal only an internal inconsistency.The
PreparedQueryrustdoc example had the #406 bug (:find ?namenever bound) and is fixed.Not in this PR
Tutorial-10-UDFs.mdshows the oldINT-029output. Left for the v3.0.0 doc sync, like the other v3 wiki changes (the live wiki documents v2.x).Test plan
tests/error_codes_prs_test.rs: PRS-080 cases viaexecute()andprepare(), message names the variable, accepted binding formstests/error_codes_qry_test.rs: QRY-010/QRY-011 on empty DB, no matching rows, matching rows, rule query, prepared query; registered UDF on empty DB returns emptycargo test: 1372 tests (1363 passing, 9 ignored)cargo clippy --all-features -- -D warnings,cargo fmtRefs #406, #414
🤖 Generated with Claude Code
https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn