-
Notifications
You must be signed in to change notification settings - Fork 156
fix: stabilize metadata filters on postgres #536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Signed-off-by: phernandez <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4dbcc52e3e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if filt.op in {"gt", "gte", "lt", "lte", "between"}: | ||
| if filt.comparison == "numeric": | ||
| numeric_expr = ( | ||
| f"CASE WHEN ({text_expr}) ~ '^-?\\\\d+(\\\\.\\\\d+)?$' " | ||
| f"THEN ({text_expr})::double precision END" | ||
| ) | ||
| compare_expr = numeric_expr | ||
| else: | ||
| compare_expr = text_expr | ||
| compare_expr = ( | ||
| f"({metadata_expr} #>> '{path}')::double precision" | ||
| if filt.comparison == "numeric" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Restore numeric-guard to avoid cast failures
Casting #>> directly to double precision will raise invalid input syntax for type double precision if any row has non-numeric text at that metadata path (e.g., "N/A"), causing the entire search query to error out even though the filter value is numeric. The previous CASE+regex avoided this by returning NULL for non-numeric values; with the new unconditional cast, numeric comparisons now fail for mixed-type metadata.
Useful? React with 👍 / 👎.
|
Claude finished @phernandez's task in 2m 19s —— View job PR Review: Fix metadata filters for PostgresI've reviewed this PR against the Basic Memory team checklist. Here's my analysis: Summary of ChangesThis PR fixes Postgres metadata filter handling by:
Critical Issue: P1 Concern is Valid
|
Signed-off-by: phernandez <[email protected]>
|
Claude finished @phernandez's task in 2m 30s —— View job PR Review: Metadata Filter Fixes for PostgresI've reviewed this PR against the Basic Memory team checklist and analyzed the P1 concern raised by both automated reviewers. Critical Issue: P1 Concern is Valid
|
Summary
Testing