Use the Gitlab::Database::AsWithMaterialized helper for PG11 support [RUN ALL RSPEC]
What does this MR do?
This fixes an error that was only occurring on PG11 (in nightly pipelines), introduced by !61983 (merged).
Related to #333150 (closed).
Edited by Rémy Coutable