Mark WITH RECURSIVE queries as read-only
What does this MR do and why?
Marks CTEs as read-only:
> pat_family.update_all(revoked: true)
ActiveRecord::ReadOnlyRecord: This relation is marked as read-only
However, it allows using the CTE in a subquery:
> PersonalAccessToken
.where(id: pat_family.pluck_primary_key)
.update_all(revoked: true)
=> 1
Follow-up to gitlab-com/gl-infra/production#16047 (comment 1475636660).
Related to #419012 (closed).
Screenshots or screen recordings
Screenshots are required for UI changes, and strongly recommended for all other merge requests.
Before | After |
---|---|
How to set up and validate locally
Numbered steps to set up and validate the change are strongly suggested.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Imre Farkas