Files
gitlab-foss/lib/gitlab/database/as_with_materialized.rb
2023-08-31 09:10:44 +00:00

19 lines
465 B
Ruby

# frozen_string_literal: true
module Gitlab
module Database
# This class is a special Arel node which allows optionally define the `MATERIALIZED` keyword for CTE and Recursive CTE queries.
class AsWithMaterialized < Arel::Nodes::As
MATERIALIZED = 'MATERIALIZED '
def initialize(left, right, materialized: true)
if materialized
right.prepend(MATERIALIZED)
end
super(left, right)
end
end
end
end