Skip to content

query a stored range with the Postgres range operators #821

Description

@matt-beanland

Code of Conduct

  • I agree to follow this project's Code of Conduct

AI Policy

  • 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions