Skip to content

.with (CTE) override conflicts with Rails 7.1+ native .with — CTEs silently dropped during relation merges #131

Description

@nourmat

Description

Since Rails 7.1, ActiveRecord has native CTE support via ActiveRecord::Relation#with, storing CTE definitions in @values[:with]. This gem prepends its own .with implementation (ActiveRecordExtended::QueryMethods::WithCTE) which stores CTEs in @values[:cte] instead.

This causes CTEs to be silently dropped when relations are merged (e.g. via .merge, or gems that compose scopes like filtering/pagination), because Rails' Relation::Merger only knows about @values[:with] — not @values[:cte].

I noticed there's a cte_deprecation branch that appears to address this — happy to help if that effort is still active.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions