Skip to content

Comments

feat: support offset option in relationship joins#214

Open
nallwhy wants to merge 1 commit intoash-project:mainfrom
nallwhy:feature/relationship-offset
Open

feat: support offset option in relationship joins#214
nallwhy wants to merge 1 commit intoash-project:mainfrom
nallwhy:feature/relationship-offset

Conversation

@nallwhy
Copy link

@nallwhy nallwhy commented Feb 25, 2026

Summary

  • Support the new offset option on has_one and has_many relationships when building SQL joins
  • Add query.offset to the has_parent_expr? check so offset triggers lateral joins
  • Re-apply relationship.offset in related_query after the query is unset
  • Apply offset in limit_from_many subqueries for both from_many? and limit clauses

Related

Test plan

  • Existing ash_sql tests pass (0 failures)
  • Verified with ash_postgres integration tests using ASH_VERSION=local ASH_SQL_VERSION=local

🤖 Generated with Claude Code

Adds offset support to the SQL join layer for has_one and has_many
relationships. This works alongside the offset option being added
to Ash core (ash-project/ash#2584).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for the offset option on has_one and has_many relationships when building SQL joins in ash_sql. The implementation follows the same pattern as the existing limit option, ensuring consistent behavior across the join pipeline.

Changes:

  • Added query.offset check to the has_parent_expr? condition to trigger lateral joins when offset is present
  • Re-applied relationship.offset after query unset operations in the relationship query pipeline
  • Applied offset in limit_from_many subqueries for both from_many? and limit cases

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants