Fix CTE relations to work with update_all etc
We found in incident that CTE relations created via (with
config/initializers/postgresql_cte.rb) does not work with update_all
etc.
We should either:
- Fix CTE relations to work with
update_all
etc, - Or make CTE relations
readonly
. We already do this for some CTE queries, e.g. gitlab-com/gl-infra/production#16042 (comment 1470786978)
NOTE: with
is now supported in Rails 7.1 https://edgeapi.rubyonrails.org/classes/ActiveRecord/QueryMethods.html#method-i-with
Edited by Thong Kuah