ash-project / ash-project/ash_postgres
query a stored range with the Postgres range operators
- Dominant language
- Elixir
- Stars
- 189
- Forks
- 168
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 22
Description
### Code of Conduct
- [x] I agree to follow this project's Code of Conduct
### AI Policy
- [x] I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.
### Is your feature request related to a problem? Please describe.
Filtering or sorting on a range attribute fails: `Unsupported expression in Elixir.AshPostgres.SqlImplementation query: ... Ash.Query.Function.RangeLower`.
A range is stored natively since #817, but none of its expressions render, so the column's own operators are unreachable.
### Describe the solution you'd like
Render the range expressions to their Postgres equivalents: `range_overlaps/2` to `&&`, `range_lower/1` and `range_upper/1` to `lower()` and `upper()`, and `range_contains/2` and `range_adjacent/2` to `@>` and `-|-` once ash#2877 lands.
The rendering belongs in ash_sql, and the tests here, as ash_sql#245 and #814 did for Duration.
### Describe alternatives you've considered
_No response_
### Additional context
_No response_
Contributor guide
Research direction
Begin with the existing Duration expression rendering and tests referenced by ash_sql#245 and #814; use those as the entry point in ash_sql. Verify the listed Postgres mappings in tests, including the two operators gated on ash#2877; done means the range expressions render correctly, with contains and adjacent covered once that dependency lands.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- elixir, postgresql
- Domain
- databases
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 58/100