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.
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.withimplementation (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::Mergeronly knows about@values[:with]— not@values[:cte].I noticed there's a
cte_deprecationbranch that appears to address this — happy to help if that effort is still active.